diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-01 02:52:44 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-01 02:52:44 +0000 |
commit | 8a2b3537d397d9eefe537eeb65bf891f2d572bf8 (patch) | |
tree | 8f7ca3f82a9f3fb80928fbb35bea43694c78aefc | |
parent | 0522f5b2e35625a3dc11928aec38a55d23eec01d (diff) | |
download | chromium_src-8a2b3537d397d9eefe537eeb65bf891f2d572bf8.zip chromium_src-8a2b3537d397d9eefe537eeb65bf891f2d572bf8.tar.gz chromium_src-8a2b3537d397d9eefe537eeb65bf891f2d572bf8.tar.bz2 |
Remove ExtensionMsg_UpdatePageActions.
BUG=70516
TBR=mpcomplete@chromium.org
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83687 0039d316-1c4b-4281-b951-d872f2087c98
6 files changed, 13 insertions, 62 deletions
diff --git a/chrome/browser/extensions/extension_process_manager.cc b/chrome/browser/extensions/extension_process_manager.cc index 4a26c5f5..f21c4f8 100644 --- a/chrome/browser/extensions/extension_process_manager.cc +++ b/chrome/browser/extensions/extension_process_manager.cc @@ -14,10 +14,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/common/extensions/extension.h" -#include "chrome/common/extensions/extension_action.h" -#include "chrome/common/extensions/extension_messages.h" #include "chrome/common/url_constants.h" -#include "content/browser/renderer_host/render_view_host.h" #include "content/browser/site_instance.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/notification_service.h" @@ -231,18 +228,6 @@ void ExtensionProcessManager::RegisterExtensionProcess( // reused from a dead renderer. DCHECK(it == process_ids_.end()); process_ids_[extension_id] = process_id; - - ExtensionService* extension_service = - browsing_instance_->profile()->GetExtensionService(); - - std::vector<std::string> page_action_ids; - const Extension* extension = - extension_service->GetExtensionById(extension_id, false); - if (extension->page_action()) - page_action_ids.push_back(extension->page_action()->id()); - - RenderProcessHost* rph = RenderProcessHost::FromID(process_id); - rph->Send(new ExtensionMsg_UpdatePageActions(extension_id, page_action_ids)); } void ExtensionProcessManager::UnregisterExtensionProcess(int process_id) { diff --git a/chrome/common/extensions/extension_messages.cc b/chrome/common/extensions/extension_messages.cc index 88c94926..cdb5e9d 100644 --- a/chrome/common/extensions/extension_messages.cc +++ b/chrome/common/extensions/extension_messages.cc @@ -35,6 +35,8 @@ ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params( extension_manifest_keys::kName, extension_manifest_keys::kVersion, extension_manifest_keys::kIcons, + extension_manifest_keys::kPageAction, + extension_manifest_keys::kPageActions, extension_manifest_keys::kPermissions, extension_manifest_keys::kApp }; diff --git a/chrome/common/extensions/extension_messages.h b/chrome/common/extensions/extension_messages.h index 74378dd..1181aa3 100644 --- a/chrome/common/extensions/extension_messages.h +++ b/chrome/common/extensions/extension_messages.h @@ -172,15 +172,6 @@ IPC_MESSAGE_CONTROL1(ExtensionMsg_SetFunctionNames, IPC_MESSAGE_CONTROL1(ExtensionMsg_ActivateExtension, std::string /* extension_id */) -// TODO(aa): UpdatePageActions might be replaced with just sending additional -// data in ExtensionLoaded. See: crbug.com/70516. - -// Tell the renderer process all known page action ids for a particular -// extension. -IPC_MESSAGE_CONTROL2(ExtensionMsg_UpdatePageActions, - std::string /* extension_id */, - std::vector<std::string> /* page_action_ids */) - // Notifies the renderer that an extension was loaded in the browser. IPC_MESSAGE_CONTROL1(ExtensionMsg_Loaded, ExtensionMsg_Loaded_Params) diff --git a/chrome/renderer/extensions/extension_dispatcher.cc b/chrome/renderer/extensions/extension_dispatcher.cc index fa3bc54..a2bb8c0 100644 --- a/chrome/renderer/extensions/extension_dispatcher.cc +++ b/chrome/renderer/extensions/extension_dispatcher.cc @@ -62,7 +62,6 @@ bool ExtensionDispatcher::OnControlMessageReceived( IPC_MESSAGE_HANDLER(ExtensionMsg_Unloaded, OnUnloaded) IPC_MESSAGE_HANDLER(ExtensionMsg_SetScriptingWhitelist, OnSetScriptingWhitelist) - IPC_MESSAGE_HANDLER(ExtensionMsg_UpdatePageActions, OnPageActionsUpdated) IPC_MESSAGE_HANDLER(ExtensionMsg_ActivateExtension, OnActivateExtension) IPC_MESSAGE_HANDLER(ExtensionMsg_UpdateUserScripts, OnUpdateUserScripts) IPC_MESSAGE_UNHANDLED(handled = false) @@ -149,17 +148,6 @@ void ExtensionDispatcher::OnSetScriptingWhitelist( Extension::SetScriptingWhitelist(extension_ids); } -void ExtensionDispatcher::OnPageActionsUpdated( - const std::string& extension_id, - const std::vector<std::string>& page_actions) { - if (!page_actions.empty()) { - page_action_ids_[extension_id] = page_actions; - } else { - if (page_action_ids_.find(extension_id) != page_action_ids_.end()) - page_action_ids_.erase(extension_id); - } -} - bool ExtensionDispatcher::IsExtensionActive(const std::string& extension_id) { return active_extension_ids_.find(extension_id) != active_extension_ids_.end(); diff --git a/chrome/renderer/extensions/extension_dispatcher.h b/chrome/renderer/extensions/extension_dispatcher.h index 1710745..c966d37 100644 --- a/chrome/renderer/extensions/extension_dispatcher.h +++ b/chrome/renderer/extensions/extension_dispatcher.h @@ -34,8 +34,6 @@ class Extension; // renderer extension related state. class ExtensionDispatcher : public RenderProcessObserver { public: - typedef std::map< std::string, std::vector<std::string> > PageActionIdMap; - ExtensionDispatcher(); virtual ~ExtensionDispatcher(); @@ -43,10 +41,6 @@ class ExtensionDispatcher : public RenderProcessObserver { return function_names_; } - const PageActionIdMap& page_action_map() const { - return page_action_ids_; - } - bool is_extension_process() const { return is_extension_process_; } const ExtensionSet* extensions() const { return &extensions_; } UserScriptSlave* user_script_slave() { return user_script_slave_.get(); } @@ -111,9 +105,6 @@ class ExtensionDispatcher : public RenderProcessObserver { // All declared function names from extension_api.json. std::set<std::string> function_names_; - // A map of extension ID to vector of page action ids. - PageActionIdMap page_action_ids_; - // The extensions that are active in this process. std::set<std::string> active_extension_ids_; diff --git a/chrome/renderer/extensions/extension_process_bindings.cc b/chrome/renderer/extensions/extension_process_bindings.cc index dec277e..9cb0e79 100644 --- a/chrome/renderer/extensions/extension_process_bindings.cc +++ b/chrome/renderer/extensions/extension_process_bindings.cc @@ -15,6 +15,7 @@ #include "base/string_number_conversions.h" #include "base/string_util.h" #include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/extension_action.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/extension_messages.h" #include "chrome/common/extensions/extension_set.h" @@ -304,23 +305,16 @@ class ExtensionImpl : public ExtensionBase { const v8::Arguments& args) { ExtensionImpl* v8_extension = GetFromArguments<ExtensionImpl>(args); std::string extension_id = *v8::String::Utf8Value(args[0]->ToString()); - const ExtensionDispatcher::PageActionIdMap& page_action_map = - v8_extension->extension_dispatcher_->page_action_map(); - ExtensionDispatcher::PageActionIdMap::const_iterator it = - page_action_map.find(extension_id); - - std::vector<std::string> page_actions; - size_t size = 0; - if (it != page_action_map.end()) { - page_actions = it->second; - size = page_actions.size(); - } - - v8::Local<v8::Array> page_action_vector = v8::Array::New(size); - for (size_t i = 0; i < size; ++i) { - std::string page_action_id = page_actions[i]; - page_action_vector->Set(v8::Integer::New(i), - v8::String::New(page_action_id.c_str())); + const ::Extension* extension = + v8_extension->extension_dispatcher_->extensions()->GetByID( + extension_id); + CHECK(extension); + + v8::Local<v8::Array> page_action_vector = v8::Array::New(); + if (extension->page_action()) { + std::string id = extension->page_action()->id(); + page_action_vector->Set(v8::Integer::New(0), + v8::String::New(id.c_str(), id.size())); } return page_action_vector; |