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

Side by Side Diff: chrome/browser/resources/options/pack_extension_overlay.js

Issue 7794023: Convert chrome://extensions to a settings page within the options pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 cr.define('options', function() {
6 const OptionsPage = options.OptionsPage;
7
8 /**
9 * PackExtensionOverlay class
10 * Encapsulated handling of the 'Pack Extension' overlay page.
11 * @class
12 */
13 function PackExtensionOverlay() {
14 OptionsPage.call(this, 'packExtensionOverlay',
15 templateData.packExtensionOverlayTabTitle,
16 'packExtensionOverlay');
17 }
18
19 cr.addSingletonGetter(PackExtensionOverlay);
20
21 PackExtensionOverlay.prototype = {
22 // Inherit PackExtensionOverlay from OptionsPage.
23 __proto__: OptionsPage.prototype,
24
25 /**
26 * Initialize the page.
27 */
28 initializePage: function() {
29 // Call base class implementation to starts preference initialization.
30 OptionsPage.prototype.initializePage.call(this);
31
32 $('packExtensionDismiss').onclick = function(event) {
33 OptionsPage.closeOverlay();
34 };
35 $('packExtensionCommit').onclick = function(event) {
36 var extensionPath = $('extensionRootDir').value;
37 var privateKeyPath = $('extensionPrivateKey').value;
38 chrome.send('pack', [extensionPath, privateKeyPath]);
39 };
40 $('browseExtensionDir').addEventListener('click',
41 this.handleBrowseExtensionDir_.bind(this));
42 $('browsePrivateKey').addEventListener('click',
43 this.handleBrowsePrivateKey_.bind(this));
44 },
45
46 /**
47 * Utility function which asks the C++ to show a platform-specific file
48 * select dialog, and fire |callback| with the |filePath| that resulted.
49 * |selectType| can be either 'file' or 'folder'. |operation| can be 'load',
50 * 'packRoot', or 'pem' which are signals to the C++ to do some
51 * operation-specific configuration.
csilv 2011/09/01 21:10:45 @private
Finnur 2011/09/02 13:58:47 Done.
52 */
53 showFileDialog_: function(selectType, operation, callback) {
54 handleFilePathSelected = function(filePath) {
55 callback(filePath);
56 handleFilePathSelected = function() {};
57 };
58
59 chrome.send('selectFilePath', [selectType, operation]);
60 },
61
62 /**
63 * Handles the showing of the extension directory browser.
64 * @param {Event} e Change event.
65 * @private
66 */
67 handleBrowseExtensionDir_: function(e) {
68 this.showFileDialog_('folder', 'load', function(filePath) {
69 $('extensionRootDir').value = filePath;
70 });
71 },
72
73 /**
74 * Handles the showing of the extension private key file.
75 * @param {Event} e Change event.
76 * @private
77 */
78 handleBrowsePrivateKey_: function(e) {
79 this.showFileDialog_('file', 'load', function(filePath) {
80 $('extensionPrivateKey').value = filePath;
81 });
82 },
83 };
84
85 // Export
86 return {
87 PackExtensionOverlay: PackExtensionOverlay
88 };
89 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698