diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-24 04:35:08 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-24 04:35:08 +0000 |
commit | 92c6f9b9eac950c487f580709e3aab03843d15bc (patch) | |
tree | 4f25ceede36cf3655de577a48281910752f67262 /chrome/renderer | |
parent | 20ee7a74a7587986ed5db9b13aac2a78a5f0bdfc (diff) | |
download | chromium_src-92c6f9b9eac950c487f580709e3aab03843d15bc.zip chromium_src-92c6f9b9eac950c487f580709e3aab03843d15bc.tar.gz chromium_src-92c6f9b9eac950c487f580709e3aab03843d15bc.tar.bz2 |
Refactor BrowserActions, and add support for
tab-specific state.
Future changelists will move Page Actions over to
ExtensionAction2, then replace ExtensionAction and
ExtensionActionState with ExtensionAction2.
Also, fix a bug in setIcon({path:...}) where it
would work only the first time.
BUG=24669,24472
Review URL: http://codereview.chromium.org/306044
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29997 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/extensions/extension_process_bindings.cc | 7 | ||||
-rw-r--r-- | chrome/renderer/resources/extension_process_bindings.js | 6 |
2 files changed, 8 insertions, 5 deletions
diff --git a/chrome/renderer/extensions/extension_process_bindings.cc b/chrome/renderer/extensions/extension_process_bindings.cc index a9360eb..428281e 100644 --- a/chrome/renderer/extensions/extension_process_bindings.cc +++ b/chrome/renderer/extensions/extension_process_bindings.cc @@ -416,7 +416,6 @@ class ExtensionImpl : public ExtensionBase { // before sending the request to the browser. static v8::Handle<v8::Value> SetExtensionActionIcon(const v8::Arguments& args) { v8::Local<v8::Object> details = args[1]->ToObject(); - int tab_id = details->Get(v8::String::New("tabId"))->Int32Value(); v8::Local<v8::Object> image_data = details->Get(v8::String::New("imageData"))->ToObject(); v8::Local<v8::Object> data = @@ -453,7 +452,11 @@ class ExtensionImpl : public ExtensionBase { DictionaryValue* dict = new DictionaryValue(); dict->Set(L"imageData", bitmap_value); - dict->SetInteger(L"tabId", tab_id); + + if (details->Has(v8::String::New("tabId"))) { + dict->SetInteger(L"tabId", + details->Get(v8::String::New("tabId"))->Int32Value()); + } return StartRequestCommon(args, dict); } diff --git a/chrome/renderer/resources/extension_process_bindings.js b/chrome/renderer/resources/extension_process_bindings.js index 3974867..fbe96d4 100644 --- a/chrome/renderer/resources/extension_process_bindings.js +++ b/chrome/renderer/resources/extension_process_bindings.js @@ -345,7 +345,7 @@ var chrome = chrome || {}; return GetL10nMessage(message_name, placeholders); } - var canvas_context; + var canvas; function setIconCommon(details, name, parameters) { if ("iconIndex" in details) { sendRequest(name, [details], parameters); @@ -364,13 +364,13 @@ var chrome = chrome || {}; } sendCustomRequest(SetExtensionActionIcon, name, [details], parameters); } else if ("path" in details) { - if (!canvas_context) { + if (!canvas) { var canvas = document.createElement("canvas"); canvas.width = 19; canvas.height = 19; - canvas_context = canvas.getContext('2d'); } + var canvas_context = canvas.getContext('2d'); var img = new Image(); var self = this; img.onerror = function() { |