summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/autocomplete/autocomplete.cc3
-rw-r--r--chrome/browser/autocomplete/autocomplete.h3
-rw-r--r--chrome/browser/autocomplete/keyword_provider.cc60
-rw-r--r--chrome/browser/autocomplete/keyword_provider.h14
-rw-r--r--chrome/browser/extensions/extension_browser_event_router.cc6
-rw-r--r--chrome/browser/extensions/extension_message_service.cc16
-rw-r--r--chrome/browser/extensions/extension_message_service.h11
-rw-r--r--chrome/browser/extensions/extension_omnibox_api.cc39
-rw-r--r--chrome/browser/extensions/extension_omnibox_api.h10
-rw-r--r--chrome/browser/extensions/extensions_service.cc6
-rw-r--r--chrome/browser/search_engines/template_url_model.cc12
-rw-r--r--chrome/common/extensions/api/extension_api.json18
-rw-r--r--chrome/common/extensions/docs/experimental.omnibox.html52
-rw-r--r--chrome/common/notification_type.h8
-rw-r--r--chrome/renderer/resources/extension_process_bindings.js20
15 files changed, 237 insertions, 41 deletions
diff --git a/chrome/browser/autocomplete/autocomplete.cc b/chrome/browser/autocomplete/autocomplete.cc
index e42ee92..a8a9e4e 100644
--- a/chrome/browser/autocomplete/autocomplete.cc
+++ b/chrome/browser/autocomplete/autocomplete.cc
@@ -809,8 +809,7 @@ void AutocompleteController::Start(const std::wstring& text,
void AutocompleteController::Stop(bool clear_result) {
for (ACProviders::const_iterator i(providers_.begin()); i != providers_.end();
++i) {
- if (!(*i)->done())
- (*i)->Stop();
+ (*i)->Stop();
}
update_delay_timer_.Stop();
diff --git a/chrome/browser/autocomplete/autocomplete.h b/chrome/browser/autocomplete/autocomplete.h
index 2338846..9cfb1b4 100644
--- a/chrome/browser/autocomplete/autocomplete.h
+++ b/chrome/browser/autocomplete/autocomplete.h
@@ -528,7 +528,8 @@ class AutocompleteProvider
bool minimal_changes) = 0;
// Called when a provider must not make any more callbacks for the current
- // query.
+ // query. This will be called regardless of whether the provider is already
+ // done.
virtual void Stop() {
done_ = true;
}
diff --git a/chrome/browser/autocomplete/keyword_provider.cc b/chrome/browser/autocomplete/keyword_provider.cc
index 756818c..1e68de5 100644
--- a/chrome/browser/autocomplete/keyword_provider.cc
+++ b/chrome/browser/autocomplete/keyword_provider.cc
@@ -20,6 +20,24 @@
#include "net/base/escape.h"
#include "net/base/net_util.h"
+// Helper functor for Start(), for ending keyword mode unless explicitly told
+// otherwise.
+class KeywordProvider::ScopedEndExtensionKeywordMode {
+ public:
+ ScopedEndExtensionKeywordMode(KeywordProvider* provider)
+ : provider_(provider) { }
+ ~ScopedEndExtensionKeywordMode() {
+ if (provider_)
+ provider_->MaybeEndExtensionKeywordMode();
+ }
+
+ void StayInKeywordMode() {
+ provider_ = NULL;
+ }
+ private:
+ KeywordProvider* provider_;
+};
+
// static
std::wstring KeywordProvider::SplitReplacementStringFromInput(
const std::wstring& input) {
@@ -42,6 +60,8 @@ KeywordProvider::KeywordProvider(ACProviderListener* listener, Profile* profile)
// suggestions are meant for us.
registrar_.Add(this, NotificationType::EXTENSION_OMNIBOX_SUGGESTIONS_READY,
Source<Profile>(profile->GetOriginalProfile()));
+ registrar_.Add(this, NotificationType::EXTENSION_OMNIBOX_INPUT_ENTERED,
+ Source<Profile>(profile));
}
KeywordProvider::KeywordProvider(ACProviderListener* listener,
@@ -97,6 +117,10 @@ const TemplateURL* KeywordProvider::GetSubstitutingTemplateURLForInput(
void KeywordProvider::Start(const AutocompleteInput& input,
bool minimal_changes) {
+ // This object ensures we end keyword mode if we exit the function without
+ // toggling keyword mode to on.
+ ScopedEndExtensionKeywordMode keyword_mode_toggle(this);
+
matches_.clear();
if (!minimal_changes) {
@@ -165,6 +189,12 @@ void KeywordProvider::Start(const AutocompleteInput& input,
if (!enabled)
return;
+ if (extension->id() != current_keyword_extension_id_)
+ MaybeEndExtensionKeywordMode();
+ if (current_keyword_extension_id_.empty())
+ EnterExtensionKeywordMode(extension->id());
+ keyword_mode_toggle.StayInKeywordMode();
+
if (minimal_changes) {
// If the input hasn't significantly changed, we can just use the
// suggestions from last time. We need to readjust the relevance to
@@ -205,6 +235,11 @@ void KeywordProvider::Start(const AutocompleteInput& input,
}
}
+void KeywordProvider::Stop() {
+ done_ = true;
+ MaybeEndExtensionKeywordMode();
+}
+
// static
bool KeywordProvider::ExtractKeywordFromInput(const AutocompleteInput& input,
std::wstring* keyword,
@@ -365,6 +400,13 @@ AutocompleteMatch KeywordProvider::CreateAutocompleteMatch(
void KeywordProvider::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
+ if (type == NotificationType::EXTENSION_OMNIBOX_INPUT_ENTERED) {
+ // Input has been accepted, so we're done with this input session. Ensure
+ // we don't send the OnInputCancelled event.
+ current_keyword_extension_id_.clear();
+ return;
+ }
+
// TODO(mpcomplete): consider clamping the number of suggestions to
// AutocompleteProvider::kMaxMatches.
DCHECK(type == NotificationType::EXTENSION_OMNIBOX_SUGGESTIONS_READY);
@@ -409,3 +451,21 @@ void KeywordProvider::Observe(NotificationType type,
extension_suggest_matches_.end());
listener_->OnProviderUpdate(!extension_suggest_matches_.empty());
}
+
+void KeywordProvider::EnterExtensionKeywordMode(
+ const std::string& extension_id) {
+ DCHECK(current_keyword_extension_id_.empty());
+ current_keyword_extension_id_ = extension_id;
+
+ ExtensionOmniboxEventRouter::OnInputStarted(
+ profile_, current_keyword_extension_id_);
+}
+
+void KeywordProvider::MaybeEndExtensionKeywordMode() {
+ if (!current_keyword_extension_id_.empty()) {
+ ExtensionOmniboxEventRouter::OnInputCancelled(
+ profile_, current_keyword_extension_id_);
+
+ current_keyword_extension_id_.clear();
+ }
+}
diff --git a/chrome/browser/autocomplete/keyword_provider.h b/chrome/browser/autocomplete/keyword_provider.h
index 3ef770d..ee9de7a 100644
--- a/chrome/browser/autocomplete/keyword_provider.h
+++ b/chrome/browser/autocomplete/keyword_provider.h
@@ -68,10 +68,13 @@ class KeywordProvider :
std::wstring* remaining_input);
// AutocompleteProvider
- virtual void Start(const AutocompleteInput& input,
- bool minimal_changes);
+ virtual void Start(const AutocompleteInput& input, bool minimal_changes);
+ virtual void Stop();
private:
+ class ScopedEndExtensionKeywordMode;
+ friend class ScopedEndExtensionKeywordMode;
+
~KeywordProvider() {}
// Extracts the keyword from |input| into |keyword|. Any remaining characters
@@ -115,6 +118,9 @@ class KeywordProvider :
const std::wstring& remaining_input,
int relevance);
+ void EnterExtensionKeywordMode(const std::string& extension_id);
+ void MaybeEndExtensionKeywordMode();
+
// NotificationObserver interface.
void Observe(NotificationType type,
const NotificationSource& source,
@@ -137,6 +143,10 @@ class KeywordProvider :
// we need to reset our matches without asking the extension again.
std::vector<AutocompleteMatch> extension_suggest_matches_;
+ // If non-empty, holds the ID of the extension whose keyword is currently in
+ // the URL bar while the autocomplete popup is open.
+ std::string current_keyword_extension_id_;
+
NotificationRegistrar registrar_;
DISALLOW_COPY_AND_ASSIGN(KeywordProvider);
diff --git a/chrome/browser/extensions/extension_browser_event_router.cc b/chrome/browser/extensions/extension_browser_event_router.cc
index 5790290..55cf6fd 100644
--- a/chrome/browser/extensions/extension_browser_event_router.cc
+++ b/chrome/browser/extensions/extension_browser_event_router.cc
@@ -454,7 +454,8 @@ void ExtensionBrowserEventRouter::PageActionExecuted(
NULL, NULL, &tab_contents, NULL)) {
return;
}
- std::string event_name = std::string("pageAction/") + extension_id;
+ std::string event_name = ExtensionMessageService::GetPerExtensionEventName(
+ "pageAction.onClicked", extension_id);
DispatchEventWithTab(profile, event_name.c_str(), tab_contents);
}
@@ -464,6 +465,7 @@ void ExtensionBrowserEventRouter::BrowserActionExecuted(
int tab_id = 0;
if (!ExtensionTabUtil::GetDefaultTab(browser, &tab_contents, &tab_id))
return;
- std::string event_name = std::string("browserAction/") + extension_id;
+ std::string event_name = ExtensionMessageService::GetPerExtensionEventName(
+ "browserAction.onClicked", extension_id);
DispatchEventWithTab(profile, event_name.c_str(), tab_contents);
}
diff --git a/chrome/browser/extensions/extension_message_service.cc b/chrome/browser/extensions/extension_message_service.cc
index 2c7f693..979437a 100644
--- a/chrome/browser/extensions/extension_message_service.cc
+++ b/chrome/browser/extensions/extension_message_service.cc
@@ -114,6 +114,14 @@ const char ExtensionMessageService::kDispatchOnMessage[] =
const char ExtensionMessageService::kDispatchEvent[] =
"Event.dispatchJSON";
+// static
+std::string ExtensionMessageService::GetPerExtensionEventName(
+ const std::string& event_name, const std::string& extension_id) {
+ // This should match the method we use in extension_process_binding.js when
+ // setting up the corresponding chrome.Event object.
+ return event_name + "/" + extension_id;
+}
+
ExtensionMessageService::ExtensionMessageService(Profile* profile)
: profile_(profile),
extension_devtools_manager_(NULL),
@@ -485,6 +493,14 @@ void ExtensionMessageService::DispatchEventToRenderers(
}
}
+void ExtensionMessageService::DispatchEventToExtension(
+ const std::string& extension_id,
+ const std::string& event_name, const std::string& event_args,
+ bool has_incognito_data, const GURL& event_url) {
+ DispatchEventToRenderers(GetPerExtensionEventName(event_name, extension_id),
+ event_args, has_incognito_data, event_url);
+}
+
void ExtensionMessageService::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
diff --git a/chrome/browser/extensions/extension_message_service.h b/chrome/browser/extensions/extension_message_service.h
index bf49948..fa89786 100644
--- a/chrome/browser/extensions/extension_message_service.h
+++ b/chrome/browser/extensions/extension_message_service.h
@@ -62,6 +62,10 @@ class ExtensionMessageService
struct MessageChannel;
struct MessagePort;
+ // Returns the event name for an event that is extension-specific.
+ static std::string GetPerExtensionEventName(const std::string& event_name,
+ const std::string& extension_id);
+
// --- UI thread only:
explicit ExtensionMessageService(Profile* profile);
@@ -92,6 +96,13 @@ class ExtensionMessageService
const std::string& event_name, const std::string& event_args,
bool has_incognito_data, const GURL& event_url);
+ // Same as above, except use the extension-specific naming scheme for the
+ // event. This is used by events that are per-extension.
+ void DispatchEventToExtension(
+ const std::string& extension_id,
+ const std::string& event_name, const std::string& event_args,
+ bool has_incognito_data, const GURL& event_url);
+
// Given an extension ID, opens a channel between the given
// automation "port" or DevTools service and that extension. the
// channel will be open to the extension process hosting the
diff --git a/chrome/browser/extensions/extension_omnibox_api.cc b/chrome/browser/extensions/extension_omnibox_api.cc
index 5c046a3..2f3f8f1 100644
--- a/chrome/browser/extensions/extension_omnibox_api.cc
+++ b/chrome/browser/extensions/extension_omnibox_api.cc
@@ -12,8 +12,10 @@
#include "chrome/common/notification_service.h"
namespace events {
-const char kOnInputChanged[] = "experimental.omnibox.onInputChanged/";
-const char kOnInputEntered[] = "experimental.omnibox.onInputEntered/";
+const char kOnInputStarted[] = "experimental.omnibox.onInputStarted";
+const char kOnInputChanged[] = "experimental.omnibox.onInputChanged";
+const char kOnInputEntered[] = "experimental.omnibox.onInputEntered";
+const char kOnInputCancelled[] = "experimental.omnibox.onInputCancelled";
}; // namespace events
namespace {
@@ -31,10 +33,19 @@ const wchar_t kDescriptionStylesOffset[] = L"offset";
}; // namespace
// static
+void ExtensionOmniboxEventRouter::OnInputStarted(
+ Profile* profile, const std::string& extension_id) {
+ profile->GetExtensionMessageService()->DispatchEventToExtension(
+ extension_id, events::kOnInputStarted, "[]", profile->IsOffTheRecord(),
+ GURL());
+}
+
+// static
bool ExtensionOmniboxEventRouter::OnInputChanged(
Profile* profile, const std::string& extension_id,
const std::string& input, int suggest_id) {
- std::string event_name = events::kOnInputChanged + extension_id;
+ std::string event_name = ExtensionMessageService::GetPerExtensionEventName(
+ events::kOnInputChanged, extension_id);
if (!profile->GetExtensionMessageService()->HasEventListener(event_name))
return false;
@@ -44,8 +55,9 @@ bool ExtensionOmniboxEventRouter::OnInputChanged(
std::string json_args;
base::JSONWriter::Write(&args, false, &json_args);
- profile->GetExtensionMessageService()->DispatchEventToRenderers(
- event_name, json_args, profile->IsOffTheRecord(), GURL());
+ profile->GetExtensionMessageService()->DispatchEventToExtension(
+ extension_id, events::kOnInputChanged, json_args,
+ profile->IsOffTheRecord(), GURL());
return true;
}
@@ -60,8 +72,21 @@ void ExtensionOmniboxEventRouter::OnInputEntered(
std::string json_args;
base::JSONWriter::Write(&args, false, &json_args);
- profile->GetExtensionMessageService()->DispatchEventToRenderers(
- event_name, json_args, profile->IsOffTheRecord(), GURL());
+ profile->GetExtensionMessageService()->DispatchEventToExtension(
+ extension_id, events::kOnInputEntered, json_args,
+ profile->IsOffTheRecord(), GURL());
+
+ NotificationService::current()->Notify(
+ NotificationType::EXTENSION_OMNIBOX_INPUT_ENTERED,
+ Source<Profile>(profile), NotificationService::NoDetails());
+}
+
+// static
+void ExtensionOmniboxEventRouter::OnInputCancelled(
+ Profile* profile, const std::string& extension_id) {
+ profile->GetExtensionMessageService()->DispatchEventToExtension(
+ extension_id, events::kOnInputCancelled, "[]", profile->IsOffTheRecord(),
+ GURL());
}
bool OmniboxSendSuggestionsFunction::RunImpl() {
diff --git a/chrome/browser/extensions/extension_omnibox_api.h b/chrome/browser/extensions/extension_omnibox_api.h
index 4af9ee5..320b40a 100644
--- a/chrome/browser/extensions/extension_omnibox_api.h
+++ b/chrome/browser/extensions/extension_omnibox_api.h
@@ -12,6 +12,11 @@
// Event router class for events related to the omnibox API.
class ExtensionOmniboxEventRouter {
public:
+ // The user has just typed the omnibox keyword. This is sent exactly once in
+ // a given input session, before any OnInputChanged events.
+ static void OnInputStarted(
+ Profile* profile, const std::string& extension_id);
+
// The user has changed what is typed into the omnibox while in an extension
// keyword session. Returns true if someone is listening to this event, and
// thus we have some degree of confidence we'll get a response.
@@ -24,6 +29,11 @@ class ExtensionOmniboxEventRouter {
Profile* profile, const std::string& extension_id,
const std::string& input);
+ // The user has cleared the keyword, or closed the omnibox popup. This is
+ // sent at most once in a give input session, after any OnInputChanged events.
+ static void OnInputCancelled(
+ Profile* profile, const std::string& extension_id);
+
private:
DISALLOW_COPY_AND_ASSIGN(ExtensionOmniboxEventRouter);
};
diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc
index 81c56f3..78c600f 100644
--- a/chrome/browser/extensions/extensions_service.cc
+++ b/chrome/browser/extensions/extensions_service.cc
@@ -901,6 +901,9 @@ void ExtensionsService::OnExtensionLoaded(Extension* extension,
extension->set_being_upgraded(false);
UpdateActiveExtensionsInCrashReporter();
+
+ if (profile_->GetTemplateURLModel())
+ profile_->GetTemplateURLModel()->RegisterExtensionKeyword(extension);
}
void ExtensionsService::UpdateActiveExtensionsInCrashReporter() {
@@ -976,9 +979,6 @@ void ExtensionsService::OnExtensionInstalled(Extension* extension,
Details<Extension>(extension));
}
- if (profile_->GetTemplateURLModel())
- profile_->GetTemplateURLModel()->RegisterExtensionKeyword(extension);
-
// Transfer ownership of |extension| to OnExtensionLoaded.
OnExtensionLoaded(scoped_extension.release(), allow_privilege_increase);
}
diff --git a/chrome/browser/search_engines/template_url_model.cc b/chrome/browser/search_engines/template_url_model.cc
index b59c8ca31..bbb07fc 100644
--- a/chrome/browser/search_engines/template_url_model.cc
+++ b/chrome/browser/search_engines/template_url_model.cc
@@ -1068,9 +1068,7 @@ void TemplateURLModel::RegisterExtensionKeyword(Extension* extension) {
return;
}
- if (GetTemplateURLForExtension(extension))
- return; // Already have this one registered (might be an upgrade).
-
+ const TemplateURL* existing_url = GetTemplateURLForExtension(extension);
std::wstring keyword = UTF8ToWide(extension->omnibox_keyword());
TemplateURL* template_url = new TemplateURL;
@@ -1083,7 +1081,13 @@ void TemplateURLModel::RegisterExtensionKeyword(Extension* extension) {
extension->id() + "/?q={searchTerms}", 0, 0);
template_url->set_safe_for_autoreplace(false);
- Add(template_url);
+ if (existing_url) {
+ // TODO(mpcomplete): only replace if the user hasn't changed the keyword.
+ // (We don't have UI for that yet).
+ Replace(existing_url, template_url);
+ } else {
+ Add(template_url);
+ }
}
void TemplateURLModel::UnregisterExtensionKeyword(Extension* extension) {
diff --git a/chrome/common/extensions/api/extension_api.json b/chrome/common/extensions/api/extension_api.json
index ca7ed2a..9fe34cf 100644
--- a/chrome/common/extensions/api/extension_api.json
+++ b/chrome/common/extensions/api/extension_api.json
@@ -1346,6 +1346,7 @@
"events": [
{
"name": "onClicked",
+ "perExtensionEvent": true,
"type": "function",
"description": "Fired when a page action icon is clicked. This event will not fire if the page action has a popup.",
"parameters": [
@@ -1493,6 +1494,7 @@
"events": [
{
"name": "onClicked",
+ "perExtensionEvent": true,
"type": "function",
"description": "Fired when a browser action icon is clicked. This event will not fire if the browser action has a popup.",
"parameters": [
@@ -3132,7 +3134,15 @@
],
"events": [
{
+ "name": "onInputStarted",
+ "perExtensionEvent": true,
+ "type": "function",
+ "description": "User has started a keyword input session by typing the extension's keyword. This is guaranteed to be sent exactly once per input session, and before any onInputChanged events.",
+ "parameters": []
+ },
+ {
"name": "onInputChanged",
+ "perExtensionEvent": true,
"type": "function",
"description": "User has changed what is typed into the omnibox.",
"parameters": [
@@ -3159,6 +3169,7 @@
},
{
"name": "onInputEntered",
+ "perExtensionEvent": true,
"type": "function",
"description": "User has accepted what is typed into the omnibox.",
"parameters": [
@@ -3167,6 +3178,13 @@
"name": "text"
}
]
+ },
+ {
+ "name": "onInputCancelled",
+ "perExtensionEvent": true,
+ "type": "function",
+ "description": "User has ended the keyword input session without accepting the input.",
+ "parameters": []
}
]
}
diff --git a/chrome/common/extensions/docs/experimental.omnibox.html b/chrome/common/extensions/docs/experimental.omnibox.html
index a0fc7cc..415c38c 100644
--- a/chrome/common/extensions/docs/experimental.omnibox.html
+++ b/chrome/common/extensions/docs/experimental.omnibox.html
@@ -250,9 +250,13 @@
<a href="#events">Events</a>
<ol>
<li>
+ <a href="#event-onInputCancelled">onInputCancelled</a>
+ </li><li>
<a href="#event-onInputChanged">onInputChanged</a>
</li><li>
<a href="#event-onInputEntered">onInputEntered</a>
+ </li><li>
+ <a href="#event-onInputStarted">onInputStarted</a>
</li>
</ol>
</li>
@@ -731,6 +735,30 @@ see the <a href="experimental.html">chrome.experimental.* APIs</a> page.
<!-- iterates over all events -->
<div class="apiItem">
+ <a name="event-onInputCancelled"></a>
+ <h4>onInputCancelled</h4>
+
+ <div class="summary">
+ <!-- Note: intentionally longer 80 columns -->
+ <span class="subdued">chrome.experimental.omnibox.</span><span>onInputCancelled</span><span class="subdued">.addListener</span>(function(<span></span>) <span class="subdued">{...}</span>);
+ </div>
+
+ <div class="description">
+ <p class="todo" style="display: none; ">Undocumented.</p>
+ <p>User has ended the keyword input session without accepting the input.</p>
+
+ <!-- PARAMETERS -->
+ <h4>Parameters</h4>
+ <dl>
+ <div style="display: none; ">
+ <div>
+ </div>
+ </div>
+ </dl>
+
+ </div> <!-- /decription -->
+
+ </div><div class="apiItem">
<a name="event-onInputChanged"></a>
<h4>onInputChanged</h4>
@@ -932,6 +960,30 @@ see the <a href="experimental.html">chrome.experimental.* APIs</a> page.
</div> <!-- /decription -->
+ </div><div class="apiItem">
+ <a name="event-onInputStarted"></a>
+ <h4>onInputStarted</h4>
+
+ <div class="summary">
+ <!-- Note: intentionally longer 80 columns -->
+ <span class="subdued">chrome.experimental.omnibox.</span><span>onInputStarted</span><span class="subdued">.addListener</span>(function(<span></span>) <span class="subdued">{...}</span>);
+ </div>
+
+ <div class="description">
+ <p class="todo" style="display: none; ">Undocumented.</p>
+ <p>User has started a keyword input session by typing the extension's keyword. This is guaranteed to be sent exactly once per input session, and before any onInputChanged events.</p>
+
+ <!-- PARAMETERS -->
+ <h4>Parameters</h4>
+ <dl>
+ <div style="display: none; ">
+ <div>
+ </div>
+ </div>
+ </dl>
+
+ </div> <!-- /decription -->
+
</div> <!-- /apiItem -->
</div> <!-- /apiGroup -->
diff --git a/chrome/common/notification_type.h b/chrome/common/notification_type.h
index 935d13d..6462564 100644
--- a/chrome/common/notification_type.h
+++ b/chrome/common/notification_type.h
@@ -866,10 +866,14 @@ class NotificationType {
EXTENSION_BOOKMARKS_API_INVOKED,
// Sent when an omnibox extension has sent back omnibox suggestions. The
- // source is the profile, and the details are a
- // std::pair<int suggest_id, ListValue suggestions_array>
+ // source is the profile, and the details are an ExtensionOmniboxSuggestions
+ // object.
EXTENSION_OMNIBOX_SUGGESTIONS_READY,
+ // Sent when the user accepts the input in an extension omnibox keyword
+ // session. The source is the profile.
+ EXTENSION_OMNIBOX_INPUT_ENTERED,
+
// The source is the extension object that changed. Details is a bool*
// with the new visibility.
EXTENSION_APP_TOOLBAR_VISIBILITY_CHANGED,
diff --git a/chrome/renderer/resources/extension_process_bindings.js b/chrome/renderer/resources/extension_process_bindings.js
index c408f8e..4a59dcb 100644
--- a/chrome/renderer/resources/extension_process_bindings.js
+++ b/chrome/renderer/resources/extension_process_bindings.js
@@ -246,18 +246,6 @@ var chrome = chrome || {};
// Setup events for each extension_id/page_action_id string we find.
chrome.pageActions[pageActions[i]] = new chrome.Event(oldStyleEventName);
}
-
- // Note this is singular.
- var eventName = "pageAction/" + extensionId;
- chrome.pageAction = chrome.pageAction || {};
- chrome.pageAction.onClicked = new chrome.Event(eventName);
- }
-
- // Browser action events send {windowpId}.
- function setupBrowserActionEvent(extensionId) {
- var eventName = "browserAction/" + extensionId;
- chrome.browserAction = chrome.browserAction || {};
- chrome.browserAction.onClicked = new chrome.Event(eventName);
}
function setupToolstripEvents(renderViewId) {
@@ -294,11 +282,6 @@ var chrome = chrome || {};
}
function setupOmniboxEvents(extensionId) {
- chrome.experimental.omnibox.onInputEntered =
- new chrome.Event("experimental.omnibox.onInputEntered/" + extensionId);
-
- chrome.experimental.omnibox.onInputChanged =
- new chrome.Event("experimental.omnibox.onInputChanged/" + extensionId);
chrome.experimental.omnibox.onInputChanged.dispatch =
function(text, requestId) {
var suggestCallback = function(suggestions) {
@@ -394,6 +377,8 @@ var chrome = chrome || {};
return;
var eventName = apiDef.namespace + "." + eventDef.name;
+ if (eventDef.perExtensionEvent)
+ eventName = eventName + "/" + extensionId;
module[eventDef.name] = new chrome.Event(eventName,
eventDef.parameters);
});
@@ -671,7 +656,6 @@ var chrome = chrome || {};
chrome.test.getApiDefinitions = GetExtensionAPIDefinition;
}
- setupBrowserActionEvent(extensionId);
setupPageActionEvents(extensionId);
setupToolstripEvents(GetRenderViewId());
setupPopupEvents(GetRenderViewId());