| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/mus/bridge/wm_shelf_mus.h" | 5 #include "ash/mus/bridge/wm_shelf_mus.h" |
| 6 | 6 |
| 7 #include "ash/common/shelf/shelf_delegate.h" |
| 7 #include "ash/common/shell_window_ids.h" | 8 #include "ash/common/shell_window_ids.h" |
| 8 #include "ash/common/wm_root_window_controller.h" | 9 #include "ash/common/wm_root_window_controller.h" |
| 9 #include "ash/mus/bridge/wm_window_mus.h" | 10 #include "ash/common/wm_shell.h" |
| 10 #include "services/ui/public/cpp/window.h" | 11 #include "ash/common/wm_window.h" |
| 11 #include "ui/views/widget/widget.h" | 12 #include "ash/shelf/shelf.h" |
| 12 | 13 #include "ash/shelf/shelf_widget.h" |
| 13 // TODO(sky): fully implement this http://crbug.com/612631 . | |
| 14 #undef NOTIMPLEMENTED | |
| 15 #define NOTIMPLEMENTED() DVLOG(1) << "notimplemented" | |
| 16 | 14 |
| 17 namespace ash { | 15 namespace ash { |
| 18 namespace mus { | 16 namespace mus { |
| 19 | 17 |
| 20 WmShelfMus::WmShelfMus(WmRootWindowController* root_window_controller) { | 18 WmShelfMus::WmShelfMus(WmRootWindowController* root_window_controller) { |
| 21 DCHECK(root_window_controller); | 19 DCHECK(root_window_controller); |
| 22 // Create a placeholder shelf widget, because the status area code assumes it | 20 WmShell::Get()->CreateShelfDelegate(); |
| 23 // can access one. | 21 WmWindow* root = root_window_controller->GetWindow(); |
| 24 // TODO(jamescook): Create a real shelf widget. http://crbug.com/615155 | 22 shelf_widget_.reset(new ShelfWidget( |
| 25 shelf_widget_ = new views::Widget; | 23 root->GetChildByShellWindowId(kShellWindowId_ShelfContainer), |
| 26 views::Widget::InitParams params( | 24 root->GetChildByShellWindowId(kShellWindowId_StatusContainer), this)); |
| 27 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 25 shelf_.reset( |
| 28 root_window_controller->ConfigureWidgetInitParamsForContainer( | 26 new Shelf(this, shelf_widget_->CreateShelfView(), shelf_widget_.get())); |
| 29 shelf_widget_, kShellWindowId_ShelfContainer, ¶ms); | 27 shelf_widget_->set_shelf(shelf_.get()); |
| 30 shelf_widget_->Init(params); | 28 // Must be initialized before the delegate is notified because the delegate |
| 29 // may try to access the WmShelf. |
| 30 SetShelf(shelf_.get()); |
| 31 WmShell::Get()->shelf_delegate()->OnShelfCreated(shelf_.get()); |
| 32 WmShell::Get()->NotifyShelfCreatedForRootWindow(root); |
| 33 shelf_widget_->PostCreateShelf(); |
| 31 } | 34 } |
| 32 | 35 |
| 33 WmShelfMus::~WmShelfMus() {} | 36 WmShelfMus::~WmShelfMus() { |
| 34 | 37 shelf_widget_.reset(); |
| 35 WmWindow* WmShelfMus::GetWindow() { | 38 WmShelf::ClearShelf(); |
| 36 return WmWindowMus::Get(shelf_widget_); | |
| 37 } | 39 } |
| 38 | 40 |
| 39 ShelfAlignment WmShelfMus::GetAlignment() const { | 41 void WmShelfMus::WillDeleteShelfLayoutManager() { |
| 40 NOTIMPLEMENTED(); | 42 shelf_widget_->Shutdown(); |
| 41 return SHELF_ALIGNMENT_BOTTOM; | 43 WmShelf::WillDeleteShelfLayoutManager(); |
| 42 } | |
| 43 | |
| 44 void WmShelfMus::SetAlignment(ShelfAlignment alignment) { | |
| 45 NOTIMPLEMENTED(); | |
| 46 } | |
| 47 | |
| 48 ShelfAutoHideBehavior WmShelfMus::GetAutoHideBehavior() const { | |
| 49 NOTIMPLEMENTED(); | |
| 50 return SHELF_AUTO_HIDE_BEHAVIOR_NEVER; | |
| 51 } | |
| 52 | |
| 53 void WmShelfMus::SetAutoHideBehavior(ShelfAutoHideBehavior behavior) { | |
| 54 NOTIMPLEMENTED(); | |
| 55 } | |
| 56 | |
| 57 ShelfAutoHideState WmShelfMus::GetAutoHideState() const { | |
| 58 NOTIMPLEMENTED(); | |
| 59 return SHELF_AUTO_HIDE_HIDDEN; | |
| 60 } | |
| 61 | |
| 62 void WmShelfMus::UpdateAutoHideState() { | |
| 63 NOTIMPLEMENTED(); | |
| 64 } | |
| 65 | |
| 66 ShelfBackgroundType WmShelfMus::GetBackgroundType() const { | |
| 67 NOTIMPLEMENTED(); | |
| 68 return SHELF_BACKGROUND_DEFAULT; | |
| 69 } | |
| 70 | |
| 71 WmDimmerView* WmShelfMus::CreateDimmerView(bool disable_animations_for_test) { | |
| 72 // mus does not dim shelf items. | |
| 73 return nullptr; | |
| 74 } | |
| 75 | |
| 76 bool WmShelfMus::IsDimmed() const { | |
| 77 // mus does not dim shelf items. | |
| 78 return false; | |
| 79 } | |
| 80 | |
| 81 void WmShelfMus::SchedulePaint() { | |
| 82 NOTIMPLEMENTED(); | |
| 83 } | |
| 84 | |
| 85 bool WmShelfMus::IsVisible() const { | |
| 86 NOTIMPLEMENTED(); | |
| 87 return true; | |
| 88 } | |
| 89 | |
| 90 void WmShelfMus::UpdateVisibilityState() { | |
| 91 NOTIMPLEMENTED(); | |
| 92 } | |
| 93 | |
| 94 ShelfVisibilityState WmShelfMus::GetVisibilityState() const { | |
| 95 NOTIMPLEMENTED(); | |
| 96 return SHELF_VISIBLE; | |
| 97 } | |
| 98 | |
| 99 gfx::Rect WmShelfMus::GetUserWorkAreaBounds() const { | |
| 100 NOTIMPLEMENTED(); | |
| 101 return gfx::Rect(); | |
| 102 } | |
| 103 | |
| 104 void WmShelfMus::UpdateIconPositionForWindow(WmWindow* window) { | |
| 105 NOTIMPLEMENTED(); | |
| 106 } | |
| 107 | |
| 108 gfx::Rect WmShelfMus::GetIdealBounds() { | |
| 109 NOTIMPLEMENTED(); | |
| 110 return gfx::Rect(); | |
| 111 } | |
| 112 | |
| 113 gfx::Rect WmShelfMus::GetScreenBoundsOfItemIconForWindow(WmWindow* window) { | |
| 114 NOTIMPLEMENTED(); | |
| 115 return gfx::Rect(); | |
| 116 } | |
| 117 | |
| 118 bool WmShelfMus::ProcessGestureEvent(const ui::GestureEvent& event) { | |
| 119 NOTIMPLEMENTED(); | |
| 120 return false; | |
| 121 } | |
| 122 | |
| 123 void WmShelfMus::AddObserver(WmShelfObserver* observer) { | |
| 124 observers_.AddObserver(observer); | |
| 125 } | |
| 126 | |
| 127 void WmShelfMus::RemoveObserver(WmShelfObserver* observer) { | |
| 128 observers_.RemoveObserver(observer); | |
| 129 } | |
| 130 | |
| 131 void WmShelfMus::SetKeyboardBoundsForTesting(const gfx::Rect& bounds) { | |
| 132 NOTIMPLEMENTED(); | |
| 133 } | |
| 134 | |
| 135 ShelfLockingManager* WmShelfMus::GetShelfLockingManagerForTesting() { | |
| 136 NOTIMPLEMENTED(); | |
| 137 return nullptr; | |
| 138 } | |
| 139 | |
| 140 ShelfView* WmShelfMus::GetShelfViewForTesting() { | |
| 141 NOTIMPLEMENTED(); | |
| 142 return nullptr; | |
| 143 } | 44 } |
| 144 | 45 |
| 145 } // namespace mus | 46 } // namespace mus |
| 146 } // namespace ash | 47 } // namespace ash |
| OLD | NEW |