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

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

Issue 11092034: Add Wallpaper option to launcher context menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Whitespace, Null Check, Comment Update Created 8 years, 2 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
« no previous file with comments | « chrome/browser/ui/ash/launcher/launcher_context_menu.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/desktop_background/desktop_background_controller.h"
7 #include "ash/launcher/launcher_context_menu.h" 8 #include "ash/launcher/launcher_context_menu.h"
8 #include "ash/shell.h" 9 #include "ash/shell.h"
9 #include "base/command_line.h" 10 #include "base/command_line.h"
10 #include "chrome/browser/extensions/context_menu_matcher.h" 11 #include "chrome/browser/extensions/context_menu_matcher.h"
11 #include "chrome/browser/extensions/extension_prefs.h" 12 #include "chrome/browser/extensions/extension_prefs.h"
12 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 13 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
13 #include "chrome/common/chrome_switches.h" 14 #include "chrome/common/chrome_switches.h"
14 #include "content/public/common/context_menu_params.h" 15 #include "content/public/common/context_menu_params.h"
15 #include "grit/ash_strings.h" 16 #include "grit/ash_strings.h"
16 #include "grit/generated_resources.h" 17 #include "grit/generated_resources.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 93 }
93 } 94 }
94 AddCheckItemWithStringId( 95 AddCheckItemWithStringId(
95 MENU_AUTO_HIDE, ash::LauncherContextMenu::GetAutoHideResourceStringId()); 96 MENU_AUTO_HIDE, ash::LauncherContextMenu::GetAutoHideResourceStringId());
96 if (CommandLine::ForCurrentProcess()->HasSwitch( 97 if (CommandLine::ForCurrentProcess()->HasSwitch(
97 switches::kShowLauncherAlignmentMenu)) { 98 switches::kShowLauncherAlignmentMenu)) {
98 AddSubMenuWithStringId(MENU_ALIGNMENT_MENU, 99 AddSubMenuWithStringId(MENU_ALIGNMENT_MENU,
99 IDS_AURA_LAUNCHER_CONTEXT_MENU_POSITION, 100 IDS_AURA_LAUNCHER_CONTEXT_MENU_POSITION,
100 &alignment_menu_); 101 &alignment_menu_);
101 } 102 }
103 AddItem(MENU_CHANGE_WALLPAPER,
104 l10n_util::GetStringUTF16(IDS_AURA_SET_DESKTOP_WALLPAPER));
102 } 105 }
103 106
104 LauncherContextMenu::~LauncherContextMenu() { 107 LauncherContextMenu::~LauncherContextMenu() {
105 } 108 }
106 109
107 bool LauncherContextMenu::IsCommandIdChecked(int command_id) const { 110 bool LauncherContextMenu::IsCommandIdChecked(int command_id) const {
108 switch (command_id) { 111 switch (command_id) {
109 case LAUNCH_TYPE_PINNED_TAB: 112 case LAUNCH_TYPE_PINNED_TAB:
110 return controller_->GetLaunchType(item_.id) == 113 return controller_->GetLaunchType(item_.id) ==
111 extensions::ExtensionPrefs::LAUNCH_PINNED; 114 extensions::ExtensionPrefs::LAUNCH_PINNED;
(...skipping 11 matching lines...) Expand all
123 default: 126 default:
124 return extension_items_->IsCommandIdChecked(command_id); 127 return extension_items_->IsCommandIdChecked(command_id);
125 } 128 }
126 } 129 }
127 130
128 bool LauncherContextMenu::IsCommandIdEnabled(int command_id) const { 131 bool LauncherContextMenu::IsCommandIdEnabled(int command_id) const {
129 switch (command_id) { 132 switch (command_id) {
130 case MENU_PIN: 133 case MENU_PIN:
131 return item_.type == ash::TYPE_PLATFORM_APP || 134 return item_.type == ash::TYPE_PLATFORM_APP ||
132 controller_->IsPinnable(item_.id); 135 controller_->IsPinnable(item_.id);
136 case MENU_CHANGE_WALLPAPER:
137 return ash::Shell::GetInstance()->user_wallpaper_delegate()->
138 CanOpenSetWallpaperPage();
133 default: 139 default:
134 return extension_items_->IsCommandIdEnabled(command_id); 140 return extension_items_->IsCommandIdEnabled(command_id);
135 } 141 }
136 } 142 }
137 143
138 bool LauncherContextMenu::GetAcceleratorForCommandId( 144 bool LauncherContextMenu::GetAcceleratorForCommandId(
139 int command_id, 145 int command_id,
140 ui::Accelerator* accelerator) { 146 ui::Accelerator* accelerator) {
141 return false; 147 return false;
142 } 148 }
(...skipping 30 matching lines...) Expand all
173 ash::LauncherContextMenu::GetToggledAutoHideBehavior()); 179 ash::LauncherContextMenu::GetToggledAutoHideBehavior());
174 break; 180 break;
175 case MENU_NEW_WINDOW: 181 case MENU_NEW_WINDOW:
176 controller_->CreateNewWindow(); 182 controller_->CreateNewWindow();
177 break; 183 break;
178 case MENU_NEW_INCOGNITO_WINDOW: 184 case MENU_NEW_INCOGNITO_WINDOW:
179 controller_->CreateNewIncognitoWindow(); 185 controller_->CreateNewIncognitoWindow();
180 break; 186 break;
181 case MENU_ALIGNMENT_MENU: 187 case MENU_ALIGNMENT_MENU:
182 break; 188 break;
189 case MENU_CHANGE_WALLPAPER:
190 ash::Shell::GetInstance()->user_wallpaper_delegate()->
191 OpenSetWallpaperPage();
192 break;
183 default: 193 default:
184 extension_items_->ExecuteCommand(command_id, NULL, 194 extension_items_->ExecuteCommand(command_id, NULL,
185 content::ContextMenuParams()); 195 content::ContextMenuParams());
186 } 196 }
187 } 197 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/launcher/launcher_context_menu.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698