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 "base/logging.h" | 6 #include "base/logging.h" |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "examples/bitmap_uploader/bitmap_uploader.h" | 10 #include "examples/bitmap_uploader/bitmap_uploader.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 new ViewManagerClientFactory(app->shell(), this)); | 64 new ViewManagerClientFactory(app->shell(), this)); |
65 } | 65 } |
66 | 66 |
67 virtual bool ConfigureIncomingConnection( | 67 virtual bool ConfigureIncomingConnection( |
68 ApplicationConnection* connection) override { | 68 ApplicationConnection* connection) override { |
69 connection->AddService(view_manager_client_factory_.get()); | 69 connection->AddService(view_manager_client_factory_.get()); |
70 return true; | 70 return true; |
71 } | 71 } |
72 | 72 |
73 // Overridden from ViewManagerDelegate: | 73 // Overridden from ViewManagerDelegate: |
74 virtual void OnEmbed(ViewManager* view_manager, | 74 virtual void OnEmbed(View* root, |
75 View* root, | |
76 ServiceProviderImpl* exported_services, | 75 ServiceProviderImpl* exported_services, |
77 scoped_ptr<ServiceProvider> imported_services) override { | 76 scoped_ptr<ServiceProvider> imported_services) override { |
78 root->AddObserver(this); | 77 root->AddObserver(this); |
79 Window* window = new Window(root, imported_services.Pass(), shell_); | 78 Window* window = new Window(root, imported_services.Pass(), shell_); |
80 windows_[root->id()] = window; | 79 windows_[root->id()] = window; |
81 window->bitmap_uploader.SetColor( | 80 window->bitmap_uploader.SetColor( |
82 kColors[next_color_++ % arraysize(kColors)]); | 81 kColors[next_color_++ % arraysize(kColors)]); |
83 } | 82 } |
84 virtual void OnViewManagerDisconnected(ViewManager* view_manager) override { | 83 virtual void OnViewManagerDisconnected(ViewManager* view_manager) override { |
85 base::MessageLoop::current()->Quit(); | 84 base::MessageLoop::current()->Quit(); |
(...skipping 28 matching lines...) Expand all Loading... |
114 DISALLOW_COPY_AND_ASSIGN(EmbeddedApp); | 113 DISALLOW_COPY_AND_ASSIGN(EmbeddedApp); |
115 }; | 114 }; |
116 | 115 |
117 } // namespace examples | 116 } // namespace examples |
118 } // namespace mojo | 117 } // namespace mojo |
119 | 118 |
120 MojoResult MojoMain(MojoHandle shell_handle) { | 119 MojoResult MojoMain(MojoHandle shell_handle) { |
121 mojo::ApplicationRunnerChromium runner(new mojo::examples::EmbeddedApp); | 120 mojo::ApplicationRunnerChromium runner(new mojo::examples::EmbeddedApp); |
122 return runner.Run(shell_handle); | 121 return runner.Run(shell_handle); |
123 } | 122 } |
OLD | NEW |