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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "mojo/public/cpp/application/application.h" | 6 #include "mojo/public/cpp/application/application.h" |
7 #include "mojo/services/public/cpp/view_manager/node.h" | 7 #include "mojo/services/public/cpp/view_manager/node.h" |
8 #include "mojo/services/public/cpp/view_manager/view.h" | 8 #include "mojo/services/public/cpp/view_manager/view.h" |
9 #include "mojo/services/public/cpp/view_manager/view_manager.h" | 9 #include "mojo/services/public/cpp/view_manager/view_manager.h" |
10 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" | 10 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 view_ = view_manager::View::Create(view_manager_); | 120 view_ = view_manager::View::Create(view_manager_); |
121 view_manager_->GetRoots().front()->SetActiveView(view_); | 121 view_manager_->GetRoots().front()->SetActiveView(view_); |
122 | 122 |
123 content_node_ = view_manager::Node::Create(view_manager_); | 123 content_node_ = view_manager::Node::Create(view_manager_); |
124 root->AddChild(content_node_); | 124 root->AddChild(content_node_); |
125 | 125 |
126 root->SetFocus(); | 126 root->SetFocus(); |
127 | 127 |
128 CreateWidget(root->bounds().size()); | 128 CreateWidget(root->bounds().size()); |
129 } | 129 } |
130 virtual void OnRootRemoved(view_manager::ViewManager* view_manager, | |
131 view_manager::Node* root) OVERRIDE { | |
132 } | |
133 | 130 |
134 // views::TextfieldController: | 131 // views::TextfieldController: |
135 virtual bool HandleKeyEvent(views::Textfield* sender, | 132 virtual bool HandleKeyEvent(views::Textfield* sender, |
136 const ui::KeyEvent& key_event) OVERRIDE { | 133 const ui::KeyEvent& key_event) OVERRIDE { |
137 if (key_event.key_code() == ui::VKEY_RETURN) { | 134 if (key_event.key_code() == ui::VKEY_RETURN) { |
138 GURL url(sender->text()); | 135 GURL url(sender->text()); |
139 printf("User entered this URL: %s\n", url.spec().c_str()); | 136 printf("User entered this URL: %s\n", url.spec().c_str()); |
140 launcher_->Launch(url.spec()); | 137 launcher_->Launch(url.spec()); |
141 } | 138 } |
142 return false; | 139 return false; |
(...skipping 24 matching lines...) Expand all Loading... |
167 }; | 164 }; |
168 | 165 |
169 } // namespace examples | 166 } // namespace examples |
170 | 167 |
171 // static | 168 // static |
172 Application* Application::Create() { | 169 Application* Application::Create() { |
173 return new examples::Browser; | 170 return new examples::Browser; |
174 } | 171 } |
175 | 172 |
176 } // namespace mojo | 173 } // namespace mojo |
OLD | NEW |