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