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

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

Issue 668483002: Change mojo URLs from mojo://mojo_foo to mojo://foo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 2 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
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 <map> 5 #include <map>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "mojo/application/application_runner_chromium.h" 10 #include "mojo/application/application_runner_chromium.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 root->AddChild(embed); 95 root->AddChild(embed);
96 gfx::Rect bounds = gfx::Rect(root->bounds().size()); 96 gfx::Rect bounds = gfx::Rect(root->bounds().size());
97 bounds.Inset(25, 25); 97 bounds.Inset(25, 25);
98 embed->SetBounds(bounds); 98 embed->SetBounds(bounds);
99 99
100 scoped_ptr<mojo::ServiceProviderImpl> registry( 100 scoped_ptr<mojo::ServiceProviderImpl> registry(
101 new mojo::ServiceProviderImpl); 101 new mojo::ServiceProviderImpl);
102 // Expose some services to the embeddee... 102 // Expose some services to the embeddee...
103 registry->AddService(&embedder_factory_); 103 registry->AddService(&embedder_factory_);
104 scoped_ptr<mojo::ServiceProvider> imported = 104 scoped_ptr<mojo::ServiceProvider> imported =
105 embed->Embed("mojo:mojo_wm_flow_embedded", registry.Pass()); 105 embed->Embed("mojo:wm_flow_embedded", registry.Pass());
106 mojo::ConnectToService(imported.get(), &embeddee_); 106 mojo::ConnectToService(imported.get(), &embeddee_);
107 embeddee_->HelloBack(base::Bind(&WMFlowApp::HelloBackAck, 107 embeddee_->HelloBack(base::Bind(&WMFlowApp::HelloBackAck,
108 base::Unretained(this))); 108 base::Unretained(this)));
109 } 109 }
110 virtual void OnViewManagerDisconnected( 110 virtual void OnViewManagerDisconnected(
111 mojo::ViewManager* view_manager) override { 111 mojo::ViewManager* view_manager) override {
112 STLDeleteValues(&uploaders_); 112 STLDeleteValues(&uploaders_);
113 } 113 }
114 114
115 // Overridden from mojo::ViewObserver: 115 // Overridden from mojo::ViewObserver:
(...skipping 10 matching lines...) Expand all
126 uploaders_.erase(view); 126 uploaders_.erase(view);
127 } 127 }
128 --embed_count_; 128 --embed_count_;
129 view->RemoveObserver(this); 129 view->RemoveObserver(this);
130 } 130 }
131 131
132 void HelloBackAck() { 132 void HelloBackAck() {
133 printf("HelloBack() ack'ed\n"); 133 printf("HelloBack() ack'ed\n");
134 } 134 }
135 135
136 void OpenNewWindow() { 136 void OpenNewWindow() { view_manager_context_->Embed("mojo:wm_flow_app"); }
137 view_manager_context_->Embed("mojo:mojo_wm_flow_app");
138 }
139 137
140 mojo::Shell* shell_; 138 mojo::Shell* shell_;
141 int embed_count_; 139 int embed_count_;
142 scoped_ptr<mojo::ViewManagerClientFactory> view_manager_client_factory_; 140 scoped_ptr<mojo::ViewManagerClientFactory> view_manager_client_factory_;
143 mojo::InterfaceFactoryImpl<EmbedderImpl> embedder_factory_; 141 mojo::InterfaceFactoryImpl<EmbedderImpl> embedder_factory_;
144 scoped_ptr<mojo::ViewManagerContext> view_manager_context_; 142 scoped_ptr<mojo::ViewManagerContext> view_manager_context_;
145 EmbeddeePtr embeddee_; 143 EmbeddeePtr embeddee_;
146 ViewToUploader uploaders_; 144 ViewToUploader uploaders_;
147 145
148 DISALLOW_COPY_AND_ASSIGN(WMFlowApp); 146 DISALLOW_COPY_AND_ASSIGN(WMFlowApp);
149 }; 147 };
150 148
151 } // namespace examples 149 } // namespace examples
152 150
153 MojoResult MojoMain(MojoHandle shell_handle) { 151 MojoResult MojoMain(MojoHandle shell_handle) {
154 mojo::ApplicationRunnerChromium runner(new examples::WMFlowApp); 152 mojo::ApplicationRunnerChromium runner(new examples::WMFlowApp);
155 return runner.Run(shell_handle); 153 return runner.Run(shell_handle);
156 } 154 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698