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 "mojo/public/cpp/application/application.h" | 5 #include "mojo/public/cpp/application/application.h" |
| 6 #include "mojo/services/public/cpp/view_manager/node.h" |
| 7 #include "mojo/services/public/cpp/view_manager/types.h" |
6 #include "mojo/services/public/cpp/view_manager/view.h" | 8 #include "mojo/services/public/cpp/view_manager/view.h" |
7 #include "mojo/services/public/cpp/view_manager/view_manager.h" | 9 #include "mojo/services/public/cpp/view_manager/view_manager.h" |
8 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" | 10 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" |
9 #include "mojo/services/public/cpp/view_manager/view_manager_types.h" | |
10 #include "mojo/services/public/cpp/view_manager/view_tree_node.h" | |
11 #include "mojo/services/public/interfaces/launcher/launcher.mojom.h" | 11 #include "mojo/services/public/interfaces/launcher/launcher.mojom.h" |
12 | 12 |
13 namespace mojo { | 13 namespace mojo { |
14 namespace examples { | 14 namespace examples { |
15 | 15 |
16 class HTMLViewer; | 16 class HTMLViewer; |
17 | 17 |
18 class LaunchableConnection : public InterfaceImpl<launcher::Launchable> { | 18 class LaunchableConnection : public InterfaceImpl<launcher::Launchable> { |
19 public: | 19 public: |
20 explicit LaunchableConnection(HTMLViewer* viewer) : viewer_(viewer) {} | 20 explicit LaunchableConnection(HTMLViewer* viewer) : viewer_(viewer) {} |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 friend class LaunchableConnection; | 68 friend class LaunchableConnection; |
69 | 69 |
70 // Overridden from Application: | 70 // Overridden from Application: |
71 virtual void Initialize() OVERRIDE { | 71 virtual void Initialize() OVERRIDE { |
72 AddService<LaunchableConnection>(this); | 72 AddService<LaunchableConnection>(this); |
73 view_manager::ViewManager::Create(this, this); | 73 view_manager::ViewManager::Create(this, this); |
74 } | 74 } |
75 | 75 |
76 // Overridden from view_manager::ViewManagerDelegate: | 76 // Overridden from view_manager::ViewManagerDelegate: |
77 virtual void OnRootAdded(view_manager::ViewManager* view_manager, | 77 virtual void OnRootAdded(view_manager::ViewManager* view_manager, |
78 view_manager::ViewTreeNode* root) OVERRIDE { | 78 view_manager::Node* root) OVERRIDE { |
79 content_view_ = view_manager::View::Create(view_manager); | 79 content_view_ = view_manager::View::Create(view_manager); |
80 root->SetActiveView(content_view_); | 80 root->SetActiveView(content_view_); |
81 content_view_->SetColor(SK_ColorRED); | 81 content_view_->SetColor(SK_ColorRED); |
82 } | 82 } |
83 | 83 |
84 view_manager::View* content_view_; | 84 view_manager::View* content_view_; |
85 | 85 |
86 DISALLOW_COPY_AND_ASSIGN(HTMLViewer); | 86 DISALLOW_COPY_AND_ASSIGN(HTMLViewer); |
87 }; | 87 }; |
88 | 88 |
89 void LaunchableConnection::UpdateView() { | 89 void LaunchableConnection::UpdateView() { |
90 viewer_->content_view_->SetColor(SK_ColorGREEN); | 90 viewer_->content_view_->SetColor(SK_ColorGREEN); |
91 } | 91 } |
92 | 92 |
93 } | 93 } |
94 | 94 |
95 // static | 95 // static |
96 Application* Application::Create() { | 96 Application* Application::Create() { |
97 return new examples::HTMLViewer; | 97 return new examples::HTMLViewer; |
98 } | 98 } |
99 | 99 |
100 } | 100 } |
OLD | NEW |