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

Side by Side Diff: chrome/renderer/extensions/extension_process_bindings.cc

Issue 264046: Update browser actions api to be like new design doc. (Closed)
Patch Set: rebase Created 11 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <map> 5 #include <map>
6 #include <set> 6 #include <set>
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "chrome/renderer/extensions/extension_process_bindings.h" 10 #include "chrome/renderer/extensions/extension_process_bindings.h"
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 return v8::Undefined(); 404 return v8::Undefined();
405 } 405 }
406 406
407 return StartRequestCommon(args, value_args); 407 return StartRequestCommon(args, value_args);
408 } 408 }
409 409
410 // A special request for setting the browser action icon. This function 410 // A special request for setting the browser action icon. This function
411 // accepts a canvas ImageData object, so it needs to do extra processing 411 // accepts a canvas ImageData object, so it needs to do extra processing
412 // before sending the request to the browser. 412 // before sending the request to the browser.
413 static v8::Handle<v8::Value> SetBrowserActionIcon(const v8::Arguments& args) { 413 static v8::Handle<v8::Value> SetBrowserActionIcon(const v8::Arguments& args) {
414 v8::Local<v8::Object> image_data = args[1]->ToObject(); 414 v8::Local<v8::Object> details = args[1]->ToObject();
415 v8::Local<v8::Object> image_data =
416 details->Get(v8::String::New("imageData"))->ToObject();
415 v8::Local<v8::Object> data = 417 v8::Local<v8::Object> data =
416 image_data->Get(v8::String::New("data"))->ToObject(); 418 image_data->Get(v8::String::New("data"))->ToObject();
417 int width = image_data->Get(v8::String::New("width"))->Int32Value(); 419 int width = image_data->Get(v8::String::New("width"))->Int32Value();
418 int height = image_data->Get(v8::String::New("height"))->Int32Value(); 420 int height = image_data->Get(v8::String::New("height"))->Int32Value();
419 421
420 int data_length = data->Get(v8::String::New("length"))->Int32Value(); 422 int data_length = data->Get(v8::String::New("length"))->Int32Value();
421 if (data_length != 4 * width * height) { 423 if (data_length != 4 * width * height) {
422 NOTREACHED() << 424 NOTREACHED() <<
423 "Invalid argument to browserAction.setIcon. Expecting ImageData."; 425 "Invalid argument to browserAction.setIcon. Expecting ImageData.";
424 return v8::Undefined(); 426 return v8::Undefined();
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 return; 599 return;
598 600
599 v8::HandleScope handle_scope; 601 v8::HandleScope handle_scope;
600 WebFrame* frame = view->mainFrame(); 602 WebFrame* frame = view->mainFrame();
601 v8::Local<v8::Context> context = frame->mainWorldScriptContext(); 603 v8::Local<v8::Context> context = frame->mainWorldScriptContext();
602 v8::Handle<v8::Value> argv[1]; 604 v8::Handle<v8::Value> argv[1];
603 argv[0] = v8::String::New(type_str); 605 argv[0] = v8::String::New(type_str);
604 bindings_utils::CallFunctionInContext(context, "setViewType", 606 bindings_utils::CallFunctionInContext(context, "setViewType",
605 arraysize(argv), argv); 607 arraysize(argv), argv);
606 } 608 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_resource_unittest.cc ('k') | chrome/renderer/resources/extension_process_bindings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698