OLD | NEW |
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/browser/extensions/api/declarative_content/content_action.h" | 5 #include "chrome/browser/extensions/api/declarative_content/content_action.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 IPC::Message bitmap_pickle; | 162 IPC::Message bitmap_pickle; |
163 IPC::WriteParam(&bitmap_pickle, bitmap); | 163 IPC::WriteParam(&bitmap_pickle, bitmap); |
164 std::string binary_data = std::string( | 164 std::string binary_data = std::string( |
165 static_cast<const char*>(bitmap_pickle.data()), bitmap_pickle.size()); | 165 static_cast<const char*>(bitmap_pickle.data()), bitmap_pickle.size()); |
166 std::string data64; | 166 std::string data64; |
167 base::Base64Encode(binary_data, &data64); | 167 base::Base64Encode(binary_data, &data64); |
168 | 168 |
169 scoped_ptr<base::DictionaryValue> dict = | 169 scoped_ptr<base::DictionaryValue> dict = |
170 DictionaryBuilder() | 170 DictionaryBuilder() |
171 .Set("instanceType", "declarativeContent.SetIcon") | 171 .Set("instanceType", "declarativeContent.SetIcon") |
172 .Set("imageData", std::move(DictionaryBuilder().Set("19", data64))) | 172 .Set("imageData", DictionaryBuilder().Set("19", data64).Build()) |
173 .Build(); | 173 .Build(); |
174 | 174 |
175 const Extension* extension = env.MakeExtension( | 175 const Extension* extension = env.MakeExtension( |
176 *ParseJson("{\"page_action\": { \"default_title\": \"Extension\" } }")); | 176 *ParseJson("{\"page_action\": { \"default_title\": \"Extension\" } }")); |
177 std::string error; | 177 std::string error; |
178 scoped_ptr<const ContentAction> result = ContentAction::Create( | 178 scoped_ptr<const ContentAction> result = ContentAction::Create( |
179 NULL, | 179 NULL, |
180 extension, | 180 extension, |
181 *dict, | 181 *dict, |
182 &error); | 182 &error); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 " \"instanceType\": \"declarativeContent.RequestContentScript\",\n" | 340 " \"instanceType\": \"declarativeContent.RequestContentScript\",\n" |
341 " \"js\": [\"script.js\"],\n" | 341 " \"js\": [\"script.js\"],\n" |
342 " \"matchAboutBlank\": null\n" | 342 " \"matchAboutBlank\": null\n" |
343 "}"), | 343 "}"), |
344 &error); | 344 &error); |
345 ASSERT_FALSE(result.get()); | 345 ASSERT_FALSE(result.get()); |
346 } | 346 } |
347 | 347 |
348 } // namespace | 348 } // namespace |
349 } // namespace extensions | 349 } // namespace extensions |
OLD | NEW |