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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string_tokenizer.h" | 10 #include "base/strings/string_tokenizer.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 } | 84 } |
85 | 85 |
86 // Overridden from ApplicationDelegate: | 86 // Overridden from ApplicationDelegate: |
87 virtual bool ConfigureIncomingConnection( | 87 virtual bool ConfigureIncomingConnection( |
88 ApplicationConnection* connection) override { | 88 ApplicationConnection* connection) override { |
89 connection->AddService(view_manager_client_factory_.get()); | 89 connection->AddService(view_manager_client_factory_.get()); |
90 return true; | 90 return true; |
91 } | 91 } |
92 | 92 |
93 // Overridden from ViewManagerDelegate: | 93 // Overridden from ViewManagerDelegate: |
94 virtual void OnEmbed(ViewManager* view_manager, | 94 virtual void OnEmbed(View* root, |
95 View* root, | |
96 ServiceProviderImpl* exported_services, | 95 ServiceProviderImpl* exported_services, |
97 scoped_ptr<ServiceProvider> imported_services) override { | 96 scoped_ptr<ServiceProvider> imported_services) override { |
98 // TODO(qsr): The same view should be embeddable on multiple views. | 97 // TODO(qsr): The same view should be embeddable on multiple views. |
99 DCHECK(embedder_for_roots_.find(root) == embedder_for_roots_.end()); | 98 DCHECK(embedder_for_roots_.find(root) == embedder_for_roots_.end()); |
100 root->AddObserver(this); | 99 root->AddObserver(this); |
101 EmbedderData* embedder_data = new EmbedderData(app_->shell(), root); | 100 EmbedderData* embedder_data = new EmbedderData(app_->shell(), root); |
102 embedder_for_roots_[root] = embedder_data; | 101 embedder_for_roots_[root] = embedder_data; |
103 embedder_data->bitmap_uploader().SetBitmap( | 102 embedder_data->bitmap_uploader().SetBitmap( |
104 width_, height_, | 103 width_, height_, |
105 make_scoped_ptr(new std::vector<unsigned char>(*bitmap_)), | 104 make_scoped_ptr(new std::vector<unsigned char>(*bitmap_)), |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 DISALLOW_COPY_AND_ASSIGN(PNGViewer); | 221 DISALLOW_COPY_AND_ASSIGN(PNGViewer); |
223 }; | 222 }; |
224 | 223 |
225 } // namespace examples | 224 } // namespace examples |
226 } // namespace mojo | 225 } // namespace mojo |
227 | 226 |
228 MojoResult MojoMain(MojoHandle shell_handle) { | 227 MojoResult MojoMain(MojoHandle shell_handle) { |
229 mojo::ApplicationRunnerChromium runner(new mojo::examples::PNGViewer()); | 228 mojo::ApplicationRunnerChromium runner(new mojo::examples::PNGViewer()); |
230 return runner.Run(shell_handle); | 229 return runner.Run(shell_handle); |
231 } | 230 } |
OLD | NEW |