diff options
author | andybons@chromium.org <andybons@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-29 22:38:10 +0000 |
---|---|---|
committer | andybons@chromium.org <andybons@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-29 22:38:10 +0000 |
commit | 636507a6ed98f61845adc46736a97569bc021ffc (patch) | |
tree | 84587826f0e850b0e44325f8ab29354605d48afa /chrome/browser/resources | |
parent | 9503ca35d3f9ecd86f4766baf4ad9216fef70527 (diff) | |
download | chromium_src-636507a6ed98f61845adc46736a97569bc021ffc.zip chromium_src-636507a6ed98f61845adc46736a97569bc021ffc.tar.gz chromium_src-636507a6ed98f61845adc46736a97569bc021ffc.tar.bz2 |
Revert 60997 - o Add user customizable launch type for apps by adding options in each apps context menu.
o Updated some comments that were using the outdated NOTIFY_PREF_CHANGED notification.
o Make LAUNCH_PINNED the default type returned by ExtensionPrefs if it does not already exist.
o Some minor refactoring within the code to reduce duplication.
BUG=54731
TEST=NONE
patch from issue 3419010
Review URL: http://codereview.chromium.org/3453029
TBR=andybons@chromium.org
Review URL: http://codereview.chromium.org/3517004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61000 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources')
-rw-r--r-- | chrome/browser/resources/new_new_tab.html | 10 | ||||
-rw-r--r-- | chrome/browser/resources/ntp/apps.js | 51 | ||||
-rw-r--r-- | chrome/browser/resources/shared/css/menu.css | 17 | ||||
-rw-r--r-- | chrome/browser/resources/shared/images/checkbox_black.png | bin | 192 -> 0 bytes | |||
-rw-r--r-- | chrome/browser/resources/shared/images/checkbox_white.png | bin | 200 -> 0 bytes | |||
-rw-r--r-- | chrome/browser/resources/shared/js/cr/ui/command.js | 6 | ||||
-rw-r--r-- | chrome/browser/resources/shared/js/cr/ui/menu_item.js | 11 |
7 files changed, 1 insertions, 94 deletions
diff --git a/chrome/browser/resources/new_new_tab.html b/chrome/browser/resources/new_new_tab.html index 7290e32..23e8e24 100644 --- a/chrome/browser/resources/new_new_tab.html +++ b/chrome/browser/resources/new_new_tab.html @@ -176,20 +176,10 @@ if ('mode' in hashParams) { <command id="apps-launch-command"> <command id="apps-options-command" i18n-values=".label:appoptions"> <command id="apps-uninstall-command" i18n-values=".label:appuninstall"> -<command id="apps-launch-type-pinned" i18n-values=".label:applaunchtypepinned" - launch-type="0"> -<command id="apps-launch-type-regular" i18n-values=".label:applaunchtyperegular" - launch-type="1"> -<command id="apps-launch-type-fullscreen" - i18n-values=".label:applaunchtypefullscreen" launch-type="2"> <menu id="app-context-menu"> <button class="default" command="#apps-launch-command"></button> <hr> - <button command="#apps-launch-type-pinned" launch-type="0"></button> - <button command="#apps-launch-type-regular" launch-type="1"></button> - <button command="#apps-launch-type-fullscreen" launch-type="2"></button> - <hr> <button command="#apps-options-command"></button> <button command="#apps-uninstall-command"></button> </menu> diff --git a/chrome/browser/resources/ntp/apps.js b/chrome/browser/resources/ntp/apps.js index 5ed32e2..d9098d5 100644 --- a/chrome/browser/resources/ntp/apps.js +++ b/chrome/browser/resources/ntp/apps.js @@ -36,15 +36,6 @@ function getAppsCallback(data) { } } -function appsPrefChangeCallback(data) { - // Currently the only pref that is watched is the launch type. - data.apps.forEach(function(app) { - var appLink = document.querySelector('.app a[app-id=' + app['id'] + ']'); - if (appLink) - appLink.setAttribute('launch-type', app['launch_type']); - }); -} - var apps = (function() { function createElement(app) { @@ -53,7 +44,6 @@ var apps = (function() { var a = div.appendChild(document.createElement('a')); a.setAttribute('app-id', app['id']); - a.setAttribute('launch-type', app['launch_type']); a.xtitle = a.textContent = app['name']; a.href = app['launch_url']; @@ -109,20 +99,6 @@ var apps = (function() { return false; } - // Keep in sync with LaunchType in extension_prefs.h - var LaunchType = { - LAUNCH_PINNED: 0, - LAUNCH_REGULAR: 1, - LAUNCH_FULLSCREEN: 2 - }; - - // Keep in sync with LaunchContainer in extension.h - var LaunchContainer = { - LAUNCH_WINDOW: 0, - LAUNCH_PANEL: 1, - LAUNCH_TAB: 2 - }; - var currentApp; function addContextMenu(el, app) { @@ -137,24 +113,6 @@ var apps = (function() { $('apps-launch-command').label = app['name']; $('apps-options-command').canExecuteChange(); - var appLinkSel = '.app a[app-id=' + app['id'] + ']'; - var launchType = - el.querySelector(appLinkSel).getAttribute('launch-type'); - - var launchContainer = app['launch_container']; - var isPanel = launchContainer == LaunchContainer.LAUNCH_PANEL; - - // Update the commands related to the launch type. - var launchTypeIds = ['apps-launch-type-pinned', - 'apps-launch-type-regular', - 'apps-launch-type-fullscreen']; - launchTypeIds.forEach(function(id) { - var command = $(id); - command.disabled = isPanel; - command.checked = !isPanel && - launchType == command.getAttribute('launch-type'); - }); - return $('app-context-menu'); } }); @@ -164,8 +122,7 @@ var apps = (function() { if (!currentApp) return; - var commandId = e.command.id; - switch (commandId) { + switch (e.command.id) { case 'apps-options-command': window.location = currentApp['options_url']; break; @@ -175,12 +132,6 @@ var apps = (function() { case 'apps-uninstall-command': chrome.send('uninstallApp', [currentApp['id']]); break; - case 'apps-launch-type-pinned': - case 'apps-launch-type-regular': - case 'apps-launch-type-fullscreen': - chrome.send('setLaunchType', - [currentApp['id'], e.command.getAttribute('launch-type')]); - break; } }); diff --git a/chrome/browser/resources/shared/css/menu.css b/chrome/browser/resources/shared/css/menu.css index 19f5248..a891a42 100644 --- a/chrome/browser/resources/shared/css/menu.css +++ b/chrome/browser/resources/shared/css/menu.css @@ -57,20 +57,3 @@ menu > :not(hr)[selected]:active { background-color: #426dc9; color: #fff; } - -menu > [checked]:before { - content: url("../images/checkbox_black.png"); - width: 9px; - height: 9px; - display: inline-block; - vertical-align: 50%; - margin: 0 5px; -} - -menu > [checked] { - -webkit-padding-start: 0; -} - -menu > [selected][checked]:active:before { - content: url("../images/checkbox_white.png"); -}
\ No newline at end of file diff --git a/chrome/browser/resources/shared/images/checkbox_black.png b/chrome/browser/resources/shared/images/checkbox_black.png Binary files differdeleted file mode 100644 index 3420cd6..0000000 --- a/chrome/browser/resources/shared/images/checkbox_black.png +++ /dev/null diff --git a/chrome/browser/resources/shared/images/checkbox_white.png b/chrome/browser/resources/shared/images/checkbox_white.png Binary files differdeleted file mode 100644 index 95d6b13..0000000 --- a/chrome/browser/resources/shared/images/checkbox_white.png +++ /dev/null diff --git a/chrome/browser/resources/shared/js/cr/ui/command.js b/chrome/browser/resources/shared/js/cr/ui/command.js index 61294f3..1011398 100644 --- a/chrome/browser/resources/shared/js/cr/ui/command.js +++ b/chrome/browser/resources/shared/js/cr/ui/command.js @@ -172,12 +172,6 @@ cr.define('cr.ui', function() { cr.defineProperty(Command, 'hidden', cr.PropertyKind.BOOL_ATTR); /** - * Whether the command is checked or not. - * @type {boolean} - */ - cr.defineProperty(Command, 'checked', cr.PropertyKind.BOOL_ATTR); - - /** * Dispatches a canExecute event on the target. * @param {cr.ui.Command} command The command that we are testing for. * @param {Element} target The target element to dispatch the event on. diff --git a/chrome/browser/resources/shared/js/cr/ui/menu_item.js b/chrome/browser/resources/shared/js/cr/ui/menu_item.js index c3e3169..d570f78 100644 --- a/chrome/browser/resources/shared/js/cr/ui/menu_item.js +++ b/chrome/browser/resources/shared/js/cr/ui/menu_item.js @@ -52,7 +52,6 @@ cr.define('cr.ui', function() { this.command_.removeEventListener('labelChange', this); this.command_.removeEventListener('disabledChange', this); this.command_.removeEventListener('hiddenChange', this); - this.command_.removeEventListener('checkedChange', this); } if (typeof command == 'string' && command[0] == '#') { @@ -72,7 +71,6 @@ cr.define('cr.ui', function() { this.command_.addEventListener('labelChange', this); this.command_.addEventListener('disabledChange', this); this.command_.addEventListener('hiddenChange', this); - this.command_.addEventListener('checkedChange', this); } }, @@ -126,9 +124,6 @@ cr.define('cr.ui', function() { case 'labelChange': this.label = this.command.label; break; - case 'checkedChange': - this.checked = this.command.checked; - break; } } }; @@ -151,12 +146,6 @@ cr.define('cr.ui', function() { */ cr.defineProperty(MenuItem, 'selected', cr.PropertyKind.BOOL_ATTR); - /** - * Whether the menu item is checked or not. - * @type {boolean} - */ - cr.defineProperty(MenuItem, 'checked', cr.PropertyKind.BOOL_ATTR); - // Export return { MenuItem: MenuItem |