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

Side by Side Diff: chrome/browser/resources/md_extensions/options_dialog.js

Issue 2617663002: WIP: run clang-format-js on lots of things (Closed)
Patch Set: merge Created 3 years, 11 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 cr.define('extensions', function() { 5 cr.define('extensions', function() {
6 'use strict'; 6 'use strict';
7 7
8 var MAX_HEIGHT = 600; 8 var MAX_HEIGHT = 600;
9 var MAX_WIDTH = 600; 9 var MAX_WIDTH = 600;
10 var MIN_HEIGHT = 300; 10 var MIN_HEIGHT = 300;
(...skipping 15 matching lines...) Expand all
26 this.data_ = data; 26 this.data_ = data;
27 if (!this.extensionOptions_) 27 if (!this.extensionOptions_)
28 this.extensionOptions_ = document.createElement('ExtensionOptions'); 28 this.extensionOptions_ = document.createElement('ExtensionOptions');
29 this.extensionOptions_.extension = this.data_.id; 29 this.extensionOptions_.extension = this.data_.id;
30 this.extensionOptions_.onclose = this.close.bind(this); 30 this.extensionOptions_.onclose = this.close.bind(this);
31 var bounded = function(min, max, val) { 31 var bounded = function(min, max, val) {
32 return Math.min(Math.max(min, val), max); 32 return Math.min(Math.max(min, val), max);
33 }; 33 };
34 34
35 var onSizeChanged = function(e) { 35 var onSizeChanged = function(e) {
36 var minHeaderWidth = 36 var minHeaderWidth = this.$['icon-and-name-wrapper'].offsetWidth +
37 this.$['icon-and-name-wrapper'].offsetWidth + 37 this.$['close-button'].offsetWidth + HEADER_PADDING;
38 this.$['close-button'].offsetWidth +
39 HEADER_PADDING;
40 var minWidth = Math.max(minHeaderWidth, MIN_WIDTH); 38 var minWidth = Math.max(minHeaderWidth, MIN_WIDTH);
41 this.$.main.style.height = 39 this.$.main.style.height =
42 bounded(MIN_HEIGHT, MAX_HEIGHT, e.height) + 'px'; 40 bounded(MIN_HEIGHT, MAX_HEIGHT, e.height) + 'px';
43 this.$.main.style.width = 41 this.$.main.style.width = bounded(minWidth, MAX_WIDTH, e.width) + 'px';
44 bounded(minWidth, MAX_WIDTH, e.width) + 'px';
45 }.bind(this); 42 }.bind(this);
46 43
47 this.extensionOptions_.onpreferredsizechanged = onSizeChanged; 44 this.extensionOptions_.onpreferredsizechanged = onSizeChanged;
48 this.$.main.appendChild(this.extensionOptions_); 45 this.$.main.appendChild(this.extensionOptions_);
49 this.$$('dialog').showModal(); 46 this.$$('dialog').showModal();
50 onSizeChanged({height: 0, width: 0}); 47 onSizeChanged({height: 0, width: 0});
51 }, 48 },
52 49
53 close: function() { 50 close: function() {
54 this.$$('dialog').close(); 51 this.$$('dialog').close();
55 }, 52 },
56 }); 53 });
57 54
58 return {OptionsDialog: OptionsDialog}; 55 return {OptionsDialog: OptionsDialog};
59 }); 56 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_extensions/manager.js ('k') | chrome/browser/resources/md_extensions/pack_dialog.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698