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/strings/string_tokenizer.h" | 7 #include "base/strings/string_tokenizer.h" |
8 #include "mojo/public/cpp/application/application.h" | 8 #include "mojo/public/cpp/application/application.h" |
| 9 #include "mojo/services/public/cpp/view_manager/node.h" |
| 10 #include "mojo/services/public/cpp/view_manager/types.h" |
9 #include "mojo/services/public/cpp/view_manager/view.h" | 11 #include "mojo/services/public/cpp/view_manager/view.h" |
10 #include "mojo/services/public/cpp/view_manager/view_manager.h" | 12 #include "mojo/services/public/cpp/view_manager/view_manager.h" |
11 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" | 13 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" |
12 #include "mojo/services/public/cpp/view_manager/view_manager_types.h" | |
13 #include "mojo/services/public/cpp/view_manager/view_tree_node.h" | |
14 #include "mojo/services/public/interfaces/launcher/launcher.mojom.h" | 14 #include "mojo/services/public/interfaces/launcher/launcher.mojom.h" |
15 #include "third_party/skia/include/core/SkBitmap.h" | 15 #include "third_party/skia/include/core/SkBitmap.h" |
16 #include "ui/gfx/codec/png_codec.h" | 16 #include "ui/gfx/codec/png_codec.h" |
17 | 17 |
18 namespace mojo { | 18 namespace mojo { |
19 namespace examples { | 19 namespace examples { |
20 | 20 |
21 class ImageViewer; | 21 class ImageViewer; |
22 | 22 |
23 class LaunchableConnection : public InterfaceImpl<launcher::Launchable> { | 23 class LaunchableConnection : public InterfaceImpl<launcher::Launchable> { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 96 |
97 private: | 97 private: |
98 // Overridden from Application: | 98 // Overridden from Application: |
99 virtual void Initialize() OVERRIDE { | 99 virtual void Initialize() OVERRIDE { |
100 AddService<LaunchableConnection>(this); | 100 AddService<LaunchableConnection>(this); |
101 view_manager::ViewManager::Create(this, this); | 101 view_manager::ViewManager::Create(this, this); |
102 } | 102 } |
103 | 103 |
104 // Overridden from view_manager::ViewManagerDelegate: | 104 // Overridden from view_manager::ViewManagerDelegate: |
105 virtual void OnRootAdded(view_manager::ViewManager* view_manager, | 105 virtual void OnRootAdded(view_manager::ViewManager* view_manager, |
106 view_manager::ViewTreeNode* root) OVERRIDE { | 106 view_manager::Node* root) OVERRIDE { |
107 content_view_ = view_manager::View::Create(view_manager); | 107 content_view_ = view_manager::View::Create(view_manager); |
108 root->SetActiveView(content_view_); | 108 root->SetActiveView(content_view_); |
109 content_view_->SetColor(SK_ColorRED); | 109 content_view_->SetColor(SK_ColorRED); |
110 if (!bitmap_.isNull()) | 110 if (!bitmap_.isNull()) |
111 DrawBitmap(); | 111 DrawBitmap(); |
112 } | 112 } |
113 | 113 |
114 void DrawBitmap() { | 114 void DrawBitmap() { |
115 if (content_view_) | 115 if (content_view_) |
116 content_view_->SetContents(bitmap_); | 116 content_view_->SetContents(bitmap_); |
(...skipping 11 matching lines...) Expand all Loading... |
128 } | 128 } |
129 | 129 |
130 } // namespace examples | 130 } // namespace examples |
131 | 131 |
132 // static | 132 // static |
133 Application* Application::Create() { | 133 Application* Application::Create() { |
134 return new examples::ImageViewer; | 134 return new examples::ImageViewer; |
135 } | 135 } |
136 | 136 |
137 } // namespace mojo | 137 } // namespace mojo |
OLD | NEW |