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

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

Issue 10837317: Setting the touch wrench menu as default menu for ChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Still build problems: Removed const from function since linux_clang didn't like that Created 8 years, 4 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/ash/launcher/launcher_context_menu.h" 5 #include "chrome/browser/ui/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"
11 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 11 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
12 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
13 #include "grit/ash_strings.h" 13 #include "grit/ash_strings.h"
14 #include "grit/generated_resources.h" 14 #include "grit/generated_resources.h"
15 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
16 16
17 LauncherContextMenu::LauncherContextMenu(ChromeLauncherController* controller, 17 LauncherContextMenu::LauncherContextMenu(ChromeLauncherController* controller,
18 const ash::LauncherItem* item) 18 const ash::LauncherItem* item)
19 : ui::SimpleMenuModel(NULL), 19 : ui::SimpleMenuModel(NULL),
20 controller_(controller), 20 controller_(controller),
21 item_(item ? *item : ash::LauncherItem()) { 21 item_(item ? *item : ash::LauncherItem()) {
22 set_delegate(this); 22 set_delegate(this);
23 23
24 if (is_valid_item()) { 24 if (is_valid_item()) {
25 if (item_.type == ash::TYPE_APP_SHORTCUT) { 25 if (item_.type == ash::TYPE_APP_SHORTCUT) {
26 DCHECK(controller->IsPinned(item_.id)); 26 DCHECK(controller->IsPinned(item_.id));
27 AddItem( 27 AddItem(
28 MENU_PIN, 28 MENU_PIN,
29 l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_UNPIN)); 29 l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_UNPIN));
30 AddSeparator(); 30 AddSeparator(ui::NORMAL_SEPARATOR);
31 AddCheckItemWithStringId( 31 AddCheckItemWithStringId(
32 LAUNCH_TYPE_REGULAR_TAB, 32 LAUNCH_TYPE_REGULAR_TAB,
33 IDS_APP_CONTEXT_MENU_OPEN_REGULAR); 33 IDS_APP_CONTEXT_MENU_OPEN_REGULAR);
34 AddCheckItemWithStringId( 34 AddCheckItemWithStringId(
35 LAUNCH_TYPE_PINNED_TAB, 35 LAUNCH_TYPE_PINNED_TAB,
36 IDS_APP_CONTEXT_MENU_OPEN_PINNED); 36 IDS_APP_CONTEXT_MENU_OPEN_PINNED);
37 AddCheckItemWithStringId( 37 AddCheckItemWithStringId(
38 LAUNCH_TYPE_WINDOW, 38 LAUNCH_TYPE_WINDOW,
39 IDS_APP_CONTEXT_MENU_OPEN_WINDOW); 39 IDS_APP_CONTEXT_MENU_OPEN_WINDOW);
40 // Even though the launch type is Full Screen it is more accurately 40 // Even though the launch type is Full Screen it is more accurately
(...skipping 13 matching lines...) Expand all
54 if (item_.type == ash::TYPE_PLATFORM_APP) { 54 if (item_.type == ash::TYPE_PLATFORM_APP) {
55 AddItem( 55 AddItem(
56 MENU_PIN, 56 MENU_PIN,
57 l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_PIN)); 57 l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_PIN));
58 } 58 }
59 if (controller->IsOpen(item_.id)) { 59 if (controller->IsOpen(item_.id)) {
60 AddItem(MENU_CLOSE, 60 AddItem(MENU_CLOSE,
61 l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_CLOSE)); 61 l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_CLOSE));
62 } 62 }
63 } 63 }
64 AddSeparator(); 64 AddSeparator(ui::NORMAL_SEPARATOR);
65 } 65 }
66 AddCheckItemWithStringId( 66 AddCheckItemWithStringId(
67 MENU_AUTO_HIDE, ash::LauncherContextMenu::GetAutoHideResourceStringId()); 67 MENU_AUTO_HIDE, ash::LauncherContextMenu::GetAutoHideResourceStringId());
68 if (CommandLine::ForCurrentProcess()->HasSwitch( 68 if (CommandLine::ForCurrentProcess()->HasSwitch(
69 switches::kShowLauncherAlignmentMenu)) { 69 switches::kShowLauncherAlignmentMenu)) {
70 AddSubMenuWithStringId(MENU_ALIGNMENT_MENU, 70 AddSubMenuWithStringId(MENU_ALIGNMENT_MENU,
71 IDS_AURA_LAUNCHER_CONTEXT_MENU_POSITION, 71 IDS_AURA_LAUNCHER_CONTEXT_MENU_POSITION,
72 &alignment_menu_); 72 &alignment_menu_);
73 } 73 }
74 } 74 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 case MENU_NEW_WINDOW: 147 case MENU_NEW_WINDOW:
148 controller_->CreateNewWindow(); 148 controller_->CreateNewWindow();
149 break; 149 break;
150 case MENU_NEW_INCOGNITO_WINDOW: 150 case MENU_NEW_INCOGNITO_WINDOW:
151 controller_->CreateNewIncognitoWindow(); 151 controller_->CreateNewIncognitoWindow();
152 break; 152 break;
153 case MENU_ALIGNMENT_MENU: 153 case MENU_ALIGNMENT_MENU:
154 break; 154 break;
155 } 155 }
156 } 156 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698