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

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

Issue 10270031: Add a first-class off-store install UI to chrome://extensions/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mr stade 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>
5 <include src="../uber/uber_utils.js"></include> 6 <include src="../uber/uber_utils.js"></include>
6 <include src="extension_list.js"></include> 7 <include src="extension_list.js"></include>
7 <include src="pack_extension_overlay.js"></include> 8 <include src="pack_extension_overlay.js"></include>
8 9
9 // Used for observing function of the backend datasource for this page by 10 // Used for observing function of the backend datasource for this page by
10 // tests. 11 // tests.
11 var webui_responded_ = false; 12 var webui_responded_ = false;
12 13
13 cr.define('extensions', function() { 14 cr.define('extensions', function() {
14 var ExtensionsList = options.ExtensionsList; 15 var ExtensionsList = options.ExtensionsList;
15 16
17 // Implements the DragWrapper handler interface.
18 var dragWrapperHandler = {
19 shouldAcceptDrag: function(e) {
20 // We can't access filenames during the 'dragenter' event, so we have to
21 // wait until 'drop' to decide whether to do something with the file or
22 // not.
23 // See: http://www.w3.org/TR/2011/WD-html5-20110113/dnd.html#concept-dnd-p
Evan Stade 2012/05/02 22:03:09 no, you can't access the file names themselves, bu
Aaron Boodman 2012/05/04 02:22:10 Okie doke.
24 return true;
25 },
26 doDragEnter: function() {
27 chrome.send('startDrag');
28 var dropTarget = $('install-drop-target');
29 dropTarget.style.opacity = 0;
Evan Stade 2012/05/02 22:03:09 this is only a problem because you're toggling bet
Aaron Boodman 2012/05/04 02:22:10 With the new design this comment is no longer appl
30 window.setTimeout(function() {
31 dropTarget.style.opacity = 1;
32 }, 0);
33 },
34 doDragLeave: function() {
35 chrome.send('stopDrag');
36 },
37 doDragOver: function(e) {
38 if (e.target.id == 'install-drop-target')
39 e.target.classList.add('active');
40 else
41 $('install-drop-target').classList.remove('active');
42 },
43 doDrop: function(e) {
44 // Only process files that look like extensions. Other files should
45 // navigate the browser normally.
46 if (!e.dataTransfer.files.length ||
47 !/\.crx$/.test(e.dataTransfer.files[0].name)) {
48 return;
49 }
50
51 if (e.srcElement.id == 'install-drop-target')
52 chrome.send('installDroppedFile');
53
54 e.preventDefault();
55 }
56 };
57
16 /** 58 /**
17 * ExtensionSettings class 59 * ExtensionSettings class
18 * @class 60 * @class
19 */ 61 */
20 function ExtensionSettings() {} 62 function ExtensionSettings() {}
21 63
22 cr.addSingletonGetter(ExtensionSettings); 64 cr.addSingletonGetter(ExtensionSettings);
23 65
24 ExtensionSettings.prototype = { 66 ExtensionSettings.prototype = {
25 __proto__: HTMLDivElement.prototype, 67 __proto__: HTMLDivElement.prototype,
(...skipping 20 matching lines...) Expand all
46 this.handleDevControlsTransitionEnd_.bind(this)); 88 this.handleDevControlsTransitionEnd_.bind(this));
47 89
48 // Set up the three dev mode buttons (load unpacked, pack and update). 90 // Set up the three dev mode buttons (load unpacked, pack and update).
49 $('load-unpacked').addEventListener('click', 91 $('load-unpacked').addEventListener('click',
50 this.handleLoadUnpackedExtension_.bind(this)); 92 this.handleLoadUnpackedExtension_.bind(this));
51 $('pack-extension').addEventListener('click', 93 $('pack-extension').addEventListener('click',
52 this.handlePackExtension_.bind(this)); 94 this.handlePackExtension_.bind(this));
53 $('update-extensions-now').addEventListener('click', 95 $('update-extensions-now').addEventListener('click',
54 this.handleUpdateExtensionNow_.bind(this)); 96 this.handleUpdateExtensionNow_.bind(this));
55 97
98 if (document.body.getAttribute('offStoreInstallEnabled') == 'false') {
Evan Stade 2012/05/02 22:03:09 this also doesn't work for some reason (didn't bot
Aaron Boodman 2012/05/04 02:22:10 Done.
99 this.dragWrapper_ =
100 new cr.ui.DragWrapper(document.body, dragWrapperHandler);
101 }
102
56 var packExtensionOverlay = extensions.PackExtensionOverlay.getInstance(); 103 var packExtensionOverlay = extensions.PackExtensionOverlay.getInstance();
57 packExtensionOverlay.initializePage(); 104 packExtensionOverlay.initializePage();
58 }, 105 },
59 106
60 /** 107 /**
61 * Handles the Load Unpacked Extension button. 108 * Handles the Load Unpacked Extension button.
62 * @param {Event} e Change event. 109 * @param {Event} e Change event.
63 * @private 110 * @private
64 */ 111 */
65 handleLoadUnpackedExtension_: function(e) { 112 handleLoadUnpackedExtension_: function(e) {
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 return { 289 return {
243 ExtensionSettings: ExtensionSettings 290 ExtensionSettings: ExtensionSettings
244 }; 291 };
245 }); 292 });
246 293
247 var ExtensionSettings = extensions.ExtensionSettings; 294 var ExtensionSettings = extensions.ExtensionSettings;
248 295
249 window.addEventListener('load', function(e) { 296 window.addEventListener('load', function(e) {
250 ExtensionSettings.getInstance().initialize(); 297 ExtensionSettings.getInstance().initialize();
251 }); 298 });
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