On Thu, Jul 30, 2009 at 10:44 AM, James Robinson <jam...@google.com> wrote:

> On Tue, Jul 28, 2009 at 6:02 PM, Matt Perry <mpcompl...@chromium.org>wrote:
>
>> Two suggestions (one I accidentally sent only to James):
>>
>> chrome.extension.Port:
>>
>> // ID of the extension at the other side of this port.
>> String senderID;
>>
>> Port currently has a 'tab' property if the sender was a tab.  Maybe we
>> should group these:
>>
>> chrome.extension.Port:
>>   Object sender:
>>     Object tab; // if the sender was a tab
>>     String id;  // ID of the sending extension.
>>
>>
>> chrome.extension:
>>
>>
>>
>> // Open a channel to another extension with the provided ID.
>>
>>
>> // If no extension with the provided ID exists, nothing happens.
>>
>>
>>
>> // Otherwise the chrome.extension.onConnectExternal event is fired
>>
>>
>> // to all components of the extension with the provided ID each time
>>
>>
>>
>> // the method is called.
>>
>>
>> // The channel can optionally be named. This name will be sent along
>>
>>
>>
>> // with the onConnectExternal event
>>
>>
>> Port connectExternal(string ID, [string channelName])
>>
>>
>>
>> It makes more sense to me to have the API mirror the regular connect
>> event:
>>
>>>   chrome.extension.connect();  // connects to my own extension
>>
>>>   other = new chrome.Extension('abcef...');
>>   other.connect();  // connects to extension abcdef...
>>
>>
> The reason I shied away from this is that the behavior of the statement
> "new chrome.Extension('abdef...').connect()" is very different depending on
> if 'abcdef...' is the ID of the extension containing that code or a
> different one.
>

How is it different? Sounds like a bug to me.

 It's also not clear from the documentation what an extension should expect
> to be able to do with the result of "new chrome.Extension('abcdef...').
>  According to
> http://dev.chromium.org/developers/design-documents/extensions/content-scripts
>  the
> available APIs in addition to connect() are the onConnect event, which
> another extension should _not_ have access to, and getURL(path), which seems
> like it would just return chrome-extension://abcdef.../path.  Based on that
> I don't see much value in exposing the new chrome.Extension('abcdef...')
> syntax for inter-extension interaction.
>

The value is consistency. <extensionObject>.connect() is how you open a port
to that extension. It should be the same regardless of who you're talking
to.

--~--~---------~--~----~------------~-------~--~----~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
    http://groups.google.com/group/chromium-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to