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

Side by Side Diff: examples/ganesh_app/ganesh_app.cc

Issue 1559723002: Update the UI examples. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-14
Patch Set: address feedback Created 4 years, 11 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
« no previous file with comments | « examples/ganesh_app/README.md ('k') | examples/ganesh_app/ganesh_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/macros.h"
6 #include "base/trace_event/trace_event.h"
7 #include "examples/ganesh_app/ganesh_view.h"
8 #include "mojo/application/application_runner_chromium.h"
9 #include "mojo/common/tracing_impl.h"
10 #include "mojo/public/c/system/main.h"
11 #include "mojo/public/cpp/application/application_connection.h"
12 #include "mojo/public/cpp/application/application_delegate.h"
13 #include "mojo/public/cpp/application/application_impl.h"
14 #include "mojo/services/view_manager/cpp/view_manager.h"
15 #include "mojo/services/view_manager/cpp/view_manager_client_factory.h"
16 #include "mojo/services/view_manager/cpp/view_manager_delegate.h"
17
18 namespace examples {
19
20 class GaneshApp : public mojo::ApplicationDelegate,
21 public mojo::ViewManagerDelegate {
22 public:
23 GaneshApp() {}
24 ~GaneshApp() override {}
25
26 void Initialize(mojo::ApplicationImpl* app) override {
27 tracing_.Initialize(app);
28 TRACE_EVENT0("ganesh_app", __func__);
29 shell_ = app->shell();
30 view_manager_client_factory_.reset(
31 new mojo::ViewManagerClientFactory(app->shell(), this));
32 }
33
34 bool ConfigureIncomingConnection(
35 mojo::ApplicationConnection* connection) override {
36 TRACE_EVENT0("ganesh_app", __func__);
37 connection->AddService(view_manager_client_factory_.get());
38 return true;
39 }
40
41 void OnEmbed(mojo::View* root,
42 mojo::InterfaceRequest<mojo::ServiceProvider> services,
43 mojo::ServiceProviderPtr exposed_services) override {
44 TRACE_EVENT0("ganesh_app", __func__);
45 new GaneshView(shell_, root);
46 }
47
48 void OnViewManagerDisconnected(mojo::ViewManager* view_manager) override {
49 base::MessageLoop::current()->Quit();
50 }
51
52 private:
53 mojo::TracingImpl tracing_;
54 mojo::Shell* shell_;
55 scoped_ptr<mojo::ViewManagerClientFactory> view_manager_client_factory_;
56
57 DISALLOW_COPY_AND_ASSIGN(GaneshApp);
58 };
59
60 } // namespace examples
61
62 MojoResult MojoMain(MojoHandle application_request) {
63 mojo::ApplicationRunnerChromium runner(new examples::GaneshApp);
64 return runner.Run(application_request);
65 }
OLDNEW
« no previous file with comments | « examples/ganesh_app/README.md ('k') | examples/ganesh_app/ganesh_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698