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

Side by Side Diff: examples/wm_flow/wm/wm.cc

Issue 788453002: Put code in //services/window_manager in namespace window_manager (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 | « examples/wm_flow/wm/frame_controller.cc ('k') | services/window_manager/basic_focus_rules.h » ('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 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 "examples/wm_flow/wm/frame_controller.h" 7 #include "examples/wm_flow/wm/frame_controller.h"
8 #include "mojo/application/application_runner_chromium.h" 8 #include "mojo/application/application_runner_chromium.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"
11 #include "mojo/public/cpp/application/application_impl.h" 11 #include "mojo/public/cpp/application/application_impl.h"
12 #include "mojo/public/cpp/application/service_provider_impl.h" 12 #include "mojo/public/cpp/application/service_provider_impl.h"
13 #include "mojo/services/public/cpp/view_manager/view_manager.h" 13 #include "mojo/services/public/cpp/view_manager/view_manager.h"
14 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" 14 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h"
15 #include "mojo/services/public/cpp/view_manager/view_observer.h" 15 #include "mojo/services/public/cpp/view_manager/view_observer.h"
16 #include "mojo/services/public/interfaces/input_events/input_events.mojom.h" 16 #include "mojo/services/public/interfaces/input_events/input_events.mojom.h"
17 #include "mojo/views/views_init.h" 17 #include "mojo/views/views_init.h"
18 #include "services/window_manager/basic_focus_rules.h" 18 #include "services/window_manager/basic_focus_rules.h"
19 #include "services/window_manager/window_manager_app.h" 19 #include "services/window_manager/window_manager_app.h"
20 #include "services/window_manager/window_manager_delegate.h" 20 #include "services/window_manager/window_manager_delegate.h"
21 21
22 namespace examples { 22 namespace examples {
23 23
24 class SimpleWM : public mojo::ApplicationDelegate, 24 class SimpleWM : public mojo::ApplicationDelegate,
25 public mojo::ViewManagerDelegate, 25 public mojo::ViewManagerDelegate,
26 public mojo::WindowManagerDelegate, 26 public window_manager::WindowManagerDelegate,
27 public mojo::ViewObserver { 27 public mojo::ViewObserver {
28 public: 28 public:
29 SimpleWM() 29 SimpleWM()
30 : shell_(nullptr), 30 : shell_(nullptr),
31 window_manager_app_(new mojo::WindowManagerApp(this, this)), 31 window_manager_app_(new window_manager::WindowManagerApp(this, this)),
32 view_manager_(NULL), 32 view_manager_(NULL),
33 root_(NULL), 33 root_(NULL),
34 window_container_(NULL), 34 window_container_(NULL),
35 next_window_origin_(10, 10) {} 35 next_window_origin_(10, 10) {}
36 virtual ~SimpleWM() {} 36 virtual ~SimpleWM() {}
37 37
38 private: 38 private:
39 // Overridden from mojo::ApplicationDelegate: 39 // Overridden from mojo::ApplicationDelegate:
40 virtual void Initialize(mojo::ApplicationImpl* impl) override { 40 virtual void Initialize(mojo::ApplicationImpl* impl) override {
41 // Create views_init here as we need ApplicationRunnerChromium to install 41 // Create views_init here as we need ApplicationRunnerChromium to install
(...skipping 16 matching lines...) Expand all
58 mojo::ServiceProviderImpl* exported_services, 58 mojo::ServiceProviderImpl* exported_services,
59 scoped_ptr<mojo::ServiceProvider> remote_service_provider) override { 59 scoped_ptr<mojo::ServiceProvider> remote_service_provider) override {
60 view_manager_ = view_manager; 60 view_manager_ = view_manager;
61 root_ = root; 61 root_ = root;
62 62
63 window_container_ = mojo::View::Create(view_manager_); 63 window_container_ = mojo::View::Create(view_manager_);
64 window_container_->SetBounds(root_->bounds()); 64 window_container_->SetBounds(root_->bounds());
65 root_->AddChild(window_container_); 65 root_->AddChild(window_container_);
66 window_container_->SetVisible(true); 66 window_container_->SetVisible(true);
67 67
68 window_manager_app_->InitFocus(scoped_ptr<mojo::FocusRules>( 68 window_manager_app_->InitFocus(make_scoped_ptr(
69 new mojo::BasicFocusRules(window_container_))); 69 new window_manager::BasicFocusRules(window_container_)));
70 } 70 }
71 virtual void OnViewManagerDisconnected( 71 virtual void OnViewManagerDisconnected(
72 mojo::ViewManager* view_manager) override { 72 mojo::ViewManager* view_manager) override {
73 view_manager_ = NULL; 73 view_manager_ = NULL;
74 root_ = NULL; 74 root_ = NULL;
75 } 75 }
76 76
77 // Overridden from mojo::WindowManagerDelegate: 77 // Overridden from mojo::WindowManagerDelegate:
78 virtual void Embed( 78 virtual void Embed(
79 const mojo::String& url, 79 const mojo::String& url,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 new FrameController( 124 new FrameController(
125 shell_, frame_view, app_view, window_manager_app_.get()); 125 shell_, frame_view, app_view, window_manager_app_.get());
126 return frame_view; 126 return frame_view;
127 } 127 }
128 128
129 mojo::Shell* shell_; 129 mojo::Shell* shell_;
130 130
131 scoped_ptr<mojo::ViewsInit> views_init_; 131 scoped_ptr<mojo::ViewsInit> views_init_;
132 132
133 scoped_ptr<mojo::WindowManagerApp> window_manager_app_; 133 scoped_ptr<window_manager::WindowManagerApp> window_manager_app_;
134 134
135 mojo::ViewManager* view_manager_; 135 mojo::ViewManager* view_manager_;
136 mojo::View* root_; 136 mojo::View* root_;
137 mojo::View* window_container_; 137 mojo::View* window_container_;
138 138
139 gfx::Point next_window_origin_; 139 gfx::Point next_window_origin_;
140 140
141 DISALLOW_COPY_AND_ASSIGN(SimpleWM); 141 DISALLOW_COPY_AND_ASSIGN(SimpleWM);
142 }; 142 };
143 143
144 } // namespace examples 144 } // namespace examples
145 145
146 MojoResult MojoMain(MojoHandle shell_handle) { 146 MojoResult MojoMain(MojoHandle shell_handle) {
147 mojo::ApplicationRunnerChromium runner(new examples::SimpleWM); 147 mojo::ApplicationRunnerChromium runner(new examples::SimpleWM);
148 return runner.Run(shell_handle); 148 return runner.Run(shell_handle);
149 } 149 }
OLDNEW
« no previous file with comments | « examples/wm_flow/wm/frame_controller.cc ('k') | services/window_manager/basic_focus_rules.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698