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

Side by Side Diff: chrome/renderer/resources/extensions/set_icon.js

Issue 9918006: Split SchemaGeneratedBindings up into smaller, more targetted native handlers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 8 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 var SetIconCommon = requireNative('schema_generated_bindings').SetIconCommon; 5 var SetIconCommon = requireNative('setIcon').SetIconCommon;
6 var sendRequest = require('sendRequest').sendRequest; 6 var sendRequest = require('sendRequest').sendRequest;
7 7
8 function setIcon(details, name, parameters, actionType) { 8 function setIcon(details, name, parameters, actionType) {
9 var iconSize = 19; 9 var iconSize = 19;
10 if ("iconIndex" in details) { 10 if ("iconIndex" in details) {
11 sendRequest(name, [details], parameters); 11 sendRequest(name, [details], parameters);
12 } else if ("imageData" in details) { 12 } else if ("imageData" in details) {
13 // Verify that this at least looks like an ImageData element. 13 // Verify that this at least looks like an ImageData element.
14 // Unfortunately, we cannot use instanceof because the ImageData 14 // Unfortunately, we cannot use instanceof because the ImageData
15 // constructor is not public. 15 // constructor is not public.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 {noStringify: true, nativeFunction: SetIconCommon}); 53 {noStringify: true, nativeFunction: SetIconCommon});
54 }; 54 };
55 img.src = details.path; 55 img.src = details.path;
56 } else { 56 } else {
57 throw new Error( 57 throw new Error(
58 "Either the path or imageData property must be specified."); 58 "Either the path or imageData property must be specified.");
59 } 59 }
60 } 60 }
61 61
62 exports.setIcon = setIcon; 62 exports.setIcon = setIcon;
OLDNEW
« no previous file with comments | « chrome/renderer/resources/extensions/send_request.js ('k') | chrome/test/base/chrome_render_view_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698