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

Unified Diff: ash/shelf/shelf.cc

Issue 1743493002: Cleanup ash shelf accessor functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert ash/shelf/shelf_widget.cc for browser_tests crash... Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/shelf/shelf.h ('k') | ash/shelf/shelf_alignment_menu.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shelf/shelf.cc
diff --git a/ash/shelf/shelf.cc b/ash/shelf/shelf.cc
index 0a02248586537f35ddb025793458a12f53c72db9..5cae789bd432150270272a5c97163dd8166c2ce6 100644
--- a/ash/shelf/shelf.cc
+++ b/ash/shelf/shelf.cc
@@ -18,7 +18,6 @@
#include "ash/shelf/shelf_navigator.h"
#include "ash/shelf/shelf_util.h"
#include "ash/shelf/shelf_view.h"
-#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
#include "ash/shell_delegate.h"
#include "ash/shell_window_ids.h"
@@ -47,8 +46,7 @@ Shelf::Shelf(ShelfModel* shelf_model,
alignment_(shelf_widget->GetAlignment()),
delegate_(shelf_delegate),
shelf_widget_(shelf_widget) {
- shelf_view_ = new ShelfView(
- shelf_model, delegate_, shelf_widget_->shelf_layout_manager());
+ shelf_view_ = new ShelfView(shelf_model, delegate_, this);
shelf_view_->Init();
shelf_widget_->GetContentsView()->AddChildView(shelf_view_);
shelf_widget_->GetNativeView()->SetName(kNativeViewName);
@@ -61,14 +59,12 @@ Shelf::~Shelf() {
// static
Shelf* Shelf::ForPrimaryDisplay() {
- ShelfWidget* shelf_widget =
- RootWindowController::ForShelf(Shell::GetPrimaryRootWindow())->shelf();
- return shelf_widget ? shelf_widget->shelf() : NULL;
+ return Shelf::ForWindow(Shell::GetPrimaryRootWindow());
}
// static
-Shelf* Shelf::ForWindow(aura::Window* window) {
- ShelfWidget* shelf_widget = RootWindowController::ForShelf(window)->shelf();
+Shelf* Shelf::ForWindow(const aura::Window* window) {
+ ShelfWidget* shelf_widget = RootWindowController::ForWindow(window)->shelf();
return shelf_widget ? shelf_widget->shelf() : NULL;
}
@@ -78,6 +74,11 @@ void Shelf::SetAlignment(ShelfAlignment alignment) {
// ShelfLayoutManager will resize the shelf.
}
+bool Shelf::IsHorizontalAlignment() const {
+ return alignment_ == SHELF_ALIGNMENT_BOTTOM ||
+ alignment_ == SHELF_ALIGNMENT_TOP;
+}
+
gfx::Rect Shelf::GetScreenBoundsOfItemIconForWindow(
const aura::Window* window) {
ShelfID id = GetShelfIDForWindow(window);
« no previous file with comments | « ash/shelf/shelf.h ('k') | ash/shelf/shelf_alignment_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698