| 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 <iostream> | 5 #include <iostream> |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.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" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 } | 76 } |
| 77 virtual bool ConfigureIncomingConnection( | 77 virtual bool ConfigureIncomingConnection( |
| 78 mojo::ApplicationConnection* connection) override { | 78 mojo::ApplicationConnection* connection) override { |
| 79 window_manager_app_->ConfigureIncomingConnection(connection); | 79 window_manager_app_->ConfigureIncomingConnection(connection); |
| 80 if (test_runner_) | 80 if (test_runner_) |
| 81 connection->AddService(test_runner_->test_harness_factory()); | 81 connection->AddService(test_runner_->test_harness_factory()); |
| 82 return true; | 82 return true; |
| 83 } | 83 } |
| 84 | 84 |
| 85 // Overridden from mojo::ViewManagerDelegate: | 85 // Overridden from mojo::ViewManagerDelegate: |
| 86 virtual void OnEmbed( | 86 virtual void OnEmbed(mojo::View* root, |
| 87 mojo::View* root, | 87 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 88 mojo::ServiceProviderImpl* exported_services, | 88 mojo::ServiceProviderPtr exposed_services) override { |
| 89 scoped_ptr<mojo::ServiceProvider> remote_service_provider) override { | |
| 90 root_ = root; | 89 root_ = root; |
| 91 root_->AddObserver(this); | 90 root_->AddObserver(this); |
| 92 | 91 |
| 93 content_ = root->view_manager()->CreateView(); | 92 content_ = root->view_manager()->CreateView(); |
| 94 content_->SetBounds(root_->bounds()); | 93 content_->SetBounds(root_->bounds()); |
| 95 root_->AddChild(content_); | 94 root_->AddChild(content_); |
| 96 content_->SetVisible(true); | 95 content_->SetVisible(true); |
| 97 | 96 |
| 98 std::cout << "#READY\n"; | 97 std::cout << "#READY\n"; |
| 99 std::cout.flush(); | 98 std::cout.flush(); |
| 100 ScheduleRun(); | 99 ScheduleRun(); |
| 101 } | 100 } |
| 102 | 101 |
| 103 // Overridden from window_manager::WindowManagerDelegate: | 102 // Overridden from window_manager::WindowManagerDelegate: |
| 104 virtual void Embed( | 103 virtual void Embed(const mojo::String& url, |
| 105 const mojo::String& url, | 104 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 106 mojo::InterfaceRequest<mojo::ServiceProvider> service_provider) override { | 105 mojo::ServiceProviderPtr exposed_services) override {} |
| 107 } | |
| 108 | 106 |
| 109 virtual void OnViewManagerDisconnected( | 107 virtual void OnViewManagerDisconnected( |
| 110 mojo::ViewManager* view_manager) override { | 108 mojo::ViewManager* view_manager) override { |
| 111 root_ = NULL; | 109 root_ = NULL; |
| 112 } | 110 } |
| 113 | 111 |
| 114 virtual void OnViewDestroyed(mojo::View* view) override { | 112 virtual void OnViewDestroyed(mojo::View* view) override { |
| 115 view->RemoveObserver(this); | 113 view->RemoveObserver(this); |
| 116 } | 114 } |
| 117 | 115 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 DISALLOW_COPY_AND_ASSIGN(SkyTester); | 163 DISALLOW_COPY_AND_ASSIGN(SkyTester); |
| 166 }; | 164 }; |
| 167 | 165 |
| 168 } // namespace tester | 166 } // namespace tester |
| 169 } // namespace examples | 167 } // namespace examples |
| 170 | 168 |
| 171 MojoResult MojoMain(MojoHandle shell_handle) { | 169 MojoResult MojoMain(MojoHandle shell_handle) { |
| 172 mojo::ApplicationRunnerChromium runner(new sky::tester::SkyTester); | 170 mojo::ApplicationRunnerChromium runner(new sky::tester::SkyTester); |
| 173 return runner.Run(shell_handle); | 171 return runner.Run(shell_handle); |
| 174 } | 172 } |
| OLD | NEW |