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

Side by Side Diff: ash/shell_context_menu.cc

Issue 10790090: Enable Virtual Screen Coordinates (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comments Created 8 years, 5 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.cc ('k') | ash/wm/stacking_controller.cc » ('j') | 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 "ash/shell_context_menu.h" 5 #include "ash/shell_context_menu.h"
6 6
7 #include "ash/desktop_background/desktop_background_controller.h" 7 #include "ash/desktop_background/desktop_background_controller.h"
8 #include "ash/display/display_controller.h" 8 #include "ash/display/display_controller.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "grit/ash_strings.h" 10 #include "grit/ash_strings.h"
11 #include "ui/aura/window.h" 11 #include "ui/aura/window.h"
12 #include "ui/base/l10n/l10n_util.h" 12 #include "ui/base/l10n/l10n_util.h"
13 #include "ui/views/controls/menu/menu_model_adapter.h" 13 #include "ui/views/controls/menu/menu_model_adapter.h"
14 #include "ui/views/controls/menu/menu_runner.h" 14 #include "ui/views/controls/menu/menu_runner.h"
15 #include "ui/views/widget/widget.h" 15 #include "ui/views/widget/widget.h"
16 16
17 namespace ash { 17 namespace ash {
18 namespace internal { 18 namespace internal {
19 19
20 ShellContextMenu::ShellContextMenu() { 20 ShellContextMenu::ShellContextMenu() {
21 } 21 }
22 22
23 ShellContextMenu::~ShellContextMenu() { 23 ShellContextMenu::~ShellContextMenu() {
24 } 24 }
25 25
26 void ShellContextMenu::ShowMenu(views::Widget* widget, 26 void ShellContextMenu::ShowMenu(views::Widget* widget,
27 const gfx::Point& location) { 27 const gfx::Point& location) {
28 if (!internal::DisplayController::IsVirtualScreenCoordinatesEnabled()) {
29 Shell::GetInstance()->set_active_root_window(
30 widget->GetNativeView()->GetRootWindow());
31 }
32
33 ui::SimpleMenuModel menu_model(this); 28 ui::SimpleMenuModel menu_model(this);
34 menu_model.AddItem(MENU_CHANGE_WALLPAPER, 29 menu_model.AddItem(MENU_CHANGE_WALLPAPER,
35 l10n_util::GetStringUTF16(IDS_AURA_SET_DESKTOP_WALLPAPER)); 30 l10n_util::GetStringUTF16(IDS_AURA_SET_DESKTOP_WALLPAPER));
36 views::MenuModelAdapter menu_model_adapter(&menu_model); 31 views::MenuModelAdapter menu_model_adapter(&menu_model);
37 menu_runner_.reset(new views::MenuRunner(menu_model_adapter.CreateMenu())); 32 menu_runner_.reset(new views::MenuRunner(menu_model_adapter.CreateMenu()));
38 if (menu_runner_->RunMenuAt( 33 if (menu_runner_->RunMenuAt(
39 widget, NULL, gfx::Rect(location, gfx::Size()), 34 widget, NULL, gfx::Rect(location, gfx::Size()),
40 views::MenuItemView::TOPLEFT, views::MenuRunner::HAS_MNEMONICS) == 35 views::MenuItemView::TOPLEFT, views::MenuRunner::HAS_MNEMONICS) ==
41 views::MenuRunner::MENU_DELETED) 36 views::MenuRunner::MENU_DELETED)
42 return; 37 return;
(...skipping 25 matching lines...) Expand all
68 } 63 }
69 64
70 bool ShellContextMenu::GetAcceleratorForCommandId( 65 bool ShellContextMenu::GetAcceleratorForCommandId(
71 int command_id, 66 int command_id,
72 ui::Accelerator* accelerator) { 67 ui::Accelerator* accelerator) {
73 return false; 68 return false;
74 } 69 }
75 70
76 } // namespace internal 71 } // namespace internal
77 } // namespace ash 72 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shell.cc ('k') | ash/wm/stacking_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698