summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authormsw <msw@chromium.org>2016-03-17 17:33:29 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-18 00:34:21 +0000
commit953caf1fc83c06ef7a4da9661f3350faec8a82f6 (patch)
tree5d5861b4eee5bd3d60aee7708396ac83284c229c /ash
parentb2e7c4fc8d86ee2de5b8b8a11184be35e7fa0c09 (diff)
downloadchromium_src-953caf1fc83c06ef7a4da9661f3350faec8a82f6.zip
chromium_src-953caf1fc83c06ef7a4da9661f3350faec8a82f6.tar.gz
chromium_src-953caf1fc83c06ef7a4da9661f3350faec8a82f6.tar.bz2
Pass shelf instances, not root windows, for ash context menus.
Avoid most window->shelf lookup calls; misc cleanup. Remove some ChromeLauncherController auto-hide functions. (inline pref lookup function call, context menu ops) Add Shell::OnShelfAlignmentChanged to revise set pattern. (support ShelfLayoutManager::SetAlignment, w/o Shell::SetShelfAlignment) Prerequisite for https://codereview.chromium.org/1760743002 BUG=557406 TEST=No behavior changes or regressions. R=sky@chromium.org Review URL: https://codereview.chromium.org/1812013003 Cr-Commit-Position: refs/heads/master@{#381849}
Diffstat (limited to 'ash')
-rw-r--r--ash/mus/shell_delegate_mus.cc2
-rw-r--r--ash/mus/shell_delegate_mus.h2
-rw-r--r--ash/root_window_controller.cc2
-rw-r--r--ash/shelf/shelf.cc8
-rw-r--r--ash/shelf/shelf.h4
-rw-r--r--ash/shelf/shelf_alignment_menu.cc36
-rw-r--r--ash/shelf/shelf_alignment_menu.h10
-rw-r--r--ash/shelf/shelf_layout_manager.cc24
-rw-r--r--ash/shelf/shelf_layout_manager.h14
-rw-r--r--ash/shelf/shelf_view.cc3
-rw-r--r--ash/shell.cc12
-rw-r--r--ash/shell.h8
-rw-r--r--ash/shell/context_menu.cc42
-rw-r--r--ash/shell/context_menu.h15
-rw-r--r--ash/shell/shell_delegate_impl.cc4
-rw-r--r--ash/shell/shell_delegate_impl.h2
-rw-r--r--ash/shell_delegate.h5
-rw-r--r--ash/test/test_shell_delegate.cc2
-rw-r--r--ash/test/test_shell_delegate.h2
19 files changed, 89 insertions, 108 deletions
diff --git a/ash/mus/shell_delegate_mus.cc b/ash/mus/shell_delegate_mus.cc
index 4aa6e13..7f627e1 100644
--- a/ash/mus/shell_delegate_mus.cc
+++ b/ash/mus/shell_delegate_mus.cc
@@ -197,7 +197,7 @@ MediaDelegate* ShellDelegateMus::CreateMediaDelegate() {
return new MediaDelegateStub;
}
-ui::MenuModel* ShellDelegateMus::CreateContextMenu(aura::Window* root_window,
+ui::MenuModel* ShellDelegateMus::CreateContextMenu(ash::Shelf* shelf,
const ShelfItem* item) {
NOTIMPLEMENTED();
return nullptr;
diff --git a/ash/mus/shell_delegate_mus.h b/ash/mus/shell_delegate_mus.h
index f0486ab..804663d 100644
--- a/ash/mus/shell_delegate_mus.h
+++ b/ash/mus/shell_delegate_mus.h
@@ -46,7 +46,7 @@ class ShellDelegateMus : public ash::ShellDelegate {
ash::AccessibilityDelegate* CreateAccessibilityDelegate() override;
ash::NewWindowDelegate* CreateNewWindowDelegate() override;
ash::MediaDelegate* CreateMediaDelegate() override;
- ui::MenuModel* CreateContextMenu(aura::Window* root_window,
+ ui::MenuModel* CreateContextMenu(ash::Shelf* shelf,
const ash::ShelfItem* item) override;
GPUSupport* CreateGPUSupport() override;
base::string16 GetProductName() const override;
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc
index 4d021bf..a2d8219 100644
--- a/ash/root_window_controller.cc
+++ b/ash/root_window_controller.cc
@@ -561,7 +561,7 @@ void RootWindowController::ShowContextMenu(const gfx::Point& location_in_screen,
ShellDelegate* delegate = Shell::GetInstance()->delegate();
DCHECK(delegate);
scoped_ptr<ui::MenuModel> menu_model(
- delegate->CreateContextMenu(GetRootWindow(), nullptr));
+ delegate->CreateContextMenu(shelf_->shelf(), nullptr));
if (!menu_model)
return;
diff --git a/ash/shelf/shelf.cc b/ash/shelf/shelf.cc
index 18dd34a..58904c4 100644
--- a/ash/shelf/shelf.cc
+++ b/ash/shelf/shelf.cc
@@ -79,6 +79,14 @@ bool Shelf::IsHorizontalAlignment() const {
alignment_ == SHELF_ALIGNMENT_TOP;
}
+void Shelf::SetAutoHideBehavior(ShelfAutoHideBehavior behavior) {
+ shelf_widget_->shelf_layout_manager()->SetAutoHideBehavior(behavior);
+}
+
+ShelfAutoHideBehavior Shelf::GetAutoHideBehavior() const {
+ return shelf_widget_->shelf_layout_manager()->auto_hide_behavior();
+}
+
gfx::Rect Shelf::GetScreenBoundsOfItemIconForWindow(
const aura::Window* window) {
ShelfID id = GetShelfIDForWindow(window);
diff --git a/ash/shelf/shelf.h b/ash/shelf/shelf.h
index 597dd37..f884458 100644
--- a/ash/shelf/shelf.h
+++ b/ash/shelf/shelf.h
@@ -60,6 +60,10 @@ class ASH_EXPORT Shelf {
ShelfAlignment alignment() const { return alignment_; }
bool IsHorizontalAlignment() const;
+ // Sets the ShelfAutoHideBehavior. See enum description for details.
+ void SetAutoHideBehavior(ShelfAutoHideBehavior behavior);
+ ShelfAutoHideBehavior GetAutoHideBehavior() const;
+
// A helper functions that chooses values specific to a shelf alignment.
template <typename T>
T SelectValueForShelfAlignment(T bottom, T left, T right, T top) const {
diff --git a/ash/shelf/shelf_alignment_menu.cc b/ash/shelf/shelf_alignment_menu.cc
index 5b14e8f..6d67ed4 100644
--- a/ash/shelf/shelf_alignment_menu.cc
+++ b/ash/shelf/shelf_alignment_menu.cc
@@ -6,17 +6,18 @@
#include "ash/metrics/user_metrics_recorder.h"
#include "ash/shelf/shelf.h"
+#include "ash/shelf/shelf_layout_manager.h"
#include "ash/shelf/shelf_types.h"
+#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
#include "grit/ash_strings.h"
#include "ui/aura/window.h"
namespace ash {
-ShelfAlignmentMenu::ShelfAlignmentMenu(aura::Window* root)
- : ui::SimpleMenuModel(NULL),
- root_window_(root) {
- DCHECK(root_window_);
+ShelfAlignmentMenu::ShelfAlignmentMenu(Shelf* shelf)
+ : ui::SimpleMenuModel(nullptr), shelf_(shelf) {
+ DCHECK(shelf_);
int align_group_id = 1;
set_delegate(this);
AddRadioItemWithStringId(MENU_ALIGN_LEFT,
@@ -33,10 +34,9 @@ ShelfAlignmentMenu::ShelfAlignmentMenu(aura::Window* root)
ShelfAlignmentMenu::~ShelfAlignmentMenu() {}
bool ShelfAlignmentMenu::IsCommandIdChecked(int command_id) const {
- return Shelf::ForWindow(root_window_)
- ->SelectValueForShelfAlignment(MENU_ALIGN_BOTTOM == command_id,
- MENU_ALIGN_LEFT == command_id,
- MENU_ALIGN_RIGHT == command_id, false);
+ return shelf_->SelectValueForShelfAlignment(
+ MENU_ALIGN_BOTTOM == command_id, MENU_ALIGN_LEFT == command_id,
+ MENU_ALIGN_RIGHT == command_id, false);
}
bool ShelfAlignmentMenu::IsCommandIdEnabled(int command_id) const {
@@ -50,24 +50,20 @@ bool ShelfAlignmentMenu::GetAcceleratorForCommandId(
}
void ShelfAlignmentMenu::ExecuteCommand(int command_id, int event_flags) {
+ Shell* shell = Shell::GetInstance();
+ ShelfLayoutManager* manager = shelf_->shelf_widget()->shelf_layout_manager();
switch (static_cast<MenuItem>(command_id)) {
case MENU_ALIGN_LEFT:
- Shell::GetInstance()->metrics()->
- RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_LEFT);
- Shell::GetInstance()->SetShelfAlignment(SHELF_ALIGNMENT_LEFT,
- root_window_);
+ shell->metrics()->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_LEFT);
+ manager->SetAlignment(SHELF_ALIGNMENT_LEFT);
break;
case MENU_ALIGN_BOTTOM:
- Shell::GetInstance()->metrics()->
- RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_BOTTOM);
- Shell::GetInstance()->SetShelfAlignment(SHELF_ALIGNMENT_BOTTOM,
- root_window_);
+ shell->metrics()->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_BOTTOM);
+ manager->SetAlignment(SHELF_ALIGNMENT_BOTTOM);
break;
case MENU_ALIGN_RIGHT:
- Shell::GetInstance()->metrics()->
- RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_RIGHT);
- Shell::GetInstance()->SetShelfAlignment(SHELF_ALIGNMENT_RIGHT,
- root_window_);
+ shell->metrics()->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_RIGHT);
+ manager->SetAlignment(SHELF_ALIGNMENT_RIGHT);
break;
}
}
diff --git a/ash/shelf/shelf_alignment_menu.h b/ash/shelf/shelf_alignment_menu.h
index add20f0..98d1eef 100644
--- a/ash/shelf/shelf_alignment_menu.h
+++ b/ash/shelf/shelf_alignment_menu.h
@@ -9,17 +9,15 @@
#include "base/macros.h"
#include "ui/base/models/simple_menu_model.h"
-namespace aura {
-class RootWindow;
-}
-
namespace ash {
+class Shelf;
+
// Submenu for choosing the alignment of the launcher.
class ASH_EXPORT ShelfAlignmentMenu : public ui::SimpleMenuModel,
public ui::SimpleMenuModel::Delegate {
public:
- explicit ShelfAlignmentMenu(aura::Window* root);
+ explicit ShelfAlignmentMenu(Shelf* shelf);
~ShelfAlignmentMenu() override;
// ui::SimpleMenuModel::Delegate overrides:
@@ -37,7 +35,7 @@ class ASH_EXPORT ShelfAlignmentMenu : public ui::SimpleMenuModel,
MENU_ALIGN_BOTTOM,
};
- aura::Window* root_window_;
+ Shelf* shelf_;
DISALLOW_COPY_AND_ASSIGN(ShelfAlignmentMenu);
};
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc
index 2509d47..8b779fd 100644
--- a/ash/shelf/shelf_layout_manager.cc
+++ b/ash/shelf/shelf_layout_manager.cc
@@ -247,21 +247,20 @@ bool ShelfLayoutManager::IsVisible() const {
state_.auto_hide_state == SHELF_AUTO_HIDE_SHOWN));
}
-bool ShelfLayoutManager::SetAlignment(ShelfAlignment alignment) {
+void ShelfLayoutManager::SetAlignment(ShelfAlignment alignment) {
if (alignment_ == alignment)
- return false;
+ return;
alignment_ = alignment;
// The shelf will itself move to the bottom while locked or obscured by user
// login. If a request is sent to move while being obscured, we postpone the
// move until the user session is resumed.
- if (IsAlignmentLocked())
- return false;
-
- // This should not be called during the lock screen transitions.
- shelf_->SetAlignment(alignment);
- LayoutShelf();
- return true;
+ if (!IsAlignmentLocked()) {
+ shelf_->SetAlignment(alignment);
+ LayoutShelf();
+ Shell::GetInstance()->OnShelfAlignmentChanged(
+ shelf_->GetNativeWindow()->GetRootWindow());
+ }
}
ShelfAlignment ShelfLayoutManager::GetAlignment() const {
@@ -296,11 +295,6 @@ void ShelfLayoutManager::LayoutShelf() {
ShelfVisibilityState ShelfLayoutManager::CalculateShelfVisibility() {
switch(auto_hide_behavior_) {
case SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS:
-#if defined(OS_WIN)
- // Disable shelf auto-hide behavior on screen sides in Metro mode.
- if (GetAlignment() != SHELF_ALIGNMENT_BOTTOM)
- return SHELF_VISIBLE;
-#endif
return SHELF_AUTO_HIDE;
case SHELF_AUTO_HIDE_BEHAVIOR_NEVER:
return SHELF_VISIBLE;
@@ -1149,6 +1143,8 @@ void ShelfLayoutManager::UpdateShelfVisibilityAfterLoginUIChange() {
shelf_->SetAlignment(GetAlignment());
UpdateVisibilityState();
LayoutShelf();
+ Shell::GetInstance()->OnShelfAlignmentChanged(
+ shelf_->GetNativeWindow()->GetRootWindow());
}
bool ShelfLayoutManager::IsAlignmentLocked() const {
diff --git a/ash/shelf/shelf_layout_manager.h b/ash/shelf/shelf_layout_manager.h
index 3f21f004..ae4a281 100644
--- a/ash/shelf/shelf_layout_manager.h
+++ b/ash/shelf/shelf_layout_manager.h
@@ -90,16 +90,11 @@ class ASH_EXPORT ShelfLayoutManager
return auto_hide_behavior_;
}
- // Sets the alignment. Returns true if the alignment got changed. If nothing
- // has visually be changed, false will be returned. This can happen if either
- // the alignment was already set, or the shelf is currently locked and cannot
- // be changed at this time. In the latter case the change will be performed
- // once the shelf gets unlocked.
- bool SetAlignment(ShelfAlignment alignment);
+ // Sets the alignment; changes are delayed if the screen is locked.
+ void SetAlignment(ShelfAlignment alignment);
// Returns the desired alignment for the current state, either the user's
- // set alignment (alignment_) or SHELF_ALIGNMENT_BOTTOM when the screen
- // is locked.
+ // selected alignment or SHELF_ALIGNMENT_BOTTOM when the screen is locked.
ShelfAlignment GetAlignment() const;
void set_workspace_controller(WorkspaceController* controller) {
@@ -127,8 +122,7 @@ class ASH_EXPORT ShelfLayoutManager
return user_work_area_bounds_;
}
- // Stops any animations and sets the bounds of the shelf and status
- // widgets.
+ // Stops any animations and sets the bounds of the shelf and status widgets.
void LayoutShelf();
// Returns shelf visibility state based on current value of auto hide
diff --git a/ash/shelf/shelf_view.cc b/ash/shelf/shelf_view.cc
index 9088f6c..d15cccd 100644
--- a/ash/shelf/shelf_view.cc
+++ b/ash/shelf/shelf_view.cc
@@ -1794,8 +1794,7 @@ void ShelfView::ShowContextMenuForView(views::View* source,
}
context_menu_model_.reset(Shell::GetInstance()->delegate()->CreateContextMenu(
- source->GetWidget()->GetNativeView()->GetRootWindow(),
- &model_->items()[view_index]));
+ shelf_, &model_->items()[view_index]));
if (!context_menu_model_)
return;
diff --git a/ash/shell.cc b/ash/shell.cc
index 6949d6c..71231a2 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -523,17 +523,19 @@ ShelfAutoHideBehavior Shell::GetShelfAutoHideBehavior(
void Shell::SetShelfAlignment(ShelfAlignment alignment,
aura::Window* root_window) {
ShelfWidget* shelf_widget = GetRootWindowController(root_window)->shelf();
- if (shelf_widget->shelf_layout_manager()->SetAlignment(alignment)) {
- FOR_EACH_OBSERVER(
- ShellObserver, observers_, OnShelfAlignmentChanged(root_window));
- }
+ shelf_widget->shelf_layout_manager()->SetAlignment(alignment);
}
-ShelfAlignment Shell::GetShelfAlignment(const aura::Window* root_window) {
+ShelfAlignment Shell::GetShelfAlignment(const aura::Window* root_window) const {
ShelfWidget* shelf_widget = GetRootWindowController(root_window)->shelf();
return shelf_widget->shelf_layout_manager()->GetAlignment();
}
+void Shell::OnShelfAlignmentChanged(aura::Window* root_window) {
+ FOR_EACH_OBSERVER(ShellObserver, observers_,
+ OnShelfAlignmentChanged(root_window));
+}
+
void Shell::NotifyFullscreenStateChange(bool is_fullscreen,
aura::Window* root_window) {
FOR_EACH_OBSERVER(ShellObserver, observers_, OnFullscreenStateChanged(
diff --git a/ash/shell.h b/ash/shell.h
index 74d0f12..fbd85b8 100644
--- a/ash/shell.h
+++ b/ash/shell.h
@@ -463,9 +463,11 @@ class ASH_EXPORT Shell : public SystemModalContainerEventFilterDelegate,
aura::Window* root_window) const;
// Sets/gets shelf's alignment on |root_window|.
- void SetShelfAlignment(ShelfAlignment alignment,
- aura::Window* root_window);
- ShelfAlignment GetShelfAlignment(const aura::Window* root_window);
+ void SetShelfAlignment(ShelfAlignment alignment, aura::Window* root_window);
+ ShelfAlignment GetShelfAlignment(const aura::Window* root_window) const;
+
+ // Called when the alignment for a shelf changes.
+ void OnShelfAlignmentChanged(aura::Window* root_window);
// Notifies |observers_| when entering or exiting fullscreen mode in
// |root_window|.
diff --git a/ash/shell/context_menu.cc b/ash/shell/context_menu.cc
index 91f5abd..c07c547 100644
--- a/ash/shell/context_menu.cc
+++ b/ash/shell/context_menu.cc
@@ -4,20 +4,16 @@
#include "ash/shell/context_menu.h"
-#include "ash/root_window_controller.h"
#include "ash/shelf/shelf.h"
#include "ash/shelf/shelf_types.h"
-#include "ash/shell.h"
#include "grit/ash_strings.h"
namespace ash {
namespace shell {
-ContextMenu::ContextMenu(aura::Window* root)
- : ui::SimpleMenuModel(NULL),
- root_window_(root),
- alignment_menu_(root) {
- DCHECK(root_window_);
+ContextMenu::ContextMenu(ash::Shelf* shelf)
+ : ui::SimpleMenuModel(nullptr), shelf_(shelf), alignment_menu_(shelf) {
+ DCHECK(shelf_);
set_delegate(this);
AddCheckItemWithStringId(MENU_AUTO_HIDE,
IDS_ASH_SHELF_CONTEXT_MENU_AUTO_HIDE);
@@ -30,38 +26,26 @@ ContextMenu::~ContextMenu() {
}
bool ContextMenu::IsCommandIdChecked(int command_id) const {
- switch (command_id) {
- case MENU_AUTO_HIDE:
- return Shell::GetInstance()->GetShelfAutoHideBehavior(root_window_) ==
- ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS;
- default:
- return false;
- }
+ if (command_id == MENU_AUTO_HIDE)
+ return shelf_->GetAutoHideBehavior() == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS;
+ return false;
}
bool ContextMenu::IsCommandIdEnabled(int command_id) const {
return true;
}
-bool ContextMenu::GetAcceleratorForCommandId(
- int command_id,
- ui::Accelerator* accelerator) {
+bool ContextMenu::GetAcceleratorForCommandId(int command_id,
+ ui::Accelerator* accelerator) {
return false;
}
void ContextMenu::ExecuteCommand(int command_id, int event_flags) {
- Shell* shell = Shell::GetInstance();
- switch (static_cast<MenuItem>(command_id)) {
- case MENU_AUTO_HIDE:
- shell->SetShelfAutoHideBehavior(
- shell->GetShelfAutoHideBehavior(root_window_) ==
- SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS ?
- SHELF_AUTO_HIDE_BEHAVIOR_NEVER :
- SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS,
- root_window_);
- break;
- case MENU_ALIGNMENT_MENU:
- break;
+ if (command_id == MENU_AUTO_HIDE) {
+ shelf_->SetAutoHideBehavior(shelf_->GetAutoHideBehavior() ==
+ SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS
+ ? SHELF_AUTO_HIDE_BEHAVIOR_NEVER
+ : SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
}
}
diff --git a/ash/shell/context_menu.h b/ash/shell/context_menu.h
index 072e457..b604884 100644
--- a/ash/shell/context_menu.h
+++ b/ash/shell/context_menu.h
@@ -6,22 +6,20 @@
#define ASH_SHELL_CONTEXT_MENU_H_
#include "ash/shelf/shelf_alignment_menu.h"
-#include "ash/shelf/shelf_types.h"
#include "base/macros.h"
#include "ui/base/models/simple_menu_model.h"
-namespace aura {
-class RootWindow;
-}
-
namespace ash {
+
+class Shelf;
+
namespace shell {
-// Context menu for the ash_shell.
+// Context menu for the ash shell.
class ContextMenu : public ui::SimpleMenuModel,
public ui::SimpleMenuModel::Delegate {
public:
- explicit ContextMenu(aura::Window* root);
+ explicit ContextMenu(Shelf* shelf);
~ContextMenu() override;
// ui::SimpleMenuModel::Delegate overrides:
@@ -37,8 +35,7 @@ class ContextMenu : public ui::SimpleMenuModel,
MENU_ALIGNMENT_MENU,
};
- aura::Window* root_window_;
-
+ Shelf* shelf_;
ShelfAlignmentMenu alignment_menu_;
DISALLOW_COPY_AND_ASSIGN(ContextMenu);
diff --git a/ash/shell/shell_delegate_impl.cc b/ash/shell/shell_delegate_impl.cc
index d996a22..7353976 100644
--- a/ash/shell/shell_delegate_impl.cc
+++ b/ash/shell/shell_delegate_impl.cc
@@ -225,9 +225,9 @@ ash::MediaDelegate* ShellDelegateImpl::CreateMediaDelegate() {
}
ui::MenuModel* ShellDelegateImpl::CreateContextMenu(
- aura::Window* root_window,
+ ash::Shelf* shelf,
const ash::ShelfItem* item) {
- return new ContextMenu(root_window);
+ return new ContextMenu(shelf);
}
GPUSupport* ShellDelegateImpl::CreateGPUSupport() {
diff --git a/ash/shell/shell_delegate_impl.h b/ash/shell/shell_delegate_impl.h
index c53c702..7a5684b 100644
--- a/ash/shell/shell_delegate_impl.h
+++ b/ash/shell/shell_delegate_impl.h
@@ -48,7 +48,7 @@ class ShellDelegateImpl : public ash::ShellDelegate {
ash::AccessibilityDelegate* CreateAccessibilityDelegate() override;
ash::NewWindowDelegate* CreateNewWindowDelegate() override;
ash::MediaDelegate* CreateMediaDelegate() override;
- ui::MenuModel* CreateContextMenu(aura::Window* root_window,
+ ui::MenuModel* CreateContextMenu(ash::Shelf* shelf,
const ash::ShelfItem* item) override;
GPUSupport* CreateGPUSupport() override;
base::string16 GetProductName() const override;
diff --git a/ash/shell_delegate.h b/ash/shell_delegate.h
index cd36fd4..6569688 100644
--- a/ash/shell_delegate.h
+++ b/ash/shell_delegate.h
@@ -42,6 +42,7 @@ class ShelfDelegate;
class ShelfModel;
class SystemTrayDelegate;
class UserWallpaperDelegate;
+class Shelf;
struct ShelfItem;
class ASH_EXPORT VirtualKeyboardStateObserver {
@@ -132,9 +133,9 @@ class ASH_EXPORT ShellDelegate {
// Creates a media delegate. Shell takes ownership of the delegate.
virtual MediaDelegate* CreateMediaDelegate() = 0;
- // Creates a menu model for the |root_window| and optional shelf |item|.
+ // Creates a menu model for the |shelf| and optional shelf |item|.
// If |item| is null, this creates a context menu for the desktop or shelf.
- virtual ui::MenuModel* CreateContextMenu(aura::Window* root_window,
+ virtual ui::MenuModel* CreateContextMenu(ash::Shelf* shelf,
const ash::ShelfItem* item) = 0;
// Creates a GPU support object. Shell takes ownership of the object.
diff --git a/ash/test/test_shell_delegate.cc b/ash/test/test_shell_delegate.cc
index b5d7fc0..c0bbcbd 100644
--- a/ash/test/test_shell_delegate.cc
+++ b/ash/test/test_shell_delegate.cc
@@ -175,7 +175,7 @@ MediaDelegate* TestShellDelegate::CreateMediaDelegate() {
}
ui::MenuModel* TestShellDelegate::CreateContextMenu(
- aura::Window* root_window,
+ ash::Shelf* shelf,
const ash::ShelfItem* item) {
return nullptr;
}
diff --git a/ash/test/test_shell_delegate.h b/ash/test/test_shell_delegate.h
index 80de3b7..18f2dfe 100644
--- a/ash/test/test_shell_delegate.h
+++ b/ash/test/test_shell_delegate.h
@@ -55,7 +55,7 @@ class TestShellDelegate : public ShellDelegate {
AccessibilityDelegate* CreateAccessibilityDelegate() override;
NewWindowDelegate* CreateNewWindowDelegate() override;
MediaDelegate* CreateMediaDelegate() override;
- ui::MenuModel* CreateContextMenu(aura::Window* root_window,
+ ui::MenuModel* CreateContextMenu(ash::Shelf* shelf,
const ash::ShelfItem* item) override;
GPUSupport* CreateGPUSupport() override;
base::string16 GetProductName() const override;