| Index: chrome/common/extensions/extension.cc
|
| diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
|
| index 5e13f243fbd0003da90feb8c3d194709981ead7e..08165317dc5c695c60fec2d6ba2fc91c8fc8da1d 100644
|
| --- a/chrome/common/extensions/extension.cc
|
| +++ b/chrome/common/extensions/extension.cc
|
| @@ -29,6 +29,7 @@
|
| // TODO(rdevlin.cronin): Remove this once PageAction, BrowserAction, and
|
| // SystemIndicator have been moved out of Extension.
|
| #include "chrome/common/extensions/api/extension_action/action_info.h"
|
| +#include "chrome/common/extensions/api/extension_action/page_action_handler.h"
|
| #include "chrome/common/extensions/csp_validator.h"
|
| #include "chrome/common/extensions/extension_manifest_constants.h"
|
| #include "chrome/common/extensions/extension_resource.h"
|
| @@ -907,10 +908,11 @@ std::set<FilePath> Extension::GetBrowserImages() const {
|
| }
|
| }
|
|
|
| - if (page_action_info() && !page_action_info()->default_icon.empty()) {
|
| + const ActionInfo* page_action_info = ActionInfo::GetPageActionInfo(this);
|
| + if (page_action_info && !page_action_info->default_icon.empty()) {
|
| for (ExtensionIconSet::IconMap::const_iterator iter =
|
| - page_action_info()->default_icon.map().begin();
|
| - iter != page_action_info()->default_icon.map().end();
|
| + page_action_info->default_icon.map().begin();
|
| + iter != page_action_info->default_icon.map().end();
|
| ++iter) {
|
| image_paths.insert(FilePath::FromWStringHack(UTF8ToWide(iter->second)));
|
| }
|
| @@ -2436,7 +2438,6 @@ bool Extension::LoadExtensionFeatures(APIPermissionSet* api_permissions,
|
|
|
| if (!LoadManifestHandlerFeatures(error) ||
|
| !LoadContentScripts(error) ||
|
| - !LoadPageAction(error) ||
|
| !LoadBrowserAction(error) ||
|
| !LoadSystemIndicator(api_permissions, error) ||
|
| !LoadIncognitoMode(error) ||
|
| @@ -2457,6 +2458,24 @@ bool Extension::LoadManifestHandlerFeatures(string16* error) {
|
| return false;
|
| }
|
| }
|
| +
|
| + std::vector<ManifestMultiKeyHandler::KeySet> key_sets =
|
| + ManifestMultiKeyHandler::GetKeySets();
|
| + for (size_t i = 0; i < key_sets.size(); ++i) {
|
| + scoped_ptr<DictionaryValue> dict(new DictionaryValue);
|
| + // TODO(yoz): should be a const_iterator
|
| + for (ManifestMultiKeyHandler::KeySet::iterator ki = key_sets[i].begin();
|
| + ki != key_sets[i].end(); ++ki) {
|
| + Value* value = NULL;
|
| + if (manifest_->Get(*ki, &value)) {
|
| + dict->Set(*ki, value->DeepCopy());
|
| + }
|
| + if (!ManifestMultiKeyHandler::Get(key_sets[i])->Parse(
|
| + dict.get(), this, error))
|
| + return false;
|
| + }
|
| + }
|
| +
|
| return true;
|
| }
|
|
|
| @@ -2490,48 +2509,6 @@ bool Extension::LoadContentScripts(string16* error) {
|
| return true;
|
| }
|
|
|
| -bool Extension::LoadPageAction(string16* error) {
|
| - DictionaryValue* page_action_value = NULL;
|
| -
|
| - if (manifest_->HasKey(keys::kPageActions)) {
|
| - ListValue* list_value = NULL;
|
| - if (!manifest_->GetList(keys::kPageActions, &list_value)) {
|
| - *error = ASCIIToUTF16(errors::kInvalidPageActionsList);
|
| - return false;
|
| - }
|
| -
|
| - size_t list_value_length = list_value->GetSize();
|
| -
|
| - if (list_value_length == 0u) {
|
| - // A list with zero items is allowed, and is equivalent to not having
|
| - // a page_actions key in the manifest. Don't set |page_action_value|.
|
| - } else if (list_value_length == 1u) {
|
| - if (!list_value->GetDictionary(0, &page_action_value)) {
|
| - *error = ASCIIToUTF16(errors::kInvalidPageAction);
|
| - return false;
|
| - }
|
| - } else { // list_value_length > 1u.
|
| - *error = ASCIIToUTF16(errors::kInvalidPageActionsListSize);
|
| - return false;
|
| - }
|
| - } else if (manifest_->HasKey(keys::kPageAction)) {
|
| - if (!manifest_->GetDictionary(keys::kPageAction, &page_action_value)) {
|
| - *error = ASCIIToUTF16(errors::kInvalidPageAction);
|
| - return false;
|
| - }
|
| - }
|
| -
|
| - // If page_action_value is not NULL, then there was a valid page action.
|
| - if (page_action_value) {
|
| - page_action_info_ = LoadExtensionActionInfoHelper(
|
| - this, page_action_value, error);
|
| - if (!page_action_info_.get())
|
| - return false; // Failed to parse page action definition.
|
| - }
|
| -
|
| - return true;
|
| -}
|
| -
|
| bool Extension::LoadBrowserAction(string16* error) {
|
| if (!manifest_->HasKey(keys::kBrowserAction))
|
| return true;
|
| @@ -3033,7 +3010,7 @@ bool Extension::LoadOAuth2Info(string16* error) {
|
| bool Extension::HasMultipleUISurfaces() const {
|
| int num_surfaces = 0;
|
|
|
| - if (page_action_info())
|
| + if (ActionInfo::GetPageActionInfo(this))
|
| ++num_surfaces;
|
|
|
| if (browser_action_info())
|
|
|