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

Side by Side Diff: ash/shell_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 | « ash/shell_context_menu.h ('k') | chrome/browser/ui/ash/launcher/launcher_context_menu.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ash/shell_context_menu.h"
6
7 #include "ash/desktop_background/desktop_background_controller.h"
8 #include "ash/display/display_controller.h"
9 #include "ash/shell.h"
10 #include "grit/ash_strings.h"
11 #include "ui/aura/window.h"
12 #include "ui/base/l10n/l10n_util.h"
13 #include "ui/views/controls/menu/menu_model_adapter.h"
14 #include "ui/views/controls/menu/menu_runner.h"
15 #include "ui/views/widget/widget.h"
16
17 namespace ash {
18 namespace internal {
19
20 ShellContextMenu::ShellContextMenu() {
21 }
22
23 ShellContextMenu::~ShellContextMenu() {
24 }
25
26 void ShellContextMenu::ShowMenu(views::Widget* widget,
27 const gfx::Point& location) {
28 ui::SimpleMenuModel menu_model(this);
29 menu_model.AddItem(MENU_CHANGE_WALLPAPER,
30 l10n_util::GetStringUTF16(IDS_AURA_SET_DESKTOP_WALLPAPER));
31 views::MenuModelAdapter menu_model_adapter(&menu_model);
32 menu_runner_.reset(new views::MenuRunner(menu_model_adapter.CreateMenu()));
33 if (menu_runner_->RunMenuAt(
34 widget, NULL, gfx::Rect(location, gfx::Size()),
35 views::MenuItemView::TOPLEFT, views::MenuRunner::HAS_MNEMONICS |
36 views::MenuRunner::CONTEXT_MENU) == views::MenuRunner::MENU_DELETED)
37 return;
38 }
39
40 bool ShellContextMenu::IsCommandIdChecked(int command_id) const {
41 return false;
42 }
43
44 bool ShellContextMenu::IsCommandIdEnabled(int command_id) const {
45 switch (static_cast<MenuItem>(command_id)) {
46 case MENU_CHANGE_WALLPAPER: {
47 return Shell::GetInstance()->user_wallpaper_delegate()->
48 CanOpenSetWallpaperPage();
49 }
50 default:
51 return true;
52 }
53 }
54
55 void ShellContextMenu::ExecuteCommand(int command_id) {
56 switch (static_cast<MenuItem>(command_id)) {
57 case MENU_CHANGE_WALLPAPER: {
58 Shell::GetInstance()->user_wallpaper_delegate()->
59 OpenSetWallpaperPage();
60 break;
61 }
62 }
63 }
64
65 bool ShellContextMenu::GetAcceleratorForCommandId(
66 int command_id,
67 ui::Accelerator* accelerator) {
68 return false;
69 }
70
71 } // namespace internal
72 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shell_context_menu.h ('k') | chrome/browser/ui/ash/launcher/launcher_context_menu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698