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

Side by Side Diff: ash/shell_context_menu.cc

Issue 9960024: Remove "set wallpaper..." option in system context menu when guest logged in (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add shell context menu Created 8 years, 8 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
(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/shell.h"
9 #include "grit/ash_strings.h"
10 #include "ui/base/l10n/l10n_util.h"
11 #include "ui/views/controls/menu/menu_model_adapter.h"
12 #include "ui/views/controls/menu/menu_runner.h"
13
14 namespace ash {
15 namespace internal {
16
17 ShellContextMenu::ShellContextMenu() {
18 }
19
20 ShellContextMenu::~ShellContextMenu() {
21 }
22
23 void ShellContextMenu::ShowMenu(views::Widget* widget,
24 const gfx::Point& location) {
25 if (Shell::GetInstance()->user_wallpaper_delegate()->IsLoggedInAsGuest())
26 return;
27 ui::SimpleMenuModel menu_model(this);
28 menu_model.AddItem(MENU_CHANGE_WALLPAPER,
29 l10n_util::GetStringUTF16(IDS_AURA_SET_DESKTOP_WALLPAPER));
30 views::MenuModelAdapter menu_model_adapter(&menu_model);
31 menu_runner_.reset(new views::MenuRunner(menu_model_adapter.CreateMenu()));
32 if (menu_runner_->RunMenuAt(
33 widget, NULL, gfx::Rect(location, gfx::Size()),
34 views::MenuItemView::TOPRIGHT, views::MenuRunner::HAS_MNEMONICS) ==
35 views::MenuRunner::MENU_DELETED)
36 return;
37 }
38
39 bool ShellContextMenu::IsCommandIdChecked(int command_id) const {
40 return false;
41 }
42
43 bool ShellContextMenu::IsCommandIdEnabled(int command_id) const {
44 return true;
45 }
46
47 void ShellContextMenu::ExecuteCommand(int command_id) {
48 switch (static_cast<MenuItem>(command_id)) {
49 case MENU_CHANGE_WALLPAPER: {
50 Shell::GetInstance()->user_wallpaper_delegate()->
51 OpenSetWallpaperPage();
52 break;
53 }
54 }
55 }
56
57 bool ShellContextMenu::GetAcceleratorForCommandId(
58 int command_id,
59 ui::Accelerator* accelerator) {
60 return false;
61 }
62
63 } // namespace internal
64 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698