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

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

Issue 15841013: Make miscellaneous_bindings and event_bindings Required as needed. Previously (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 // Custom bindings for the downloads API. 5 // Custom bindings for the downloads API.
6 6
7 var binding = require('binding').Binding.create('downloads'); 7 var binding = require('binding').Binding.create('downloads');
8 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
9 var downloadsInternal = require('binding').Binding.create( 8 var downloadsInternal = require('binding').Binding.create(
10 'downloadsInternal').generate(); 9 'downloadsInternal').generate();
10 var eventBindings = require('event_bindings');
11 11
12 chromeHidden.Event.registerArgumentMassager( 12 eventBindings.registerArgumentMassager(
13 'downloads.onDeterminingFilename', 13 'downloads.onDeterminingFilename',
14 function massage_determining_filename(args, dispatch) { 14 function massage_determining_filename(args, dispatch) {
15 var downloadItem = args[0]; 15 var downloadItem = args[0];
16 // Copy the id so that extensions can't change it. 16 // Copy the id so that extensions can't change it.
17 var downloadId = downloadItem.id; 17 var downloadId = downloadItem.id;
18 var suggestable = true; 18 var suggestable = true;
19 function suggestCallback(result) { 19 function suggestCallback(result) {
20 if (!suggestable) { 20 if (!suggestable) {
21 console.error('suggestCallback may not be called more than once.'); 21 console.error('suggestCallback may not be called more than once.');
22 return; 22 return;
(...skipping 17 matching lines...) Expand all
40 (results.results.length != 0) && 40 (results.results.length != 0) &&
41 (results.results[0] === true)); 41 (results.results[0] === true));
42 if (suggestable && !async) 42 if (suggestable && !async)
43 suggestCallback(); 43 suggestCallback();
44 } catch (e) { 44 } catch (e) {
45 suggestCallback(); 45 suggestCallback();
46 throw e; 46 throw e;
47 } 47 }
48 }); 48 });
49 exports.binding = binding.generate(); 49 exports.binding = binding.generate();
OLDNEW
« no previous file with comments | « chrome/renderer/resources/extensions/context_menus_custom_bindings.js ('k') | chrome/renderer/resources/extensions/event.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698