OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "mojo/application/application_runner_chromium.h" | 7 #include "mojo/application/application_runner_chromium.h" |
8 #include "mojo/examples/wm_flow/wm/frame_controller.h" | 8 #include "mojo/examples/wm_flow/wm/frame_controller.h" |
9 #include "mojo/public/c/system/main.h" | 9 #include "mojo/public/c/system/main.h" |
10 #include "mojo/public/cpp/application/application_delegate.h" | 10 #include "mojo/public/cpp/application/application_delegate.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 window_manager_app_(new mojo::WindowManagerApp(this, this)), | 95 window_manager_app_(new mojo::WindowManagerApp(this, this)), |
96 view_manager_(NULL), | 96 view_manager_(NULL), |
97 root_(NULL), | 97 root_(NULL), |
98 window_container_(NULL), | 98 window_container_(NULL), |
99 next_window_origin_(10, 10) {} | 99 next_window_origin_(10, 10) {} |
100 virtual ~SimpleWM() {} | 100 virtual ~SimpleWM() {} |
101 | 101 |
102 private: | 102 private: |
103 // Overridden from mojo::ApplicationDelegate: | 103 // Overridden from mojo::ApplicationDelegate: |
104 virtual void Initialize(mojo::ApplicationImpl* impl) override { | 104 virtual void Initialize(mojo::ApplicationImpl* impl) override { |
| 105 // Create views_init here as we need ApplicationRunnerChromium to install |
| 106 // an AtExitManager and CommandLine. |
| 107 if (!views_init_.get()) |
| 108 views_init_.reset(new mojo::ViewsInit); |
105 shell_ = impl->shell(); | 109 shell_ = impl->shell(); |
106 window_manager_app_->Initialize(impl); | 110 window_manager_app_->Initialize(impl); |
107 } | 111 } |
108 virtual bool ConfigureIncomingConnection( | 112 virtual bool ConfigureIncomingConnection( |
109 mojo::ApplicationConnection* connection) override { | 113 mojo::ApplicationConnection* connection) override { |
110 window_manager_app_->ConfigureIncomingConnection(connection); | 114 window_manager_app_->ConfigureIncomingConnection(connection); |
111 return true; | 115 return true; |
112 } | 116 } |
113 | 117 |
114 // Overridden from mojo::ViewManagerDelegate: | 118 // Overridden from mojo::ViewManagerDelegate: |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 180 |
177 aura::client::ActivationClient* client = aura::client::GetActivationClient( | 181 aura::client::ActivationClient* client = aura::client::GetActivationClient( |
178 window_manager_app_->host()->window()); | 182 window_manager_app_->host()->window()); |
179 new FrameController( | 183 new FrameController( |
180 shell_, frame_view, app_view, client, window_manager_app_.get()); | 184 shell_, frame_view, app_view, client, window_manager_app_.get()); |
181 return frame_view; | 185 return frame_view; |
182 } | 186 } |
183 | 187 |
184 mojo::Shell* shell_; | 188 mojo::Shell* shell_; |
185 | 189 |
| 190 scoped_ptr<mojo::ViewsInit> views_init_; |
| 191 |
186 scoped_ptr<mojo::WindowManagerApp> window_manager_app_; | 192 scoped_ptr<mojo::WindowManagerApp> window_manager_app_; |
187 | 193 |
188 mojo::ViewManager* view_manager_; | 194 mojo::ViewManager* view_manager_; |
189 mojo::View* root_; | 195 mojo::View* root_; |
190 mojo::View* window_container_; | 196 mojo::View* window_container_; |
191 | 197 |
192 gfx::Point next_window_origin_; | 198 gfx::Point next_window_origin_; |
193 | 199 |
194 DISALLOW_COPY_AND_ASSIGN(SimpleWM); | 200 DISALLOW_COPY_AND_ASSIGN(SimpleWM); |
195 }; | 201 }; |
196 | 202 |
197 } // namespace examples | 203 } // namespace examples |
198 | 204 |
199 MojoResult MojoMain(MojoHandle shell_handle) { | 205 MojoResult MojoMain(MojoHandle shell_handle) { |
200 mojo::ViewsInit views_init; | |
201 mojo::ApplicationRunnerChromium runner(new examples::SimpleWM); | 206 mojo::ApplicationRunnerChromium runner(new examples::SimpleWM); |
202 return runner.Run(shell_handle); | 207 return runner.Run(shell_handle); |
203 } | 208 } |
OLD | NEW |