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

Side by Side Diff: chrome/browser/ui/views/ash/launcher/launcher_context_menu.cc

Issue 10534142: Add support for pinning platform apps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed review issue. Created 8 years, 6 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 "chrome/browser/ui/views/ash/launcher/launcher_context_menu.h" 5 #include "chrome/browser/ui/views/ash/launcher/launcher_context_menu.h"
6 6
7 #include "ash/launcher/launcher_context_menu.h" 7 #include "ash/launcher/launcher_context_menu.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "chrome/browser/extensions/extension_prefs.h" 10 #include "chrome/browser/extensions/extension_prefs.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 } 47 }
48 } else if (item_.type == ash::TYPE_BROWSER_SHORTCUT) { 48 } else if (item_.type == ash::TYPE_BROWSER_SHORTCUT) {
49 AddItem(MENU_NEW_WINDOW, 49 AddItem(MENU_NEW_WINDOW,
50 l10n_util::GetStringUTF16(IDS_LAUNCHER_NEW_WINDOW)); 50 l10n_util::GetStringUTF16(IDS_LAUNCHER_NEW_WINDOW));
51 if (!controller_->IsLoggedInAsGuest()) { 51 if (!controller_->IsLoggedInAsGuest()) {
52 AddItem(MENU_NEW_INCOGNITO_WINDOW, 52 AddItem(MENU_NEW_INCOGNITO_WINDOW,
53 l10n_util::GetStringUTF16(IDS_LAUNCHER_NEW_INCOGNITO_WINDOW)); 53 l10n_util::GetStringUTF16(IDS_LAUNCHER_NEW_INCOGNITO_WINDOW));
54 } 54 }
55 } else { 55 } else {
56 AddItem(MENU_OPEN, controller->GetTitle(item_)); 56 AddItem(MENU_OPEN, controller->GetTitle(item_));
57 if (item_.type == ash::TYPE_PLATFORM_APP) {
58 AddItem(
59 MENU_PIN,
60 l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_PIN));
61 }
57 if (controller->IsOpen(item_.id)) { 62 if (controller->IsOpen(item_.id)) {
58 AddItem(MENU_CLOSE, 63 AddItem(MENU_CLOSE,
59 l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_CLOSE)); 64 l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_CLOSE));
60 } 65 }
61 } 66 }
62 AddSeparator(); 67 AddSeparator();
63 } 68 }
64 AddCheckItemWithStringId( 69 AddCheckItemWithStringId(
65 MENU_AUTO_HIDE, ash::LauncherContextMenu::GetAutoHideResourceStringId()); 70 MENU_AUTO_HIDE, ash::LauncherContextMenu::GetAutoHideResourceStringId());
66 if (CommandLine::ForCurrentProcess()->HasSwitch( 71 if (CommandLine::ForCurrentProcess()->HasSwitch(
(...skipping 24 matching lines...) Expand all
91 case MENU_AUTO_HIDE: 96 case MENU_AUTO_HIDE:
92 return ash::LauncherContextMenu::IsAutoHideMenuHideChecked(); 97 return ash::LauncherContextMenu::IsAutoHideMenuHideChecked();
93 default: 98 default:
94 return false; 99 return false;
95 } 100 }
96 } 101 }
97 102
98 bool LauncherContextMenu::IsCommandIdEnabled(int command_id) const { 103 bool LauncherContextMenu::IsCommandIdEnabled(int command_id) const {
99 switch (command_id) { 104 switch (command_id) {
100 case MENU_PIN: 105 case MENU_PIN:
101 return controller_->IsPinnable(item_.id); 106 return item_.type == ash::TYPE_PLATFORM_APP ||
107 controller_->IsPinnable(item_.id);
102 default: 108 default:
103 return true; 109 return true;
104 } 110 }
105 } 111 }
106 112
107 bool LauncherContextMenu::GetAcceleratorForCommandId( 113 bool LauncherContextMenu::GetAcceleratorForCommandId(
108 int command_id, 114 int command_id,
109 ui::Accelerator* accelerator) { 115 ui::Accelerator* accelerator) {
110 return false; 116 return false;
111 } 117 }
(...skipping 28 matching lines...) Expand all
140 case MENU_NEW_WINDOW: 146 case MENU_NEW_WINDOW:
141 controller_->CreateNewWindow(); 147 controller_->CreateNewWindow();
142 break; 148 break;
143 case MENU_NEW_INCOGNITO_WINDOW: 149 case MENU_NEW_INCOGNITO_WINDOW:
144 controller_->CreateNewIncognitoWindow(); 150 controller_->CreateNewIncognitoWindow();
145 break; 151 break;
146 case MENU_ALIGNMENT_MENU: 152 case MENU_ALIGNMENT_MENU:
147 break; 153 break;
148 } 154 }
149 } 155 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698