| 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "mojo/examples/wm_flow/app/embedder.mojom.h" | 6 #include "mojo/examples/wm_flow/app/embedder.mojom.h" |
| 7 #include "mojo/examples/wm_flow/embedded/embeddee.mojom.h" | 7 #include "mojo/examples/wm_flow/embedded/embeddee.mojom.h" |
| 8 #include "mojo/public/cpp/application/application_connection.h" | 8 #include "mojo/public/cpp/application/application_connection.h" |
| 9 #include "mojo/public/cpp/application/application_delegate.h" | 9 #include "mojo/public/cpp/application/application_delegate.h" |
| 10 #include "mojo/public/cpp/application/application_impl.h" | 10 #include "mojo/public/cpp/application/application_impl.h" |
| 11 #include "mojo/public/cpp/application/connect.h" | 11 #include "mojo/public/cpp/application/connect.h" |
| 12 #include "mojo/public/cpp/application/interface_factory_impl.h" | 12 #include "mojo/public/cpp/application/interface_factory_impl.h" |
| 13 #include "mojo/public/cpp/application/service_provider_impl.h" | 13 #include "mojo/public/cpp/application/service_provider_impl.h" |
| 14 #include "mojo/services/public/cpp/view_manager/node.h" | 14 #include "mojo/services/public/cpp/view_manager/view.h" |
| 15 #include "mojo/services/public/cpp/view_manager/view_manager.h" | 15 #include "mojo/services/public/cpp/view_manager/view_manager.h" |
| 16 #include "mojo/services/public/cpp/view_manager/view_manager_client_factory.h" | 16 #include "mojo/services/public/cpp/view_manager/view_manager_client_factory.h" |
| 17 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" | 17 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" |
| 18 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" | 18 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" |
| 19 | 19 |
| 20 namespace examples { | 20 namespace examples { |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 class EmbeddeeImpl : public mojo::InterfaceImpl<Embeddee> { | 24 class EmbeddeeImpl : public mojo::InterfaceImpl<Embeddee> { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 50 } | 50 } |
| 51 virtual bool ConfigureIncomingConnection( | 51 virtual bool ConfigureIncomingConnection( |
| 52 mojo::ApplicationConnection* connection) MOJO_OVERRIDE { | 52 mojo::ApplicationConnection* connection) MOJO_OVERRIDE { |
| 53 connection->AddService(&view_manager_client_factory_); | 53 connection->AddService(&view_manager_client_factory_); |
| 54 return true; | 54 return true; |
| 55 } | 55 } |
| 56 | 56 |
| 57 // Overridden from mojo::ViewManagerDelegate: | 57 // Overridden from mojo::ViewManagerDelegate: |
| 58 virtual void OnEmbed( | 58 virtual void OnEmbed( |
| 59 mojo::ViewManager* view_manager, | 59 mojo::ViewManager* view_manager, |
| 60 mojo::Node* root, | 60 mojo::View* root, |
| 61 mojo::ServiceProviderImpl* exported_services, | 61 mojo::ServiceProviderImpl* exported_services, |
| 62 scoped_ptr<mojo::ServiceProvider> imported_services) MOJO_OVERRIDE { | 62 scoped_ptr<mojo::ServiceProvider> imported_services) MOJO_OVERRIDE { |
| 63 root->SetColor(SK_ColorMAGENTA); | 63 root->SetColor(SK_ColorMAGENTA); |
| 64 | 64 |
| 65 exported_services->AddService(&embeddee_factory_); | 65 exported_services->AddService(&embeddee_factory_); |
| 66 mojo::ConnectToService(imported_services.get(), &embedder_); | 66 mojo::ConnectToService(imported_services.get(), &embedder_); |
| 67 embedder_->HelloWorld(base::Bind(&WMFlowEmbedded::HelloWorldAck, | 67 embedder_->HelloWorld(base::Bind(&WMFlowEmbedded::HelloWorldAck, |
| 68 base::Unretained(this))); | 68 base::Unretained(this))); |
| 69 } | 69 } |
| 70 virtual void OnViewManagerDisconnected( | 70 virtual void OnViewManagerDisconnected( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 84 } // namespace examples | 84 } // namespace examples |
| 85 | 85 |
| 86 namespace mojo { | 86 namespace mojo { |
| 87 | 87 |
| 88 // static | 88 // static |
| 89 ApplicationDelegate* ApplicationDelegate::Create() { | 89 ApplicationDelegate* ApplicationDelegate::Create() { |
| 90 return new examples::WMFlowEmbedded; | 90 return new examples::WMFlowEmbedded; |
| 91 } | 91 } |
| 92 | 92 |
| 93 } // namespace | 93 } // namespace |
| OLD | NEW |