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

Side by Side Diff: components/mus/example/wm/window_manager_application.cc

Issue 1419793006: Makes windowmanager draw non-client area (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move wm nonclientframeview to wm Created 5 years, 1 month 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 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 "components/mus/example/wm/window_manager_application.h" 5 #include "components/mus/example/wm/window_manager_application.h"
6 6
7 #include "components/mus/example/wm/background_layout.h" 7 #include "components/mus/example/wm/background_layout.h"
8 #include "components/mus/example/wm/shelf_layout.h" 8 #include "components/mus/example/wm/shelf_layout.h"
9 #include "components/mus/example/wm/window_layout.h" 9 #include "components/mus/example/wm/window_layout.h"
10 #include "components/mus/example/wm/window_manager_impl.h" 10 #include "components/mus/example/wm/window_manager_impl.h"
11 #include "components/mus/public/cpp/util.h" 11 #include "components/mus/public/cpp/util.h"
12 #include "components/mus/public/cpp/window.h" 12 #include "components/mus/public/cpp/window.h"
13 #include "components/mus/public/cpp/window_tree_connection.h" 13 #include "components/mus/public/cpp/window_tree_connection.h"
14 #include "components/mus/public/cpp/window_tree_host_factory.h" 14 #include "components/mus/public/cpp/window_tree_host_factory.h"
15 #include "mojo/application/public/cpp/application_connection.h" 15 #include "mojo/application/public/cpp/application_connection.h"
16 #include "ui/views/mus/aura_init.h"
16 17
17 WindowManagerApplication::WindowManagerApplication() 18 WindowManagerApplication::WindowManagerApplication()
18 : root_(nullptr), window_count_(0) {} 19 : root_(nullptr), window_count_(0), app_(nullptr) {}
19 WindowManagerApplication::~WindowManagerApplication() {} 20 WindowManagerApplication::~WindowManagerApplication() {}
20 21
21 mus::Window* WindowManagerApplication::GetWindowForContainer( 22 mus::Window* WindowManagerApplication::GetWindowForContainer(
22 ash::mojom::Container container) { 23 ash::mojom::Container container) {
23 const mus::Id window_id = root_->connection()->GetConnectionId() << 16 | 24 const mus::Id window_id = root_->connection()->GetConnectionId() << 16 |
24 static_cast<uint16_t>(container); 25 static_cast<uint16_t>(container);
25 return root_->GetChildById(window_id); 26 return root_->GetChildById(window_id);
26 } 27 }
27 28
28 mus::Window* WindowManagerApplication::GetWindowById(mus::Id id) { 29 mus::Window* WindowManagerApplication::GetWindowById(mus::Id id) {
29 return root_->GetChildById(id); 30 return root_->GetChildById(id);
30 } 31 }
31 32
32 void WindowManagerApplication::Initialize(mojo::ApplicationImpl* app) { 33 void WindowManagerApplication::Initialize(mojo::ApplicationImpl* app) {
34 app_ = app;
33 mus::mojom::WindowManagerPtr window_manager; 35 mus::mojom::WindowManagerPtr window_manager;
34 requests_.push_back(new mojo::InterfaceRequest<mus::mojom::WindowManager>( 36 requests_.push_back(new mojo::InterfaceRequest<mus::mojom::WindowManager>(
35 mojo::GetProxy(&window_manager))); 37 mojo::GetProxy(&window_manager)));
36 mus::CreateSingleWindowTreeHost(app, this, &host_, window_manager.Pass()); 38 mus::CreateSingleWindowTreeHost(app, this, &host_, window_manager.Pass());
37 } 39 }
38 40
39 bool WindowManagerApplication::ConfigureIncomingConnection( 41 bool WindowManagerApplication::ConfigureIncomingConnection(
40 mojo::ApplicationConnection* connection) { 42 mojo::ApplicationConnection* connection) {
41 connection->AddService(this); 43 connection->AddService(this);
42 return true; 44 return true;
43 } 45 }
44 46
45 void WindowManagerApplication::OnEmbed(mus::Window* root) { 47 void WindowManagerApplication::OnEmbed(mus::Window* root) {
46 root_ = root; 48 root_ = root;
47 root_->AddObserver(this); 49 root_->AddObserver(this);
48 CreateContainers(); 50 CreateContainers();
49 background_layout_.reset(new BackgroundLayout( 51 background_layout_.reset(new BackgroundLayout(
50 GetWindowForContainer(ash::mojom::CONTAINER_USER_BACKGROUND))); 52 GetWindowForContainer(ash::mojom::CONTAINER_USER_BACKGROUND)));
51 shelf_layout_.reset(new ShelfLayout( 53 shelf_layout_.reset(new ShelfLayout(
52 GetWindowForContainer(ash::mojom::CONTAINER_USER_SHELF))); 54 GetWindowForContainer(ash::mojom::CONTAINER_USER_SHELF)));
53 window_layout_.reset(new WindowLayout( 55 window_layout_.reset(new WindowLayout(
54 GetWindowForContainer(ash::mojom::CONTAINER_USER_WINDOWS))); 56 GetWindowForContainer(ash::mojom::CONTAINER_USER_WINDOWS)));
55 57
56 window_manager_.reset(new WindowManagerImpl(this)); 58 window_manager_.reset(new WindowManagerImpl(this));
59
60 aura_init_.reset(new views::AuraInit(app_, "views_mus_resources.pak", root));
61
57 for (auto request : requests_) 62 for (auto request : requests_)
58 window_manager_binding_.AddBinding(window_manager_.get(), request->Pass()); 63 window_manager_binding_.AddBinding(window_manager_.get(), request->Pass());
59 requests_.clear(); 64 requests_.clear();
60 } 65 }
61 66
62 void WindowManagerApplication::OnConnectionLost( 67 void WindowManagerApplication::OnConnectionLost(
63 mus::WindowTreeConnection* connection) { 68 mus::WindowTreeConnection* connection) {
64 // TODO(sky): shutdown. 69 // TODO(sky): shutdown.
65 NOTIMPLEMENTED(); 70 NOTIMPLEMENTED();
66 } 71 }
(...skipping 24 matching lines...) Expand all
91 container < static_cast<uint16_t>(ash::mojom::CONTAINER_COUNT); 96 container < static_cast<uint16_t>(ash::mojom::CONTAINER_COUNT);
92 ++container) { 97 ++container) {
93 mus::Window* window = root_->connection()->NewWindow(); 98 mus::Window* window = root_->connection()->NewWindow();
94 DCHECK_EQ(mus::LoWord(window->id()), container) 99 DCHECK_EQ(mus::LoWord(window->id()), container)
95 << "Containers must be created before other windows!"; 100 << "Containers must be created before other windows!";
96 window->SetBounds(root_->bounds()); 101 window->SetBounds(root_->bounds());
97 window->SetVisible(true); 102 window->SetVisible(true);
98 root_->AddChild(window); 103 root_->AddChild(window);
99 } 104 }
100 } 105 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698