summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authoryoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-30 00:01:18 +0000
committeryoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-30 00:01:18 +0000
commitce613ba0d5d3bc17cd55d582d4c3ad4667bee57e (patch)
treecb6ba45b8d889ed57152884222586dd4ff47bb72 /chrome/common
parenta9d2b465d3985155361fbe92cd4e239050b96f05 (diff)
downloadchromium_src-ce613ba0d5d3bc17cd55d582d4c3ad4667bee57e.zip
chromium_src-ce613ba0d5d3bc17cd55d582d4c3ad4667bee57e.tar.gz
chromium_src-ce613ba0d5d3bc17cd55d582d4c3ad4667bee57e.tar.bz2
Change ManifestHandler interface to always (implicitly) pass the entire manifest to handlers.
This makes it possible to support multi-key handlers using the same interface. Fixes a bug with default behavior for manifest handlers; previously, HasNoKey would be called even for inappropriate extension types. BUG=159265 Review URL: https://chromiumcodereview.appspot.com/12084034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179470 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/extensions/api/commands/commands_handler.cc39
-rw-r--r--chrome/common/extensions/api/commands/commands_handler.h7
-rw-r--r--chrome/common/extensions/api/extension_action/browser_action_handler.cc7
-rw-r--r--chrome/common/extensions/api/extension_action/browser_action_handler.h4
-rw-r--r--chrome/common/extensions/api/extension_action/script_badge_handler.cc24
-rw-r--r--chrome/common/extensions/api/extension_action/script_badge_handler.h6
-rw-r--r--chrome/common/extensions/api/extension_action/script_badge_manifest_unittest.cc1
-rw-r--r--chrome/common/extensions/api/file_handlers/file_handlers_parser.cc8
-rw-r--r--chrome/common/extensions/api/file_handlers/file_handlers_parser.h4
-rw-r--r--chrome/common/extensions/api/input_ime/input_components_handler.cc66
-rw-r--r--chrome/common/extensions/api/input_ime/input_components_handler.h4
-rw-r--r--chrome/common/extensions/api/omnibox/omnibox_handler.cc8
-rw-r--r--chrome/common/extensions/api/omnibox/omnibox_handler.h4
-rw-r--r--chrome/common/extensions/api/speech/tts_engine_manifest_handler.cc6
-rw-r--r--chrome/common/extensions/api/speech/tts_engine_manifest_handler.h3
-rw-r--r--chrome/common/extensions/extension.cc18
-rw-r--r--chrome/common/extensions/extension.h1
-rw-r--r--chrome/common/extensions/manifest.cc10
-rw-r--r--chrome/common/extensions/manifest.h4
-rw-r--r--chrome/common/extensions/manifest_handler.cc50
-rw-r--r--chrome/common/extensions/manifest_handler.h51
-rw-r--r--chrome/common/extensions/manifest_tests/extension_manifests_web_accessible_resources_unittest.cc4
-rw-r--r--chrome/common/extensions/manifest_url_handler.cc33
-rw-r--r--chrome/common/extensions/manifest_url_handler.h20
-rw-r--r--chrome/common/extensions/web_accessible_resources_handler.cc7
-rw-r--r--chrome/common/extensions/web_accessible_resources_handler.h4
-rw-r--r--chrome/common/extensions/web_intents_handler.cc7
-rw-r--r--chrome/common/extensions/web_intents_handler.h4
28 files changed, 182 insertions, 222 deletions
diff --git a/chrome/common/extensions/api/commands/commands_handler.cc b/chrome/common/extensions/api/commands/commands_handler.cc
index 33ab344..8cfafcc 100644
--- a/chrome/common/extensions/api/commands/commands_handler.cc
+++ b/chrome/common/extensions/api/commands/commands_handler.cc
@@ -11,6 +11,8 @@
#include "chrome/common/extensions/manifest.h"
#include "extensions/common/error_utils.h"
+namespace keys = extension_manifest_keys;
+
namespace extensions {
namespace {
@@ -29,28 +31,28 @@ CommandsInfo::~CommandsInfo() {
const Command* CommandsInfo::GetBrowserActionCommand(
const Extension* extension) {
CommandsInfo* info = static_cast<CommandsInfo*>(
- extension->GetManifestData(extension_manifest_keys::kCommands));
+ extension->GetManifestData(keys::kCommands));
return info ? info->browser_action_command.get() : NULL;
}
// static
const Command* CommandsInfo::GetPageActionCommand(const Extension* extension) {
CommandsInfo* info = static_cast<CommandsInfo*>(
- extension->GetManifestData(extension_manifest_keys::kCommands));
+ extension->GetManifestData(keys::kCommands));
return info ? info->page_action_command.get() : NULL;
}
// static
const Command* CommandsInfo::GetScriptBadgeCommand(const Extension* extension) {
CommandsInfo* info = static_cast<CommandsInfo*>(
- extension->GetManifestData(extension_manifest_keys::kCommands));
+ extension->GetManifestData(keys::kCommands));
return info ? info->script_badge_command.get() : NULL;
}
// static
const CommandMap* CommandsInfo::GetNamedCommands(const Extension* extension) {
CommandsInfo* info = static_cast<CommandsInfo*>(
- extension->GetManifestData(extension_manifest_keys::kCommands));
+ extension->GetManifestData(keys::kCommands));
return info ? &info->named_commands : NULL;
}
@@ -60,11 +62,17 @@ CommandsHandler::CommandsHandler() {
CommandsHandler::~CommandsHandler() {
}
-bool CommandsHandler::Parse(const base::Value* value,
- Extension* extension,
- string16* error) {
+bool CommandsHandler::Parse(Extension* extension, string16* error) {
+ if (!extension->manifest()->HasKey(keys::kCommands)) {
+ scoped_ptr<CommandsInfo> commands_info(new CommandsInfo);
+ MaybeSetBrowserActionDefault(extension, commands_info.get());
+ extension->SetManifestData(keys::kCommands,
+ commands_info.release());
+ return true;
+ }
+
const base::DictionaryValue* dict = NULL;
- if (!value->GetAsDictionary(&dict)) {
+ if (!extension->manifest()->GetDictionary(keys::kCommands, &dict)) {
*error = ASCIIToUTF16(extension_manifest_errors::kInvalidCommandsKey);
return false;
}
@@ -112,23 +120,20 @@ bool CommandsHandler::Parse(const base::Value* value,
MaybeSetBrowserActionDefault(extension, commands_info.get());
- extension->SetManifestData(extension_manifest_keys::kCommands,
+ extension->SetManifestData(keys::kCommands,
commands_info.release());
return true;
}
-bool CommandsHandler::HasNoKey(Extension* extension,
- string16* error) {
- scoped_ptr<CommandsInfo> commands_info(new CommandsInfo);
- MaybeSetBrowserActionDefault(extension, commands_info.get());
- extension->SetManifestData(extension_manifest_keys::kCommands,
- commands_info.release());
- return true;
+bool CommandsHandler::AlwaysParseForType(Extension::Type type) {
+ return type == Extension::TYPE_EXTENSION ||
+ type == Extension::TYPE_LEGACY_PACKAGED_APP ||
+ type == Extension::TYPE_PLATFORM_APP;
}
void CommandsHandler::MaybeSetBrowserActionDefault(const Extension* extension,
CommandsInfo* info) {
- if (extension->manifest()->HasKey(extension_manifest_keys::kBrowserAction) &&
+ if (extension->manifest()->HasKey(keys::kBrowserAction) &&
!info->browser_action_command.get()) {
info->browser_action_command.reset(new Command(
extension_manifest_values::kBrowserActionCommandEvent, string16(), ""));
diff --git a/chrome/common/extensions/api/commands/commands_handler.h b/chrome/common/extensions/api/commands/commands_handler.h
index a426a0f..6e4d7cc 100644
--- a/chrome/common/extensions/api/commands/commands_handler.h
+++ b/chrome/common/extensions/api/commands/commands_handler.h
@@ -39,11 +39,8 @@ class CommandsHandler : public ManifestHandler {
CommandsHandler();
virtual ~CommandsHandler();
- virtual bool Parse(const base::Value* value,
- Extension* extension,
- string16* error) OVERRIDE;
-
- virtual bool HasNoKey(Extension* extension, string16* error) OVERRIDE;
+ virtual bool Parse(Extension* extension, string16* error) OVERRIDE;
+ virtual bool AlwaysParseForType(Extension::Type type) OVERRIDE;
private:
// If the extension defines a browser action, but no command for it, then
diff --git a/chrome/common/extensions/api/extension_action/browser_action_handler.cc b/chrome/common/extensions/api/extension_action/browser_action_handler.cc
index 45ec188..b5ab1db 100644
--- a/chrome/common/extensions/api/extension_action/browser_action_handler.cc
+++ b/chrome/common/extensions/api/extension_action/browser_action_handler.cc
@@ -11,6 +11,7 @@
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/extension_manifest_constants.h"
#include "chrome/common/extensions/feature_switch.h"
+#include "chrome/common/extensions/manifest.h"
#include "chrome/common/extensions/manifest_handler_helpers.h"
namespace extensions {
@@ -21,11 +22,11 @@ BrowserActionHandler::BrowserActionHandler() {
BrowserActionHandler::~BrowserActionHandler() {
}
-bool BrowserActionHandler::Parse(const base::Value* value,
- Extension* extension,
+bool BrowserActionHandler::Parse(Extension* extension,
string16* error) {
const DictionaryValue* dict = NULL;
- if (!value->GetAsDictionary(&dict)) {
+ if (!extension->manifest()->GetDictionary(
+ extension_manifest_keys::kBrowserAction, &dict)) {
*error = ASCIIToUTF16(extension_manifest_errors::kInvalidBrowserAction);
return false;
}
diff --git a/chrome/common/extensions/api/extension_action/browser_action_handler.h b/chrome/common/extensions/api/extension_action/browser_action_handler.h
index e979445..e204a22 100644
--- a/chrome/common/extensions/api/extension_action/browser_action_handler.h
+++ b/chrome/common/extensions/api/extension_action/browser_action_handler.h
@@ -19,9 +19,7 @@ class BrowserActionHandler : public ManifestHandler {
BrowserActionHandler();
virtual ~BrowserActionHandler();
- virtual bool Parse(const base::Value* value,
- Extension* extension,
- string16* error) OVERRIDE;
+ virtual bool Parse(Extension* extension, string16* error) OVERRIDE;
};
} // namespace extensions
diff --git a/chrome/common/extensions/api/extension_action/script_badge_handler.cc b/chrome/common/extensions/api/extension_action/script_badge_handler.cc
index f68d4a8..17f1c10 100644
--- a/chrome/common/extensions/api/extension_action/script_badge_handler.cc
+++ b/chrome/common/extensions/api/extension_action/script_badge_handler.cc
@@ -11,6 +11,7 @@
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/extension_manifest_constants.h"
#include "chrome/common/extensions/feature_switch.h"
+#include "chrome/common/extensions/manifest.h"
#include "chrome/common/extensions/manifest_handler_helpers.h"
namespace errors = extension_manifest_errors;
@@ -23,11 +24,16 @@ ScriptBadgeHandler::ScriptBadgeHandler() {
ScriptBadgeHandler::~ScriptBadgeHandler() {
}
-bool ScriptBadgeHandler::Parse(const base::Value* value,
- Extension* extension,
- string16* error) {
+bool ScriptBadgeHandler::Parse(Extension* extension, string16* error) {
scoped_ptr<ActionInfo> action_info(new ActionInfo);
+ // Provide a default script badge if one isn't declared in the manifest.
+ if (!extension->manifest()->HasKey(extension_manifest_keys::kScriptBadge)) {
+ SetActionInfoDefaults(extension, action_info.get());
+ ActionInfo::SetScriptBadgeInfo(extension, action_info.release());
+ return true;
+ }
+
// So as to not confuse developers if they specify a script badge section
// in the manifest, show a warning if the script badge declaration isn't
// going to have any effect.
@@ -38,8 +44,9 @@ bool ScriptBadgeHandler::Parse(const base::Value* value,
}
const DictionaryValue* dict = NULL;
- if (!value->GetAsDictionary(&dict)) {
- *error = ASCIIToUTF16(extension_manifest_errors::kInvalidScriptBadge);
+ if (!extension->manifest()->GetDictionary(
+ extension_manifest_keys::kScriptBadge, &dict)) {
+ *error = ASCIIToUTF16(errors::kInvalidScriptBadge);
return false;
}
@@ -72,11 +79,8 @@ bool ScriptBadgeHandler::Parse(const base::Value* value,
return true;
}
-bool ScriptBadgeHandler::HasNoKey(Extension* extension, string16* error) {
- scoped_ptr<ActionInfo> action_info(new ActionInfo);
- SetActionInfoDefaults(extension, action_info.get());
- ActionInfo::SetScriptBadgeInfo(extension, action_info.release());
- return true;
+bool ScriptBadgeHandler::AlwaysParseForType(Extension::Type type) {
+ return type == Extension::TYPE_EXTENSION;
}
void ScriptBadgeHandler::SetActionInfoDefaults(const Extension* extension,
diff --git a/chrome/common/extensions/api/extension_action/script_badge_handler.h b/chrome/common/extensions/api/extension_action/script_badge_handler.h
index 2691d62..90faf9a 100644
--- a/chrome/common/extensions/api/extension_action/script_badge_handler.h
+++ b/chrome/common/extensions/api/extension_action/script_badge_handler.h
@@ -19,11 +19,9 @@ class ScriptBadgeHandler : public ManifestHandler {
ScriptBadgeHandler();
virtual ~ScriptBadgeHandler();
- virtual bool Parse(const base::Value* value,
- Extension* extension,
- string16* error) OVERRIDE;
+ virtual bool Parse(Extension* extension, string16* error) OVERRIDE;
+ virtual bool AlwaysParseForType(Extension::Type type) OVERRIDE;
- virtual bool HasNoKey(Extension* extension, string16* error) OVERRIDE;
private:
// Sets the fields of ActionInfo to the default values, matching the parent
// extension's title and icons. Performed whether or not the script_badge key
diff --git a/chrome/common/extensions/api/extension_action/script_badge_manifest_unittest.cc b/chrome/common/extensions/api/extension_action/script_badge_manifest_unittest.cc
index 98b5f17..2133579 100644
--- a/chrome/common/extensions/api/extension_action/script_badge_manifest_unittest.cc
+++ b/chrome/common/extensions/api/extension_action/script_badge_manifest_unittest.cc
@@ -8,6 +8,7 @@
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/extension_icon_set.h"
#include "chrome/common/extensions/extension_manifest_constants.h"
+#include "chrome/common/extensions/feature_switch.h"
#include "chrome/common/extensions/manifest_handler.h"
#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h"
#include "testing/gmock/include/gmock/gmock.h"
diff --git a/chrome/common/extensions/api/file_handlers/file_handlers_parser.cc b/chrome/common/extensions/api/file_handlers/file_handlers_parser.cc
index f7240f9..84a2bbb 100644
--- a/chrome/common/extensions/api/file_handlers/file_handlers_parser.cc
+++ b/chrome/common/extensions/api/file_handlers/file_handlers_parser.cc
@@ -9,6 +9,7 @@
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/common/extensions/extension_manifest_constants.h"
+#include "chrome/common/extensions/manifest.h"
#include "extensions/common/error_utils.h"
namespace extensions {
@@ -74,12 +75,11 @@ bool LoadFileHandler(const std::string& handler_id,
return true;
}
-bool FileHandlersParser::Parse(const base::Value* value,
- Extension* extension,
- string16* error) {
+bool FileHandlersParser::Parse(Extension* extension, string16* error) {
scoped_ptr<FileHandlers> info(new FileHandlers);
const DictionaryValue* all_handlers = NULL;
- if (!value->GetAsDictionary(&all_handlers)) {
+ if (!extension->manifest()->GetDictionary(
+ extension_manifest_keys::kFileHandlers, &all_handlers)) {
*error = ASCIIToUTF16(extension_manifest_errors::kInvalidFileHandlers);
return false;
}
diff --git a/chrome/common/extensions/api/file_handlers/file_handlers_parser.h b/chrome/common/extensions/api/file_handlers/file_handlers_parser.h
index 220b8d2..00a69c2 100644
--- a/chrome/common/extensions/api/file_handlers/file_handlers_parser.h
+++ b/chrome/common/extensions/api/file_handlers/file_handlers_parser.h
@@ -44,9 +44,7 @@ class FileHandlersParser : public ManifestHandler {
FileHandlersParser();
virtual ~FileHandlersParser();
- virtual bool Parse(const base::Value* value,
- Extension* extension,
- string16* error) OVERRIDE;
+ virtual bool Parse(Extension* extension, string16* error) OVERRIDE;
};
} // namespace extensions
diff --git a/chrome/common/extensions/api/input_ime/input_components_handler.cc b/chrome/common/extensions/api/input_ime/input_components_handler.cc
index ce48bef..216ab07 100644
--- a/chrome/common/extensions/api/input_ime/input_components_handler.cc
+++ b/chrome/common/extensions/api/input_ime/input_components_handler.cc
@@ -11,8 +11,12 @@
#include "base/values.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_manifest_constants.h"
+#include "chrome/common/extensions/manifest.h"
#include "extensions/common/error_utils.h"
+namespace keys = extension_manifest_keys;
+namespace errors = extension_manifest_errors;
+
namespace extensions {
InputComponentInfo::InputComponentInfo()
@@ -31,7 +35,7 @@ InputComponents::~InputComponents() {}
const std::vector<InputComponentInfo>* InputComponents::GetInputComponents(
const Extension* extension) {
InputComponents* info = static_cast<InputComponents*>(
- extension->GetManifestData(extension_manifest_keys::kInputComponents));
+ extension->GetManifestData(keys::kInputComponents));
return info ? &info->input_components : NULL;
}
@@ -41,13 +45,12 @@ InputComponentsHandler::InputComponentsHandler() {
InputComponentsHandler::~InputComponentsHandler() {
}
-bool InputComponentsHandler::Parse(const base::Value* value,
- Extension* extension,
+bool InputComponentsHandler::Parse(Extension* extension,
string16* error) {
scoped_ptr<InputComponents> info(new InputComponents);
const ListValue* list_value = NULL;
- if (!value->GetAsList(&list_value)) {
- *error = ASCIIToUTF16(extension_manifest_errors::kInvalidInputComponents);
+ if (!extension->manifest()->GetList(keys::kInputComponents, &list_value)) {
+ *error = ASCIIToUTF16(errors::kInvalidInputComponents);
return false;
}
for (size_t i = 0; i < list_value->GetSize(); ++i) {
@@ -64,61 +67,59 @@ bool InputComponentsHandler::Parse(const base::Value* value,
bool shortcut_shift = false;
if (!list_value->GetDictionary(i, &module_value)) {
- *error = ASCIIToUTF16(extension_manifest_errors::kInvalidInputComponents);
+ *error = ASCIIToUTF16(errors::kInvalidInputComponents);
return false;
}
// Get input_components[i].name.
- if (!module_value->GetString(extension_manifest_keys::kName, &name_str)) {
+ if (!module_value->GetString(keys::kName, &name_str)) {
*error = ErrorUtils::FormatErrorMessageUTF16(
- extension_manifest_errors::kInvalidInputComponentName,
+ errors::kInvalidInputComponentName,
base::IntToString(i));
return false;
}
// Get input_components[i].type.
std::string type_str;
- if (module_value->GetString(extension_manifest_keys::kType, &type_str)) {
+ if (module_value->GetString(keys::kType, &type_str)) {
if (type_str == "ime") {
type = INPUT_COMPONENT_TYPE_IME;
} else {
*error = ErrorUtils::FormatErrorMessageUTF16(
- extension_manifest_errors::kInvalidInputComponentType,
+ errors::kInvalidInputComponentType,
base::IntToString(i));
return false;
}
} else {
*error = ErrorUtils::FormatErrorMessageUTF16(
- extension_manifest_errors::kInvalidInputComponentType,
+ errors::kInvalidInputComponentType,
base::IntToString(i));
return false;
}
// Get input_components[i].id.
- if (!module_value->GetString(extension_manifest_keys::kId, &id_str)) {
+ if (!module_value->GetString(keys::kId, &id_str)) {
id_str = "";
}
// Get input_components[i].description.
- if (!module_value->GetString(extension_manifest_keys::kDescription,
- &description_str)) {
+ if (!module_value->GetString(keys::kDescription, &description_str)) {
*error = ErrorUtils::FormatErrorMessageUTF16(
- extension_manifest_errors::kInvalidInputComponentDescription,
+ errors::kInvalidInputComponentDescription,
base::IntToString(i));
return false;
}
+
// Get input_components[i].language.
- if (!module_value->GetString(extension_manifest_keys::kLanguage,
- &language_str)) {
+ if (!module_value->GetString(keys::kLanguage, &language_str)) {
language_str = "";
}
// Get input_components[i].layouts.
const ListValue* layouts_value = NULL;
- if (!module_value->GetList(extension_manifest_keys::kLayouts,
- &layouts_value)) {
+ if (!module_value->GetList(keys::kLayouts, &layouts_value)) {
*error = ASCIIToUTF16(
- extension_manifest_errors::kInvalidInputComponentLayouts);
+ errors::kInvalidInputComponentLayouts);
return false;
}
@@ -126,47 +127,43 @@ bool InputComponentsHandler::Parse(const base::Value* value,
std::string layout_name_str;
if (!layouts_value->GetString(j, &layout_name_str)) {
*error = ErrorUtils::FormatErrorMessageUTF16(
- extension_manifest_errors::kInvalidInputComponentLayoutName,
+ errors::kInvalidInputComponentLayoutName,
base::IntToString(i), base::IntToString(j));
return false;
}
layouts.insert(layout_name_str);
}
- if (module_value->HasKey(extension_manifest_keys::kShortcutKey)) {
+ if (module_value->HasKey(keys::kShortcutKey)) {
const DictionaryValue* shortcut_value = NULL;
- if (!module_value->GetDictionary(extension_manifest_keys::kShortcutKey,
+ if (!module_value->GetDictionary(keys::kShortcutKey,
&shortcut_value)) {
*error = ErrorUtils::FormatErrorMessageUTF16(
- extension_manifest_errors::kInvalidInputComponentShortcutKey,
+ errors::kInvalidInputComponentShortcutKey,
base::IntToString(i));
return false;
}
// Get input_components[i].shortcut_keycode.
- if (!shortcut_value->GetString(extension_manifest_keys::kKeycode,
- &shortcut_keycode_str)) {
+ if (!shortcut_value->GetString(keys::kKeycode, &shortcut_keycode_str)) {
*error = ErrorUtils::FormatErrorMessageUTF16(
- extension_manifest_errors::kInvalidInputComponentShortcutKeycode,
+ errors::kInvalidInputComponentShortcutKeycode,
base::IntToString(i));
return false;
}
// Get input_components[i].shortcut_alt.
- if (!shortcut_value->GetBoolean(extension_manifest_keys::kAltKey,
- &shortcut_alt)) {
+ if (!shortcut_value->GetBoolean(keys::kAltKey, &shortcut_alt)) {
shortcut_alt = false;
}
// Get input_components[i].shortcut_ctrl.
- if (!shortcut_value->GetBoolean(extension_manifest_keys::kCtrlKey,
- &shortcut_ctrl)) {
+ if (!shortcut_value->GetBoolean(keys::kCtrlKey, &shortcut_ctrl)) {
shortcut_ctrl = false;
}
// Get input_components[i].shortcut_shift.
- if (!shortcut_value->GetBoolean(extension_manifest_keys::kShiftKey,
- &shortcut_shift)) {
+ if (!shortcut_value->GetBoolean(keys::kShiftKey, &shortcut_shift)) {
shortcut_shift = false;
}
}
@@ -184,8 +181,7 @@ bool InputComponentsHandler::Parse(const base::Value* value,
info->input_components.back().shortcut_ctrl = shortcut_ctrl;
info->input_components.back().shortcut_shift = shortcut_shift;
}
- extension->SetManifestData(extension_manifest_keys::kInputComponents,
- info.release());
+ extension->SetManifestData(keys::kInputComponents, info.release());
return true;
}
diff --git a/chrome/common/extensions/api/input_ime/input_components_handler.h b/chrome/common/extensions/api/input_ime/input_components_handler.h
index 9ad18c1..c1620a3 100644
--- a/chrome/common/extensions/api/input_ime/input_components_handler.h
+++ b/chrome/common/extensions/api/input_ime/input_components_handler.h
@@ -57,9 +57,7 @@ class InputComponentsHandler : public ManifestHandler {
InputComponentsHandler();
virtual ~InputComponentsHandler();
- virtual bool Parse(const base::Value* value,
- Extension* extension,
- string16* error) OVERRIDE;
+ virtual bool Parse(Extension* extension, string16* error) OVERRIDE;
};
} // namespace extensions
diff --git a/chrome/common/extensions/api/omnibox/omnibox_handler.cc b/chrome/common/extensions/api/omnibox/omnibox_handler.cc
index 287021dd..32c4069 100644
--- a/chrome/common/extensions/api/omnibox/omnibox_handler.cc
+++ b/chrome/common/extensions/api/omnibox/omnibox_handler.cc
@@ -12,6 +12,7 @@
#include "chrome/common/extensions/api/extension_action/action_info.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_manifest_constants.h"
+#include "chrome/common/extensions/manifest.h"
namespace extensions {
@@ -44,12 +45,11 @@ OmniboxHandler::OmniboxHandler() {
OmniboxHandler::~OmniboxHandler() {
}
-bool OmniboxHandler::Parse(const base::Value* value,
- Extension* extension,
- string16* error) {
+bool OmniboxHandler::Parse(Extension* extension, string16* error) {
scoped_ptr<OmniboxInfo> info(new OmniboxInfo);
const DictionaryValue* dict = NULL;
- if (!value->GetAsDictionary(&dict) ||
+ if (!extension->manifest()->GetDictionary(extension_manifest_keys::kOmnibox,
+ &dict) ||
!dict->GetString(kKeyword, &info->keyword) ||
info->keyword.empty()) {
*error = ASCIIToUTF16(extension_manifest_errors::kInvalidOmniboxKeyword);
diff --git a/chrome/common/extensions/api/omnibox/omnibox_handler.h b/chrome/common/extensions/api/omnibox/omnibox_handler.h
index d3efed0..0a0e546 100644
--- a/chrome/common/extensions/api/omnibox/omnibox_handler.h
+++ b/chrome/common/extensions/api/omnibox/omnibox_handler.h
@@ -33,9 +33,7 @@ class OmniboxHandler : public ManifestHandler {
OmniboxHandler();
virtual ~OmniboxHandler();
- virtual bool Parse(const base::Value* value,
- Extension* extension,
- string16* error) OVERRIDE;
+ virtual bool Parse(Extension* extension, string16* error) OVERRIDE;
};
} // namespace extensions
diff --git a/chrome/common/extensions/api/speech/tts_engine_manifest_handler.cc b/chrome/common/extensions/api/speech/tts_engine_manifest_handler.cc
index ac0bd6d..afd88bb 100644
--- a/chrome/common/extensions/api/speech/tts_engine_manifest_handler.cc
+++ b/chrome/common/extensions/api/speech/tts_engine_manifest_handler.cc
@@ -9,6 +9,7 @@
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/common/extensions/extension_manifest_constants.h"
+#include "chrome/common/extensions/manifest.h"
#include "extensions/common/error_utils.h"
#include "ui/base/l10n/l10n_util.h"
@@ -45,11 +46,10 @@ TtsEngineManifestHandler::TtsEngineManifestHandler() {
TtsEngineManifestHandler::~TtsEngineManifestHandler() {
}
-bool TtsEngineManifestHandler::Parse(const base::Value* value,
- Extension* extension, string16* error) {
+bool TtsEngineManifestHandler::Parse(Extension* extension, string16* error) {
scoped_ptr<TtsVoices> info(new TtsVoices);
const DictionaryValue* tts_dict = NULL;
- if (!value->GetAsDictionary(&tts_dict)) {
+ if (!extension->manifest()->GetDictionary(keys::kTtsEngine, &tts_dict)) {
*error = ASCIIToUTF16(errors::kInvalidTts);
return false;
}
diff --git a/chrome/common/extensions/api/speech/tts_engine_manifest_handler.h b/chrome/common/extensions/api/speech/tts_engine_manifest_handler.h
index c777336..9c24b53 100644
--- a/chrome/common/extensions/api/speech/tts_engine_manifest_handler.h
+++ b/chrome/common/extensions/api/speech/tts_engine_manifest_handler.h
@@ -32,8 +32,7 @@ class TtsEngineManifestHandler : public ManifestHandler {
TtsEngineManifestHandler();
virtual ~TtsEngineManifestHandler();
- virtual bool Parse(const base::Value* value, Extension* extension,
- string16* error) OVERRIDE;
+ virtual bool Parse(Extension* extension, string16* error) OVERRIDE;
};
} // namespace extensions
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index ab66dc9..97f67a9 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -1922,6 +1922,7 @@ bool Extension::LoadSharedFeatures(
string16* error) {
if (!LoadDescription(error) ||
!LoadIcons(error) ||
+ !ManifestHandler::ParseExtension(this, error) ||
!LoadPlugins(error) ||
!LoadNaClModules(error) ||
!LoadSandboxedPages(error) ||
@@ -2379,8 +2380,7 @@ bool Extension::LoadExtensionFeatures(APIPermissionSet* api_permissions,
manifest_->GetBoolean(keys::kConvertedFromUserScript,
&converted_from_user_script_);
- if (!LoadManifestHandlerFeatures(error) ||
- !LoadContentScripts(error) ||
+ if (!LoadContentScripts(error) ||
!LoadPageAction(error) ||
!LoadSystemIndicator(api_permissions, error) ||
!LoadIncognitoMode(error) ||
@@ -2390,20 +2390,6 @@ bool Extension::LoadExtensionFeatures(APIPermissionSet* api_permissions,
return true;
}
-bool Extension::LoadManifestHandlerFeatures(string16* error) {
- std::vector<std::string> keys = ManifestHandler::GetKeys();
- for (size_t i = 0; i < keys.size(); ++i) {
- Value* value = NULL;
- if (!manifest_->Get(keys[i], &value)) {
- if (!ManifestHandler::Get(keys[i])->HasNoKey(this, error))
- return false;
- } else if (!ManifestHandler::Get(keys[i])->Parse(value, this, error)) {
- return false;
- }
- }
- return true;
-}
-
bool Extension::LoadContentScripts(string16* error) {
if (!manifest_->HasKey(keys::kContentScripts))
return true;
diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h
index 45f943b..4c9986b 100644
--- a/chrome/common/extensions/extension.h
+++ b/chrome/common/extensions/extension.h
@@ -802,7 +802,6 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
string16* error);
bool LoadExtensionFeatures(APIPermissionSet* api_permissions,
string16* error);
- bool LoadManifestHandlerFeatures(string16* error);
bool LoadContentScripts(string16* error);
bool LoadPageAction(string16* error);
bool LoadBrowserAction(string16* error);
diff --git a/chrome/common/extensions/manifest.cc b/chrome/common/extensions/manifest.cc
index cb4e1b0..f17f4c6 100644
--- a/chrome/common/extensions/manifest.cc
+++ b/chrome/common/extensions/manifest.cc
@@ -124,11 +124,21 @@ bool Manifest::GetString(
}
bool Manifest::GetDictionary(
+ const std::string& path, const DictionaryValue** out_value) const {
+ return GetDictionary(path, const_cast<DictionaryValue**>(out_value));
+}
+
+bool Manifest::GetDictionary(
const std::string& path, DictionaryValue** out_value) const {
return CanAccessPath(path) && value_->GetDictionary(path, out_value);
}
bool Manifest::GetList(
+ const std::string& path, const ListValue** out_value) const {
+ return GetList(path, const_cast<ListValue**>(out_value));
+}
+
+bool Manifest::GetList(
const std::string& path, ListValue** out_value) const {
return CanAccessPath(path) && value_->GetList(path, out_value);
}
diff --git a/chrome/common/extensions/manifest.h b/chrome/common/extensions/manifest.h
index 6c8d612..7472c29 100644
--- a/chrome/common/extensions/manifest.h
+++ b/chrome/common/extensions/manifest.h
@@ -61,7 +61,11 @@ class Manifest {
bool GetString(const std::string& path, std::string* out_value) const;
bool GetString(const std::string& path, string16* out_value) const;
bool GetDictionary(const std::string& path,
+ const base::DictionaryValue** out_value) const;
+ bool GetDictionary(const std::string& path,
base::DictionaryValue** out_value) const;
+ bool GetList(const std::string& path,
+ const base::ListValue** out_value) const;
bool GetList(const std::string& path, base::ListValue** out_value) const;
// Returns a new Manifest equal to this one, passing ownership to
diff --git a/chrome/common/extensions/manifest_handler.cc b/chrome/common/extensions/manifest_handler.cc
index a88b475..9d2a9b5 100644
--- a/chrome/common/extensions/manifest_handler.cc
+++ b/chrome/common/extensions/manifest_handler.cc
@@ -8,6 +8,7 @@
#include "base/lazy_instance.h"
#include "base/memory/linked_ptr.h"
+#include "chrome/common/extensions/manifest.h"
namespace extensions {
@@ -17,8 +18,7 @@ class ManifestHandlerRegistry {
public:
void RegisterManifestHandler(const std::string& key,
ManifestHandler* handler);
- ManifestHandler* GetManifestHandler(const std::string& key);
- std::vector<std::string> GetManifestHandlerKeys();
+ bool ParseExtension(Extension* extension, string16* error);
private:
friend struct base::DefaultLazyInstanceTraits<ManifestHandlerRegistry>;
@@ -33,25 +33,26 @@ void ManifestHandlerRegistry::RegisterManifestHandler(
handlers_[key] = make_linked_ptr(handler);
}
-ManifestHandler* ManifestHandlerRegistry::GetManifestHandler(
- const std::string& key) {
- ManifestHandlerMap::iterator iter = handlers_.find(key);
- if (iter != handlers_.end())
- return iter->second.get();
- // TODO(yoz): The NOTREACHED only makes sense as long as
- // GetManifestHandlerKeys is how we're getting the available
- // manifest handlers.
- NOTREACHED();
- return NULL;
-}
-
-std::vector<std::string> ManifestHandlerRegistry::GetManifestHandlerKeys() {
- std::vector<std::string> keys;
+bool ManifestHandlerRegistry::ParseExtension(Extension* extension,
+ string16* error) {
+ std::set<ManifestHandler*> handler_set;
for (ManifestHandlerMap::iterator iter = handlers_.begin();
iter != handlers_.end(); ++iter) {
- keys.push_back(iter->first);
+ ManifestHandler* handler = iter->second.get();
+ if (extension->manifest()->HasPath(iter->first) ||
+ handler->AlwaysParseForType(extension->GetType()))
+ handler_set.insert(iter->second.get());
}
- return keys;
+
+ // TODO(yoz): Some handlers may depend on other handlers having already
+ // parsed their keys. Reorder the handlers so that handlers needed earlier
+ // come first in the returned container.
+ for (std::set<ManifestHandler*>::iterator iter = handler_set.begin();
+ iter != handler_set.end(); ++iter) {
+ if (!(*iter)->Parse(extension, error))
+ return false;
+ }
+ return true;
}
static base::LazyInstance<ManifestHandlerRegistry> g_registry =
@@ -65,8 +66,8 @@ ManifestHandler::ManifestHandler() {
ManifestHandler::~ManifestHandler() {
}
-bool ManifestHandler::HasNoKey(Extension* extension, string16* error) {
- return true;
+bool ManifestHandler::AlwaysParseForType(Extension::Type type) {
+ return false;
}
// static
@@ -76,13 +77,8 @@ void ManifestHandler::Register(const std::string& key,
}
// static
-ManifestHandler* ManifestHandler::Get(const std::string& key) {
- return g_registry.Get().GetManifestHandler(key);
-}
-
-// static
-std::vector<std::string> ManifestHandler::GetKeys() {
- return g_registry.Get().GetManifestHandlerKeys();
+bool ManifestHandler::ParseExtension(Extension* extension, string16* error) {
+ return g_registry.Get().ParseExtension(extension, error);
}
} // namespace extensions
diff --git a/chrome/common/extensions/manifest_handler.h b/chrome/common/extensions/manifest_handler.h
index f9797d3..ecd5c9d 100644
--- a/chrome/common/extensions/manifest_handler.h
+++ b/chrome/common/extensions/manifest_handler.h
@@ -5,54 +5,47 @@
#ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLER_H_
#define CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLER_H_
+#include <set>
#include <string>
-#include <vector>
#include "base/string16.h"
-
-namespace base {
-class Value;
-}
+#include "chrome/common/extensions/extension.h"
namespace extensions {
-class Extension;
+class Manifest;
class ManifestHandler {
public:
ManifestHandler();
virtual ~ManifestHandler();
- // Attempts to parse the manifest value.
- // Returns true on success or false on failure; if false, |error| will
- // be set to a failure message.
- virtual bool Parse(const base::Value* value,
- Extension* extension,
- string16* error) = 0;
-
- // Perform any initialization which is necessary when the Handler's key is
- // not present in the manifest.
+ // Attempts to parse the extension's manifest.
// Returns true on success or false on failure; if false, |error| will
// be set to a failure message.
- virtual bool HasNoKey(Extension* extension, string16* error);
-
- // Associate |handler| with |key| in the manifest. Takes ownership
- // of |handler|. TODO(yoz): Decide how to handle dotted subkeys.
+ virtual bool Parse(Extension* extension, string16* error) = 0;
+
+ // If false (the default), only parse the manifest if a registered
+ // key is present in the manifest. If true, always attempt to parse
+ // the manifest for this extension type, even if no registered keys
+ // are present. This allows specifying a default parsed value for
+ // extensions that don't declare our key in the manifest.
+ // TODO(yoz): Use Feature availability instead.
+ virtual bool AlwaysParseForType(Extension::Type type);
+
+ // Associate |handler| with |key| in the manifest. A handler can register
+ // for multiple keys. The global registry takes ownership of |handler|;
+ // if it has an existing handler for |key|, it replaces it with this one.
+ //
// WARNING: Manifest handlers registered only in the browser process
- // are not available to renderers.
+ // are not available to renderers or utility processes.
static void Register(const std::string& key, ManifestHandler* handler);
- // Get the manifest handler associated with |key|, or NULL
- // if there is none.
- static ManifestHandler* Get(const std::string& key);
-
- // If the handler is not handling most of the keys, it may be
- // more efficient to have a list of keys to iterate over.
- // TODO(yoz): this isn't the long-term solution.
- static std::vector<std::string> GetKeys();
+ // Call Parse on all registered manifest handlers that should parse
+ // this extension.
+ static bool ParseExtension(Extension* extension, string16* error);
};
-
} // namespace extensions
#endif // CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLER_H_
diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_web_accessible_resources_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_web_accessible_resources_unittest.cc
index 282cabe..438c9e5 100644
--- a/chrome/common/extensions/manifest_tests/extension_manifests_web_accessible_resources_unittest.cc
+++ b/chrome/common/extensions/manifest_tests/extension_manifests_web_accessible_resources_unittest.cc
@@ -11,7 +11,7 @@
using extensions::Extension;
using extensions::WebAccessibleResourcesInfo;
-class WebAccesibleResourcesManifestTest : public ExtensionManifestTest {
+class WebAccessibleResourcesManifestTest : public ExtensionManifestTest {
virtual void SetUp() OVERRIDE {
ExtensionManifestTest::SetUp();
extensions::ManifestHandler::Register(
@@ -20,7 +20,7 @@ class WebAccesibleResourcesManifestTest : public ExtensionManifestTest {
}
};
-TEST_F(WebAccesibleResourcesManifestTest, WebAccessibleResources) {
+TEST_F(WebAccessibleResourcesManifestTest, WebAccessibleResources) {
// Manifest version 2 with web accessible resources specified.
scoped_refptr<Extension> extension1(
LoadAndExpectSuccess("web_accessible_resources_1.json"));
diff --git a/chrome/common/extensions/manifest_url_handler.cc b/chrome/common/extensions/manifest_url_handler.cc
index c505297..e11c1f6 100644
--- a/chrome/common/extensions/manifest_url_handler.cc
+++ b/chrome/common/extensions/manifest_url_handler.cc
@@ -12,6 +12,7 @@
#include "base/values.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/extensions/extension_manifest_constants.h"
+#include "chrome/common/extensions/manifest.h"
#include "chrome/common/url_constants.h"
#include "extensions/common/error_utils.h"
@@ -90,12 +91,10 @@ DevToolsPageHandler::DevToolsPageHandler() {
DevToolsPageHandler::~DevToolsPageHandler() {
}
-bool DevToolsPageHandler::Parse(const base::Value* value,
- Extension* extension,
- string16* error) {
+bool DevToolsPageHandler::Parse(Extension* extension, string16* error) {
scoped_ptr<ManifestURL> manifest_url(new ManifestURL);
std::string devtools_str;
- if (!value->GetAsString(&devtools_str)) {
+ if (!extension->manifest()->GetString(keys::kDevToolsPage, &devtools_str)) {
*error = ASCIIToUTF16(errors::kInvalidDevToolsPage);
return false;
}
@@ -110,12 +109,11 @@ HomepageURLHandler::HomepageURLHandler() {
HomepageURLHandler::~HomepageURLHandler() {
}
-bool HomepageURLHandler::Parse(const base::Value* value,
- Extension* extension,
- string16* error) {
+bool HomepageURLHandler::Parse(Extension* extension, string16* error) {
scoped_ptr<ManifestURL> manifest_url(new ManifestURL);
std::string homepage_url_str;
- if (!value->GetAsString(&homepage_url_str)) {
+ if (!extension->manifest()->GetString(keys::kHomepageURL,
+ &homepage_url_str)) {
*error = ErrorUtils::FormatErrorMessageUTF16(
errors::kInvalidHomepageURL, "");
return false;
@@ -138,13 +136,11 @@ UpdateURLHandler::UpdateURLHandler() {
UpdateURLHandler::~UpdateURLHandler() {
}
-bool UpdateURLHandler::Parse(const base::Value* value,
- Extension* extension,
- string16* error) {
+bool UpdateURLHandler::Parse(Extension* extension, string16* error) {
scoped_ptr<ManifestURL> manifest_url(new ManifestURL);
std::string tmp_update_url;
- if (!value->GetAsString(&tmp_update_url)) {
+ if (!extension->manifest()->GetString(keys::kUpdateURL, &tmp_update_url)) {
*error = ErrorUtils::FormatErrorMessageUTF16(
errors::kInvalidUpdateURL, "");
return false;
@@ -168,12 +164,10 @@ OptionsPageHandler::OptionsPageHandler() {
OptionsPageHandler::~OptionsPageHandler() {
}
-bool OptionsPageHandler::Parse(const base::Value* value,
- Extension* extension,
- string16* error) {
+bool OptionsPageHandler::Parse(Extension* extension, string16* error) {
scoped_ptr<ManifestURL> manifest_url(new ManifestURL);
std::string options_str;
- if (!value->GetAsString(&options_str)) {
+ if (!extension->manifest()->GetString(keys::kOptionsPage, &options_str)) {
*error = ASCIIToUTF16(errors::kInvalidOptionsPage);
return false;
}
@@ -210,11 +204,10 @@ URLOverridesHandler::URLOverridesHandler() {
URLOverridesHandler::~URLOverridesHandler() {
}
-bool URLOverridesHandler::Parse(const base::Value* value,
- Extension* extension,
- string16* error) {
+bool URLOverridesHandler::Parse(Extension* extension, string16* error) {
const DictionaryValue* overrides = NULL;
- if (!value->GetAsDictionary(&overrides)) {
+ if (!extension->manifest()->GetDictionary(keys::kChromeURLOverrides,
+ &overrides)) {
*error = ASCIIToUTF16(errors::kInvalidChromeURLOverrides);
return false;
}
diff --git a/chrome/common/extensions/manifest_url_handler.h b/chrome/common/extensions/manifest_url_handler.h
index 1492dbd..249542b 100644
--- a/chrome/common/extensions/manifest_url_handler.h
+++ b/chrome/common/extensions/manifest_url_handler.h
@@ -59,9 +59,7 @@ class DevToolsPageHandler : public ManifestHandler {
DevToolsPageHandler();
virtual ~DevToolsPageHandler();
- virtual bool Parse(const base::Value* value,
- Extension* extension,
- string16* error) OVERRIDE;
+ virtual bool Parse(Extension* extension, string16* error) OVERRIDE;
};
// Parses the "homepage_url" manifest key.
@@ -70,9 +68,7 @@ class HomepageURLHandler : public ManifestHandler {
HomepageURLHandler();
virtual ~HomepageURLHandler();
- virtual bool Parse(const base::Value* value,
- Extension* extension,
- string16* error) OVERRIDE;
+ virtual bool Parse(Extension* extension, string16* error) OVERRIDE;
};
// Parses the "update_url" manifest key.
@@ -81,9 +77,7 @@ class UpdateURLHandler : public ManifestHandler {
UpdateURLHandler();
virtual ~UpdateURLHandler();
- virtual bool Parse(const base::Value* value,
- Extension* extension,
- string16* error) OVERRIDE;
+ virtual bool Parse(Extension* extension, string16* error) OVERRIDE;
};
// Parses the "options_page" manifest key.
@@ -92,9 +86,7 @@ class OptionsPageHandler : public ManifestHandler {
OptionsPageHandler();
virtual ~OptionsPageHandler();
- virtual bool Parse(const base::Value* value,
- Extension* extension,
- string16* error) OVERRIDE;
+ virtual bool Parse(Extension* extension, string16* error) OVERRIDE;
};
// Parses the "chrome_url_overrides" manifest key.
@@ -103,9 +95,7 @@ class URLOverridesHandler : public ManifestHandler {
URLOverridesHandler();
virtual ~URLOverridesHandler();
- virtual bool Parse(const base::Value* value,
- Extension* extension,
- string16* error) OVERRIDE;
+ virtual bool Parse(Extension* extension, string16* error) OVERRIDE;
};
} // namespace extensions
diff --git a/chrome/common/extensions/web_accessible_resources_handler.cc b/chrome/common/extensions/web_accessible_resources_handler.cc
index 7b135d98..f6e1710 100644
--- a/chrome/common/extensions/web_accessible_resources_handler.cc
+++ b/chrome/common/extensions/web_accessible_resources_handler.cc
@@ -9,6 +9,7 @@
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/common/extensions/extension_manifest_constants.h"
+#include "chrome/common/extensions/manifest.h"
#include "extensions/common/error_utils.h"
namespace extensions {
@@ -60,12 +61,12 @@ WebAccessibleResourcesHandler::WebAccessibleResourcesHandler() {
WebAccessibleResourcesHandler::~WebAccessibleResourcesHandler() {
}
-bool WebAccessibleResourcesHandler::Parse(const base::Value* value,
- Extension* extension,
+bool WebAccessibleResourcesHandler::Parse(Extension* extension,
string16* error) {
scoped_ptr<WebAccessibleResourcesInfo> info(new WebAccessibleResourcesInfo);
const ListValue* list_value = NULL;
- if (!value->GetAsList(&list_value)) {
+ if (!extension->manifest()->GetList(keys::kWebAccessibleResources,
+ &list_value)) {
*error = ASCIIToUTF16(errors::kInvalidWebAccessibleResourcesList);
return false;
}
diff --git a/chrome/common/extensions/web_accessible_resources_handler.h b/chrome/common/extensions/web_accessible_resources_handler.h
index 50c66d4..377ffbc 100644
--- a/chrome/common/extensions/web_accessible_resources_handler.h
+++ b/chrome/common/extensions/web_accessible_resources_handler.h
@@ -37,9 +37,7 @@ class WebAccessibleResourcesHandler : public ManifestHandler {
WebAccessibleResourcesHandler();
virtual ~WebAccessibleResourcesHandler();
- virtual bool Parse(const base::Value* value,
- Extension* extension,
- string16* error) OVERRIDE;
+ virtual bool Parse(Extension* extension, string16* error) OVERRIDE;
};
} // namespace extensions
diff --git a/chrome/common/extensions/web_intents_handler.cc b/chrome/common/extensions/web_intents_handler.cc
index 28d8b95..d264394 100644
--- a/chrome/common/extensions/web_intents_handler.cc
+++ b/chrome/common/extensions/web_intents_handler.cc
@@ -10,6 +10,7 @@
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/common/extensions/extension_manifest_constants.h"
+#include "chrome/common/extensions/manifest.h"
#include "extensions/common/error_utils.h"
#include "webkit/glue/web_intent_service_data.h"
@@ -167,12 +168,10 @@ WebIntentsHandler::WebIntentsHandler() {
WebIntentsHandler::~WebIntentsHandler() {
}
-bool WebIntentsHandler::Parse(const base::Value* value,
- Extension* extension,
- string16* error) {
+bool WebIntentsHandler::Parse(Extension* extension, string16* error) {
scoped_ptr<WebIntentsInfo> info(new WebIntentsInfo);
const DictionaryValue* all_services = NULL;
- if (!value->GetAsDictionary(&all_services)) {
+ if (!extension->manifest()->GetDictionary(keys::kIntents, &all_services)) {
*error = ASCIIToUTF16(errors::kInvalidIntents);
return false;
}
diff --git a/chrome/common/extensions/web_intents_handler.h b/chrome/common/extensions/web_intents_handler.h
index d195b31..9b486fb 100644
--- a/chrome/common/extensions/web_intents_handler.h
+++ b/chrome/common/extensions/web_intents_handler.h
@@ -39,9 +39,7 @@ class WebIntentsHandler : public ManifestHandler {
WebIntentsHandler();
virtual ~WebIntentsHandler();
- virtual bool Parse(const base::Value* value,
- Extension* extension,
- string16* error) OVERRIDE;
+ virtual bool Parse(Extension* extension, string16* error) OVERRIDE;
};
} // namespace extensions