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

Side by Side Diff: ash/shelf/shelf.cc

Issue 1914093002: Refactors DockedWindowLayoutManager in terms of ash/wm/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@nuke_aura_window
Patch Set: merge 2 trunk Created 4 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/shelf/shelf.h" 5 #include "ash/shelf/shelf.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "ash/focus_cycler.h" 10 #include "ash/focus_cycler.h"
11 #include "ash/root_window_controller.h" 11 #include "ash/root_window_controller.h"
12 #include "ash/screen_util.h" 12 #include "ash/screen_util.h"
13 #include "ash/shelf/shelf_delegate.h" 13 #include "ash/shelf/shelf_delegate.h"
14 #include "ash/shelf/shelf_item_delegate.h" 14 #include "ash/shelf/shelf_item_delegate.h"
15 #include "ash/shelf/shelf_item_delegate_manager.h" 15 #include "ash/shelf/shelf_item_delegate_manager.h"
16 #include "ash/shelf/shelf_layout_manager.h" 16 #include "ash/shelf/shelf_layout_manager.h"
17 #include "ash/shelf/shelf_model.h" 17 #include "ash/shelf/shelf_model.h"
18 #include "ash/shelf/shelf_navigator.h" 18 #include "ash/shelf/shelf_navigator.h"
19 #include "ash/shelf/shelf_util.h" 19 #include "ash/shelf/shelf_util.h"
20 #include "ash/shelf/shelf_view.h" 20 #include "ash/shelf/shelf_view.h"
21 #include "ash/shell.h" 21 #include "ash/shell.h"
22 #include "ash/shell_delegate.h" 22 #include "ash/shell_delegate.h"
23 #include "ash/shell_window_ids.h" 23 #include "ash/shell_window_ids.h"
24 #include "ash/wm/aura/wm_shelf_aura.h"
24 #include "ash/wm/window_properties.h" 25 #include "ash/wm/window_properties.h"
25 #include "ui/aura/window.h" 26 #include "ui/aura/window.h"
26 #include "ui/aura/window_event_dispatcher.h" 27 #include "ui/aura/window_event_dispatcher.h"
27 #include "ui/aura/window_observer.h" 28 #include "ui/aura/window_observer.h"
28 #include "ui/compositor/layer.h" 29 #include "ui/compositor/layer.h"
29 #include "ui/gfx/canvas.h" 30 #include "ui/gfx/canvas.h"
30 #include "ui/gfx/image/image.h" 31 #include "ui/gfx/image/image.h"
31 #include "ui/gfx/image/image_skia_operations.h" 32 #include "ui/gfx/image/image_skia_operations.h"
32 #include "ui/gfx/skbitmap_operations.h" 33 #include "ui/gfx/skbitmap_operations.h"
33 #include "ui/views/accessible_pane_view.h" 34 #include "ui/views/accessible_pane_view.h"
34 #include "ui/views/widget/widget.h" 35 #include "ui/views/widget/widget.h"
35 #include "ui/views/widget/widget_delegate.h" 36 #include "ui/views/widget/widget_delegate.h"
36 #include "ui/wm/public/activation_client.h" 37 #include "ui/wm/public/activation_client.h"
37 38
38 namespace ash { 39 namespace ash {
39 40
40 const char Shelf::kNativeViewName[] = "ShelfView"; 41 const char Shelf::kNativeViewName[] = "ShelfView";
41 42
42 Shelf::Shelf(ShelfModel* shelf_model, 43 Shelf::Shelf(ShelfModel* shelf_model,
43 ShelfDelegate* shelf_delegate, 44 ShelfDelegate* shelf_delegate,
44 ShelfWidget* shelf_widget) 45 ShelfWidget* shelf_widget)
45 : delegate_(shelf_delegate), 46 : delegate_(shelf_delegate),
46 shelf_widget_(shelf_widget), 47 shelf_widget_(shelf_widget),
47 shelf_view_(new ShelfView(shelf_model, delegate_, this)), 48 shelf_view_(new ShelfView(shelf_model, delegate_, this)),
48 shelf_locking_manager_(this) { 49 shelf_locking_manager_(this) {
49 shelf_view_->Init(); 50 shelf_view_->Init();
50 shelf_widget_->GetContentsView()->AddChildView(shelf_view_); 51 shelf_widget_->GetContentsView()->AddChildView(shelf_view_);
51 shelf_widget_->GetNativeView()->SetName(kNativeViewName); 52 shelf_widget_->GetNativeView()->SetName(kNativeViewName);
53 wm_shelf_.reset(new wm::WmShelfAura(this));
James Cook 2016/04/26 15:22:34 optional: Maybe comment why this has to be done at
sky 2016/04/26 16:26:02 Done.
52 } 54 }
53 55
54 Shelf::~Shelf() { 56 Shelf::~Shelf() {
55 delegate_->OnShelfDestroyed(this); 57 delegate_->OnShelfDestroyed(this);
56 } 58 }
57 59
58 // static 60 // static
59 Shelf* Shelf::ForPrimaryDisplay() { 61 Shelf* Shelf::ForPrimaryDisplay() {
60 return Shelf::ForWindow(Shell::GetPrimaryRootWindow()); 62 return Shelf::ForWindow(Shell::GetPrimaryRootWindow());
61 } 63 }
62 64
63 // static 65 // static
64 Shelf* Shelf::ForWindow(const aura::Window* window) { 66 Shelf* Shelf::ForWindow(const aura::Window* window) {
65 ShelfWidget* shelf_widget = RootWindowController::ForWindow(window)->shelf(); 67 ShelfWidget* shelf_widget = RootWindowController::ForWindow(window)->shelf();
66 return shelf_widget ? shelf_widget->shelf() : nullptr; 68 return shelf_widget ? shelf_widget->shelf() : nullptr;
67 } 69 }
68 70
69 void Shelf::SetAlignment(ShelfAlignment alignment) { 71 void Shelf::SetAlignment(wm::ShelfAlignment alignment) {
70 if (alignment_ == alignment) 72 if (alignment_ == alignment)
71 return; 73 return;
72 74
73 if (shelf_locking_manager_.is_locked() && 75 if (shelf_locking_manager_.is_locked() &&
74 alignment != SHELF_ALIGNMENT_BOTTOM_LOCKED) { 76 alignment != wm::SHELF_ALIGNMENT_BOTTOM_LOCKED) {
75 shelf_locking_manager_.set_stored_alignment(alignment); 77 shelf_locking_manager_.set_stored_alignment(alignment);
76 return; 78 return;
77 } 79 }
78 80
79 alignment_ = alignment; 81 alignment_ = alignment;
80 shelf_view_->OnShelfAlignmentChanged(); 82 shelf_view_->OnShelfAlignmentChanged();
81 shelf_widget_->OnShelfAlignmentChanged(); 83 shelf_widget_->OnShelfAlignmentChanged();
82 delegate_->OnShelfAlignmentChanged(this); 84 delegate_->OnShelfAlignmentChanged(this);
83 Shell::GetInstance()->OnShelfAlignmentChanged( 85 Shell::GetInstance()->OnShelfAlignmentChanged(
84 shelf_widget_->GetNativeWindow()->GetRootWindow()); 86 shelf_widget_->GetNativeWindow()->GetRootWindow());
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 205
204 gfx::Rect Shelf::GetVisibleItemsBoundsInScreen() const { 206 gfx::Rect Shelf::GetVisibleItemsBoundsInScreen() const {
205 return shelf_view_->GetVisibleItemsBoundsInScreen(); 207 return shelf_view_->GetVisibleItemsBoundsInScreen();
206 } 208 }
207 209
208 app_list::ApplicationDragAndDropHost* Shelf::GetDragAndDropHostForAppList() { 210 app_list::ApplicationDragAndDropHost* Shelf::GetDragAndDropHostForAppList() {
209 return shelf_view_; 211 return shelf_view_;
210 } 212 }
211 213
212 } // namespace ash 214 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698