Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5797)

Unified Diff: chrome/common/extensions/extension.cc

Issue 159202: add mole info to toolstrip definition and enable moles (Closed)
Patch Set: ready for review Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/extension.cc
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index b0324d66e2c900fff3045949fc2f656a795ffc58..c030d459170cac602ea220b191995fb5c9397851 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -749,8 +749,40 @@ bool Extension::InitFromValue(const DictionaryValue& source, bool require_id,
}
for (size_t i = 0; i < list_value->GetSize(); ++i) {
- std::string toolstrip;
- if (!list_value->GetString(i, &toolstrip)) {
+ ToolstripInfo toolstrip;
+ DictionaryValue* toolstrip_value;
+ std::string toolstrip_path;
+ if (list_value->GetString(i, &toolstrip_path)) {
Matt Perry 2009/07/24 23:11:11 is this temporary for back compat, or do you plan
Erik does not do reviews 2009/07/26 00:34:46 It's unclear. I added a comment with a TODO to lo
+ toolstrip.toolstrip = GetResourceURL(toolstrip_path);
+ } else if (list_value->GetDictionary(i, &toolstrip_value)) {
+ if (!toolstrip_value->GetString(keys::kToolstripPath,
+ &toolstrip_path)) {
+ *error = ExtensionErrorUtils::FormatErrorMessage(
+ errors::kInvalidToolstrip, IntToString(i));
+ return false;
+ }
+ toolstrip.toolstrip = GetResourceURL(toolstrip_path);
+ if (toolstrip_value->HasKey(keys::kToolstripMolePath)) {
+ std::string mole_path;
+ if (!toolstrip_value->GetString(keys::kToolstripMolePath,
+ &mole_path)) {
+ *error = ExtensionErrorUtils::FormatErrorMessage(
+ errors::kInvalidToolstrip, IntToString(i));
+ return false;
+ }
+ // TODO(erikkay) is there a better way to get this dynamically
+ // from the content itself?
+ int height;
+ if (!toolstrip_value->GetInteger(keys::kToolstripMoleHeight,
+ &height) || (height < 0)) {
+ *error = ExtensionErrorUtils::FormatErrorMessage(
+ errors::kInvalidToolstrip, IntToString(i));
+ return false;
+ }
+ toolstrip.mole = GetResourceURL(mole_path);
+ toolstrip.mole_height = height;
+ }
+ } else {
*error = ExtensionErrorUtils::FormatErrorMessage(
errors::kInvalidToolstrip, IntToString(i));
return false;

Powered by Google App Engine
This is Rietveld 408576698