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

Side by Side Diff: chrome/browser/resources/extensions/extensions.js

Issue 10382025: Revert 135525 - Add a first-class off-store install UI to chrome://extensions/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 src="../shared/js/cr/ui/drag_wrapper.js"></include>
6 <include src="../uber/uber_utils.js"></include> 5 <include src="../uber/uber_utils.js"></include>
7 <include src="extension_list.js"></include> 6 <include src="extension_list.js"></include>
8 <include src="pack_extension_overlay.js"></include> 7 <include src="pack_extension_overlay.js"></include>
9 8
10 // Used for observing function of the backend datasource for this page by 9 // Used for observing function of the backend datasource for this page by
11 // tests. 10 // tests.
12 var webui_responded_ = false; 11 var webui_responded_ = false;
13 12
14 cr.define('extensions', function() { 13 cr.define('extensions', function() {
15 var ExtensionsList = options.ExtensionsList; 14 var ExtensionsList = options.ExtensionsList;
16 15
17 // Implements the DragWrapper handler interface.
18 var dragWrapperHandler = {
19 // @inheritdoc
20 shouldAcceptDrag: function(e) {
21 // We can't access filenames during the 'dragenter' event, so we have to
22 // wait until 'drop' to decide whether to do something with the file or
23 // not.
24 // See: http://www.w3.org/TR/2011/WD-html5-20110113/dnd.html#concept-dnd-p
25 return e.dataTransfer.types.indexOf('Files') > -1;
26 },
27 // @inheritdoc
28 doDragEnter: function() {
29 chrome.send('startDrag');
30 ExtensionSettings.showOverlay(null);
31 ExtensionSettings.showOverlay($('dropTargetOverlay'));
32 },
33 // @inheritdoc
34 doDragLeave: function() {
35 ExtensionSettings.showOverlay(null);
36 chrome.send('stopDrag');
37 },
38 // @inheritdoc
39 doDragOver: function(e) {
40 },
41 // @inheritdoc
42 doDrop: function(e) {
43 // Only process files that look like extensions. Other files should
44 // navigate the browser normally.
45 if (!e.dataTransfer.files.length ||
46 !/\.crx$/.test(e.dataTransfer.files[0].name)) {
47 return;
48 }
49
50 chrome.send('installDroppedFile');
51 ExtensionSettings.showOverlay(null);
52 e.preventDefault();
53 }
54 };
55
56 /** 16 /**
57 * ExtensionSettings class 17 * ExtensionSettings class
58 * @class 18 * @class
59 */ 19 */
60 function ExtensionSettings() {} 20 function ExtensionSettings() {}
61 21
62 cr.addSingletonGetter(ExtensionSettings); 22 cr.addSingletonGetter(ExtensionSettings);
63 23
64 ExtensionSettings.prototype = { 24 ExtensionSettings.prototype = {
65 __proto__: HTMLDivElement.prototype, 25 __proto__: HTMLDivElement.prototype,
(...skipping 20 matching lines...) Expand all
86 this.handleDevControlsTransitionEnd_.bind(this)); 46 this.handleDevControlsTransitionEnd_.bind(this));
87 47
88 // Set up the three dev mode buttons (load unpacked, pack and update). 48 // Set up the three dev mode buttons (load unpacked, pack and update).
89 $('load-unpacked').addEventListener('click', 49 $('load-unpacked').addEventListener('click',
90 this.handleLoadUnpackedExtension_.bind(this)); 50 this.handleLoadUnpackedExtension_.bind(this));
91 $('pack-extension').addEventListener('click', 51 $('pack-extension').addEventListener('click',
92 this.handlePackExtension_.bind(this)); 52 this.handlePackExtension_.bind(this));
93 $('update-extensions-now').addEventListener('click', 53 $('update-extensions-now').addEventListener('click',
94 this.handleUpdateExtensionNow_.bind(this)); 54 this.handleUpdateExtensionNow_.bind(this));
95 55
96 if (!loadTimeData.getBoolean('offStoreInstallEnabled')) {
97 this.dragWrapper_ =
98 new cr.ui.DragWrapper(document.body, dragWrapperHandler);
99 }
100
101 var packExtensionOverlay = extensions.PackExtensionOverlay.getInstance(); 56 var packExtensionOverlay = extensions.PackExtensionOverlay.getInstance();
102 packExtensionOverlay.initializePage(); 57 packExtensionOverlay.initializePage();
103
104 cr.ui.overlay.setupOverlay($('dropTargetOverlay'));
105 }, 58 },
106 59
107 /** 60 /**
108 * Handles the Load Unpacked Extension button. 61 * Handles the Load Unpacked Extension button.
109 * @param {Event} e Change event. 62 * @param {Event} e Change event.
110 * @private 63 * @private
111 */ 64 */
112 handleLoadUnpackedExtension_: function(e) { 65 handleLoadUnpackedExtension_: function(e) {
113 chrome.send('extensionSettingsLoadUnpackedExtension'); 66 chrome.send('extensionSettingsLoadUnpackedExtension');
114 67
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 return { 242 return {
290 ExtensionSettings: ExtensionSettings 243 ExtensionSettings: ExtensionSettings
291 }; 244 };
292 }); 245 });
293 246
294 var ExtensionSettings = extensions.ExtensionSettings; 247 var ExtensionSettings = extensions.ExtensionSettings;
295 248
296 window.addEventListener('load', function(e) { 249 window.addEventListener('load', function(e) {
297 ExtensionSettings.getInstance().initialize(); 250 ExtensionSettings.getInstance().initialize();
298 }); 251 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/extensions/extensions.html ('k') | chrome/browser/ui/webui/extensions/extensions_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698