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

Side by Side Diff: ash/mus/window_manager.cc

Issue 2314203002: Move DisplayList to display; add ScreenBase. (Closed)
Patch Set: Update unit test namespace. Created 4 years, 3 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
« no previous file with comments | « ash/mus/window_manager.h ('k') | ash/test/display_manager_test_api.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/window_manager.h" 5 #include "ash/mus/window_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 18 matching lines...) Expand all
29 #include "services/ui/public/cpp/window_property.h" 29 #include "services/ui/public/cpp/window_property.h"
30 #include "services/ui/public/cpp/window_tree_client.h" 30 #include "services/ui/public/cpp/window_tree_client.h"
31 #include "services/ui/public/interfaces/mus_constants.mojom.h" 31 #include "services/ui/public/interfaces/mus_constants.mojom.h"
32 #include "services/ui/public/interfaces/window_manager.mojom.h" 32 #include "services/ui/public/interfaces/window_manager.mojom.h"
33 #include "ui/app_list/presenter/app_list_presenter.h" 33 #include "ui/app_list/presenter/app_list_presenter.h"
34 #include "ui/base/hit_test.h" 34 #include "ui/base/hit_test.h"
35 #include "ui/events/mojo/event.mojom.h" 35 #include "ui/events/mojo/event.mojom.h"
36 #include "ui/views/mus/pointer_watcher_event_router.h" 36 #include "ui/views/mus/pointer_watcher_event_router.h"
37 #include "ui/views/mus/screen_mus.h" 37 #include "ui/views/mus/screen_mus.h"
38 38
39 namespace ash { 39 namespace {
40 namespace mus {
41
42 void AssertTrue(bool success) {
43 DCHECK(success);
44 }
45 40
46 // TODO(jamescook): Port ash::sysui::AppListPresenterMus and eliminate this. 41 // TODO(jamescook): Port ash::sysui::AppListPresenterMus and eliminate this.
47 class AppListPresenterStub : public app_list::AppListPresenter { 42 class AppListPresenterStub : public app_list::AppListPresenter {
48 public: 43 public:
49 AppListPresenterStub() {} 44 AppListPresenterStub() {}
50 ~AppListPresenterStub() override {} 45 ~AppListPresenterStub() override {}
51 46
52 // app_list::AppListPresenter: 47 // app_list::AppListPresenter:
53 void Show(int64_t display_id) override { NOTIMPLEMENTED(); } 48 void Show(int64_t display_id) override { NOTIMPLEMENTED(); }
54 void Dismiss() override { NOTIMPLEMENTED(); } 49 void Dismiss() override { NOTIMPLEMENTED(); }
55 void ToggleAppList(int64_t display_id) override { NOTIMPLEMENTED(); } 50 void ToggleAppList(int64_t display_id) override { NOTIMPLEMENTED(); }
56 bool IsVisible() const override { 51 bool IsVisible() const override {
57 NOTIMPLEMENTED(); 52 NOTIMPLEMENTED();
58 return false; 53 return false;
59 } 54 }
60 bool GetTargetVisibility() const override { 55 bool GetTargetVisibility() const override {
61 NOTIMPLEMENTED(); 56 NOTIMPLEMENTED();
62 return false; 57 return false;
63 } 58 }
64 59
65 private: 60 private:
66 DISALLOW_COPY_AND_ASSIGN(AppListPresenterStub); 61 DISALLOW_COPY_AND_ASSIGN(AppListPresenterStub);
67 }; 62 };
68 63
64 } // namespace
65
66 namespace ash {
67 namespace mus {
68
69 WindowManager::WindowManager(shell::Connector* connector) 69 WindowManager::WindowManager(shell::Connector* connector)
70 : connector_(connector) {} 70 : connector_(connector) {}
71 71
72 WindowManager::~WindowManager() { 72 WindowManager::~WindowManager() {
73 Shutdown(); 73 Shutdown();
74 } 74 }
75 75
76 void WindowManager::Init( 76 void WindowManager::Init(
77 std::unique_ptr<ui::WindowTreeClient> window_tree_client) { 77 std::unique_ptr<ui::WindowTreeClient> window_tree_client) {
78 DCHECK(!window_tree_client_); 78 DCHECK(!window_tree_client_);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 observers_.AddObserver(observer); 154 observers_.AddObserver(observer);
155 } 155 }
156 156
157 void WindowManager::RemoveObserver(WindowManagerObserver* observer) { 157 void WindowManager::RemoveObserver(WindowManagerObserver* observer) {
158 observers_.RemoveObserver(observer); 158 observers_.RemoveObserver(observer);
159 } 159 }
160 160
161 RootWindowController* WindowManager::CreateRootWindowController( 161 RootWindowController* WindowManager::CreateRootWindowController(
162 ui::Window* window, 162 ui::Window* window,
163 const display::Display& display) { 163 const display::Display& display) {
164 // TODO(sky): there is timing issues with using ScreenMus. 164 // TODO(sky): There are timing issues with using ScreenMus.
165 if (!screen_) { 165 if (!screen_) {
166 std::unique_ptr<views::ScreenMus> screen(new views::ScreenMus(nullptr)); 166 std::unique_ptr<views::ScreenMus> screen(new views::ScreenMus(nullptr));
167 screen->Init(connector_); 167 screen->Init(connector_);
168 screen_ = std::move(screen); 168 screen_ = std::move(screen);
169 } 169 }
170 170
171 std::unique_ptr<RootWindowController> root_window_controller_ptr( 171 std::unique_ptr<RootWindowController> root_window_controller_ptr(
172 new RootWindowController(this, window, display)); 172 new RootWindowController(this, window, display));
173 RootWindowController* root_window_controller = 173 RootWindowController* root_window_controller =
174 root_window_controller_ptr.get(); 174 root_window_controller_ptr.get();
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 // OnWmSetBounds() recommends doing. Remove that restriction, or fix this. 260 // OnWmSetBounds() recommends doing. Remove that restriction, or fix this.
261 WmWindowMus::Get(window)->SetBounds(*bounds); 261 WmWindowMus::Get(window)->SetBounds(*bounds);
262 *bounds = window->bounds(); 262 *bounds = window->bounds();
263 return true; 263 return true;
264 } 264 }
265 265
266 bool WindowManager::OnWmSetProperty( 266 bool WindowManager::OnWmSetProperty(
267 ui::Window* window, 267 ui::Window* window,
268 const std::string& name, 268 const std::string& name,
269 std::unique_ptr<std::vector<uint8_t>>* new_data) { 269 std::unique_ptr<std::vector<uint8_t>>* new_data) {
270 // TODO(sky): constrain this to set of keys we know about, and allowed 270 // TODO(sky): constrain this to set of keys we know about, and allowed values.
271 // values.
272 return name == ui::mojom::WindowManager::kShowState_Property || 271 return name == ui::mojom::WindowManager::kShowState_Property ||
273 name == ui::mojom::WindowManager::kPreferredSize_Property || 272 name == ui::mojom::WindowManager::kPreferredSize_Property ||
274 name == ui::mojom::WindowManager::kResizeBehavior_Property || 273 name == ui::mojom::WindowManager::kResizeBehavior_Property ||
275 name == ui::mojom::WindowManager::kWindowAppIcon_Property || 274 name == ui::mojom::WindowManager::kWindowAppIcon_Property ||
276 name == ui::mojom::WindowManager::kWindowTitle_Property; 275 name == ui::mojom::WindowManager::kWindowTitle_Property;
277 } 276 }
278 277
279 ui::Window* WindowManager::OnWmCreateTopLevelWindow( 278 ui::Window* WindowManager::OnWmCreateTopLevelWindow(
280 std::map<std::string, std::vector<uint8_t>>* properties) { 279 std::map<std::string, std::vector<uint8_t>>* properties) {
281 return NewTopLevelWindow(properties); 280 return NewTopLevelWindow(properties);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 const ui::Event& event) { 323 const ui::Event& event) {
325 auto iter = accelerator_handlers_.find(GetAcceleratorNamespaceId(id)); 324 auto iter = accelerator_handlers_.find(GetAcceleratorNamespaceId(id));
326 if (iter == accelerator_handlers_.end()) 325 if (iter == accelerator_handlers_.end())
327 return ui::mojom::EventResult::HANDLED; 326 return ui::mojom::EventResult::HANDLED;
328 327
329 return iter->second->OnAccelerator(id, event); 328 return iter->second->OnAccelerator(id, event);
330 } 329 }
331 330
332 } // namespace mus 331 } // namespace mus
333 } // namespace ash 332 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/window_manager.h ('k') | ash/test/display_manager_test_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698