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

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

Issue 16032015: Extensions: pass ChromeV8Context around instead of v8::Handle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/renderer/extensions/set_icon_natives.h" 5 #include "chrome/renderer/extensions/set_icon_natives.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/common/render_messages.h" 10 #include "chrome/common/render_messages.h"
11 #include "chrome/renderer/extensions/request_sender.h" 11 #include "chrome/renderer/extensions/request_sender.h"
12 #include "third_party/skia/include/core/SkBitmap.h" 12 #include "third_party/skia/include/core/SkBitmap.h"
13 #include "third_party/skia/include/core/SkColor.h" 13 #include "third_party/skia/include/core/SkColor.h"
14 14
15 namespace { 15 namespace {
16 16
17 const char* kImageSizeKeys[] = { "19", "38" }; 17 const char* kImageSizeKeys[] = { "19", "38" };
18 const char kInvalidDimensions[] = "ImageData has invalid dimensions."; 18 const char kInvalidDimensions[] = "ImageData has invalid dimensions.";
19 const char kInvalidData[] = "ImageData data length does not match dimensions."; 19 const char kInvalidData[] = "ImageData data length does not match dimensions.";
20 const char kNoMemory[] = "Chrome was unable to initialize icon."; 20 const char kNoMemory[] = "Chrome was unable to initialize icon.";
21 21
22 } // namespace 22 } // namespace
23 23
24 namespace extensions { 24 namespace extensions {
25 25
26 SetIconNatives::SetIconNatives(Dispatcher* dispatcher, 26 SetIconNatives::SetIconNatives(Dispatcher* dispatcher,
27 RequestSender* request_sender, 27 RequestSender* request_sender,
28 ChromeV8Context* context) 28 ChromeV8Context* context)
29 : ChromeV8Extension(dispatcher, context->v8_context()), 29 : ChromeV8Extension(dispatcher, context),
30 request_sender_(request_sender), 30 request_sender_(request_sender) {
31 context_(context) {
32 RouteFunction( 31 RouteFunction(
33 "SetIconCommon", 32 "SetIconCommon",
34 base::Bind(&SetIconNatives::SetIconCommon, base::Unretained(this))); 33 base::Bind(&SetIconNatives::SetIconCommon, base::Unretained(this)));
35 } 34 }
36 35
37 bool SetIconNatives::ConvertImageDataToBitmapValue( 36 bool SetIconNatives::ConvertImageDataToBitmapValue(
38 const v8::Local<v8::Object> image_data, 37 const v8::Local<v8::Object> image_data,
39 Value** bitmap_value) { 38 Value** bitmap_value) {
40 v8::Local<v8::Object> data = 39 v8::Local<v8::Object> data =
41 image_data->Get(v8::String::New("data"))->ToObject(); 40 image_data->Get(v8::String::New("data"))->ToObject();
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 130 }
132 131
133 ListValue list_value; 132 ListValue list_value;
134 list_value.Append(dict); 133 list_value.Append(dict);
135 134
136 std::string name = *v8::String::AsciiValue(args[0]); 135 std::string name = *v8::String::AsciiValue(args[0]);
137 int request_id = args[2]->Int32Value(); 136 int request_id = args[2]->Int32Value();
138 bool has_callback = args[3]->BooleanValue(); 137 bool has_callback = args[3]->BooleanValue();
139 bool for_io_thread = args[4]->BooleanValue(); 138 bool for_io_thread = args[4]->BooleanValue();
140 139
141 request_sender_->StartRequest(context_, 140 request_sender_->StartRequest(context(),
142 name, 141 name,
143 request_id, 142 request_id,
144 has_callback, 143 has_callback,
145 for_io_thread, 144 for_io_thread,
146 &list_value); 145 &list_value);
147 return v8::Undefined(); 146 return v8::Undefined();
148 } 147 }
149 148
150 } // namespace extensions 149 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/set_icon_natives.h ('k') | chrome/renderer/extensions/sync_file_system_custom_bindings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698