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

Side by Side Diff: mojo/examples/wm_flow/app/app.cc

Issue 463523003: Fix an issue with view manager init service where you had to retain a connection to the init servic… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | mojo/services/view_manager/view_manager_init_service_context.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 "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"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 public: 49 public:
50 WMFlowApp() 50 WMFlowApp()
51 : embed_count_(0), 51 : embed_count_(0),
52 view_manager_client_factory_(this) {} 52 view_manager_client_factory_(this) {}
53 virtual ~WMFlowApp() {} 53 virtual ~WMFlowApp() {}
54 54
55 private: 55 private:
56 // Overridden from Application: 56 // Overridden from Application:
57 virtual void Initialize(mojo::ApplicationImpl* app) MOJO_OVERRIDE { 57 virtual void Initialize(mojo::ApplicationImpl* app) MOJO_OVERRIDE {
58 mojo::ServiceProviderPtr sp; 58 mojo::ServiceProviderPtr sp;
59 app->ConnectToService("mojo:mojo_view_manager", &init_svc_); 59 mojo::ViewManagerInitServicePtr init_svc;
60 init_svc_->Embed("mojo:mojo_wm_flow_app", sp.Pass(), 60 app->ConnectToService("mojo:mojo_view_manager", &init_svc);
61 base::Bind(&ConnectCallback)); 61 init_svc->Embed("mojo:mojo_wm_flow_app", sp.Pass(),
62 base::Bind(&ConnectCallback));
62 } 63 }
63 virtual bool ConfigureIncomingConnection( 64 virtual bool ConfigureIncomingConnection(
64 mojo::ApplicationConnection* connection) MOJO_OVERRIDE { 65 mojo::ApplicationConnection* connection) MOJO_OVERRIDE {
65 connection->AddService(&view_manager_client_factory_); 66 connection->AddService(&view_manager_client_factory_);
66 return true; 67 return true;
67 } 68 }
68 69
69 void OnConnect(bool success) {} 70 void OnConnect(bool success) {}
70 71
71 // Overridden from mojo::ViewManagerDelegate: 72 // Overridden from mojo::ViewManagerDelegate:
(...skipping 24 matching lines...) Expand all
96 mojo::ViewManager* view_manager) MOJO_OVERRIDE {} 97 mojo::ViewManager* view_manager) MOJO_OVERRIDE {}
97 98
98 void HelloBackAck() { 99 void HelloBackAck() {
99 printf("HelloBack() ack'ed\n"); 100 printf("HelloBack() ack'ed\n");
100 } 101 }
101 102
102 int embed_count_; 103 int embed_count_;
103 mojo::ViewManagerClientFactory view_manager_client_factory_; 104 mojo::ViewManagerClientFactory view_manager_client_factory_;
104 mojo::InterfaceFactoryImpl<EmbedderImpl> embedder_factory_; 105 mojo::InterfaceFactoryImpl<EmbedderImpl> embedder_factory_;
105 EmbeddeePtr embeddee_; 106 EmbeddeePtr embeddee_;
106 mojo::ViewManagerInitServicePtr init_svc_;
107 107
108 DISALLOW_COPY_AND_ASSIGN(WMFlowApp); 108 DISALLOW_COPY_AND_ASSIGN(WMFlowApp);
109 }; 109 };
110 110
111 } // namespace examples 111 } // namespace examples
112 112
113 namespace mojo { 113 namespace mojo {
114 114
115 // static 115 // static
116 ApplicationDelegate* ApplicationDelegate::Create() { 116 ApplicationDelegate* ApplicationDelegate::Create() {
117 return new examples::WMFlowApp; 117 return new examples::WMFlowApp;
118 } 118 }
119 119
120 } // namespace 120 } // namespace
OLDNEW
« no previous file with comments | « no previous file | mojo/services/view_manager/view_manager_init_service_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698