| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/renderer/set_icon_natives.h" | 5 #include "extensions/renderer/set_icon_natives.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 const char kNoMemory[] = "Chrome was unable to initialize icon."; | 26 const char kNoMemory[] = "Chrome was unable to initialize icon."; |
| 27 | 27 |
| 28 } // namespace | 28 } // namespace |
| 29 | 29 |
| 30 namespace extensions { | 30 namespace extensions { |
| 31 | 31 |
| 32 SetIconNatives::SetIconNatives(ScriptContext* context) | 32 SetIconNatives::SetIconNatives(ScriptContext* context) |
| 33 : ObjectBackedNativeHandler(context) { | 33 : ObjectBackedNativeHandler(context) { |
| 34 RouteFunction( | 34 RouteFunction( |
| 35 "SetIconCommon", | 35 "SetIconCommon", |
| 36 {"declarativeContent", "pageAction", "browserAction", "systemIndicator"}, |
| 36 base::Bind(&SetIconNatives::SetIconCommon, base::Unretained(this))); | 37 base::Bind(&SetIconNatives::SetIconCommon, base::Unretained(this))); |
| 37 } | 38 } |
| 38 | 39 |
| 39 bool SetIconNatives::ConvertImageDataToBitmapValue( | 40 bool SetIconNatives::ConvertImageDataToBitmapValue( |
| 40 const v8::Local<v8::Object> image_data, | 41 const v8::Local<v8::Object> image_data, |
| 41 v8::Local<v8::Value>* image_data_bitmap) { | 42 v8::Local<v8::Value>* image_data_bitmap) { |
| 42 v8::Isolate* isolate = context()->v8_context()->GetIsolate(); | 43 v8::Isolate* isolate = context()->v8_context()->GetIsolate(); |
| 43 v8::Local<v8::Object> data = | 44 v8::Local<v8::Object> data = |
| 44 image_data->Get(v8::String::NewFromUtf8(isolate, "data")) | 45 image_data->Get(v8::String::NewFromUtf8(isolate, "data")) |
| 45 ->ToObject(isolate); | 46 ->ToObject(isolate); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 bitmap_set_value); | 147 bitmap_set_value); |
| 147 if (details->Has(v8::String::NewFromUtf8(args.GetIsolate(), "tabId"))) { | 148 if (details->Has(v8::String::NewFromUtf8(args.GetIsolate(), "tabId"))) { |
| 148 dict->Set( | 149 dict->Set( |
| 149 v8::String::NewFromUtf8(args.GetIsolate(), "tabId"), | 150 v8::String::NewFromUtf8(args.GetIsolate(), "tabId"), |
| 150 details->Get(v8::String::NewFromUtf8(args.GetIsolate(), "tabId"))); | 151 details->Get(v8::String::NewFromUtf8(args.GetIsolate(), "tabId"))); |
| 151 } | 152 } |
| 152 args.GetReturnValue().Set(dict); | 153 args.GetReturnValue().Set(dict); |
| 153 } | 154 } |
| 154 | 155 |
| 155 } // namespace extensions | 156 } // namespace extensions |
| OLD | NEW |