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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "mojo/application/application_runner_chromium.h" | 6 #include "mojo/application/application_runner_chromium.h" |
7 #include "mojo/public/c/system/main.h" | 7 #include "mojo/public/c/system/main.h" |
8 #include "mojo/public/cpp/application/application_delegate.h" | 8 #include "mojo/public/cpp/application/application_delegate.h" |
9 #include "mojo/public/cpp/application/service_provider_impl.h" | 9 #include "mojo/public/cpp/application/service_provider_impl.h" |
10 #include "mojo/services/public/cpp/view_manager/view_manager.h" | 10 #include "mojo/services/public/cpp/view_manager/view_manager.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 public WindowManagerDelegate { | 23 public WindowManagerDelegate { |
24 public: | 24 public: |
25 DefaultWindowManager() | 25 DefaultWindowManager() |
26 : window_manager_app_(new WindowManagerApp(this, this)), | 26 : window_manager_app_(new WindowManagerApp(this, this)), |
27 view_manager_(NULL), | 27 view_manager_(NULL), |
28 root_(NULL) {} | 28 root_(NULL) {} |
29 virtual ~DefaultWindowManager() {} | 29 virtual ~DefaultWindowManager() {} |
30 | 30 |
31 private: | 31 private: |
32 // Overridden from ApplicationDelegate: | 32 // Overridden from ApplicationDelegate: |
33 virtual void Initialize(ApplicationImpl* impl) MOJO_OVERRIDE { | 33 virtual void Initialize(ApplicationImpl* impl) override { |
34 window_manager_app_->Initialize(impl); | 34 window_manager_app_->Initialize(impl); |
35 } | 35 } |
36 virtual bool ConfigureIncomingConnection( | 36 virtual bool ConfigureIncomingConnection( |
37 ApplicationConnection* connection) MOJO_OVERRIDE { | 37 ApplicationConnection* connection) override { |
38 window_manager_app_->ConfigureIncomingConnection(connection); | 38 window_manager_app_->ConfigureIncomingConnection(connection); |
39 return true; | 39 return true; |
40 } | 40 } |
41 | 41 |
42 // Overridden from ViewManagerDelegate: | 42 // Overridden from ViewManagerDelegate: |
43 virtual void OnEmbed( | 43 virtual void OnEmbed(ViewManager* view_manager, |
44 ViewManager* view_manager, | 44 View* root, |
45 View* root, | 45 ServiceProviderImpl* exported_services, |
46 ServiceProviderImpl* exported_services, | 46 scoped_ptr<ServiceProvider> imported_services) override { |
47 scoped_ptr<ServiceProvider> imported_services) MOJO_OVERRIDE { | |
48 view_manager_ = view_manager; | 47 view_manager_ = view_manager; |
49 root_ = root; | 48 root_ = root; |
50 view_manager_->SetWindowManagerDelegate(this); | 49 view_manager_->SetWindowManagerDelegate(this); |
51 } | 50 } |
52 virtual void OnViewManagerDisconnected( | 51 virtual void OnViewManagerDisconnected(ViewManager* view_manager) override {} |
53 ViewManager* view_manager) MOJO_OVERRIDE {} | |
54 | 52 |
55 // Overridden from WindowManagerDelegate: | 53 // Overridden from WindowManagerDelegate: |
56 virtual void Embed( | 54 virtual void Embed( |
57 const String& url, | 55 const String& url, |
58 InterfaceRequest<ServiceProvider> service_provider) MOJO_OVERRIDE { | 56 InterfaceRequest<ServiceProvider> service_provider) override { |
59 View* view = View::Create(view_manager_); | 57 View* view = View::Create(view_manager_); |
60 root_->AddChild(view); | 58 root_->AddChild(view); |
61 view->Embed(url, scoped_ptr<mojo::ServiceProviderImpl>( | 59 view->Embed(url, scoped_ptr<mojo::ServiceProviderImpl>( |
62 new mojo::ServiceProviderImpl).Pass()); | 60 new mojo::ServiceProviderImpl).Pass()); |
63 } | 61 } |
64 virtual void DispatchEvent(EventPtr event) MOJO_OVERRIDE {} | 62 virtual void DispatchEvent(EventPtr event) override {} |
65 | 63 |
66 scoped_ptr<WindowManagerApp> window_manager_app_; | 64 scoped_ptr<WindowManagerApp> window_manager_app_; |
67 | 65 |
68 ViewManager* view_manager_; | 66 ViewManager* view_manager_; |
69 View* root_; | 67 View* root_; |
70 | 68 |
71 MOJO_DISALLOW_COPY_AND_ASSIGN(DefaultWindowManager); | 69 MOJO_DISALLOW_COPY_AND_ASSIGN(DefaultWindowManager); |
72 }; | 70 }; |
73 | 71 |
74 } // namespace mojo | 72 } // namespace mojo |
75 | 73 |
76 MojoResult MojoMain(MojoHandle shell_handle) { | 74 MojoResult MojoMain(MojoHandle shell_handle) { |
77 mojo::ApplicationRunnerChromium runner(new mojo::DefaultWindowManager); | 75 mojo::ApplicationRunnerChromium runner(new mojo::DefaultWindowManager); |
78 return runner.Run(shell_handle); | 76 return runner.Run(shell_handle); |
79 } | 77 } |
OLD | NEW |