| 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 "base/strings/string_util.h" | 6 #include "base/strings/string_util.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "mojo/common/common_type_converters.h" | 8 #include "mojo/common/common_type_converters.h" |
| 9 #include "mojo/examples/window_manager/window_manager.mojom.h" | 9 #include "mojo/examples/window_manager/window_manager.mojom.h" |
| 10 #include "mojo/public/c/system/main.h" | 10 #include "mojo/public/c/system/main.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 view_manager_ = NULL; | 222 view_manager_ = NULL; |
| 223 base::MessageLoop::current()->Quit(); | 223 base::MessageLoop::current()->Quit(); |
| 224 } | 224 } |
| 225 | 225 |
| 226 // views::TextfieldController: | 226 // views::TextfieldController: |
| 227 virtual bool HandleKeyEvent(views::Textfield* sender, | 227 virtual bool HandleKeyEvent(views::Textfield* sender, |
| 228 const ui::KeyEvent& key_event) OVERRIDE { | 228 const ui::KeyEvent& key_event) OVERRIDE { |
| 229 if (key_event.key_code() == ui::VKEY_RETURN) { | 229 if (key_event.key_code() == ui::VKEY_RETURN) { |
| 230 GURL url(sender->text()); | 230 GURL url(sender->text()); |
| 231 printf("User entered this URL: %s\n", url.spec().c_str()); | 231 printf("User entered this URL: %s\n", url.spec().c_str()); |
| 232 NavigationDetailsPtr nav_details(NavigationDetails::New()); | 232 URLRequestPtr request(URLRequest::New()); |
| 233 nav_details->request->url = String::From(url); | 233 request->url = String::From(url); |
| 234 navigator_host_->RequestNavigate(TARGET_NEW_NODE, nav_details.Pass()); | 234 navigator_host_->RequestNavigate(TARGET_NEW_NODE, request.Pass()); |
| 235 } | 235 } |
| 236 return false; | 236 return false; |
| 237 } | 237 } |
| 238 | 238 |
| 239 // ViewObserver: | 239 // ViewObserver: |
| 240 virtual void OnViewFocusChanged(View* gained_focus, | 240 virtual void OnViewFocusChanged(View* gained_focus, |
| 241 View* lost_focus) OVERRIDE { | 241 View* lost_focus) OVERRIDE { |
| 242 aura::client::FocusClient* focus_client = | 242 aura::client::FocusClient* focus_client = |
| 243 aura::client::GetFocusClient(widget_->GetNativeView()); | 243 aura::client::GetFocusClient(widget_->GetNativeView()); |
| 244 if (lost_focus == root_) | 244 if (lost_focus == root_) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 264 DISALLOW_COPY_AND_ASSIGN(Browser); | 264 DISALLOW_COPY_AND_ASSIGN(Browser); |
| 265 }; | 265 }; |
| 266 | 266 |
| 267 } // namespace examples | 267 } // namespace examples |
| 268 } // namespace mojo | 268 } // namespace mojo |
| 269 | 269 |
| 270 MojoResult MojoMain(MojoHandle shell_handle) { | 270 MojoResult MojoMain(MojoHandle shell_handle) { |
| 271 mojo::ApplicationRunnerChromium runner(new mojo::examples::Browser); | 271 mojo::ApplicationRunnerChromium runner(new mojo::examples::Browser); |
| 272 return runner.Run(shell_handle); | 272 return runner.Run(shell_handle); |
| 273 } | 273 } |
| OLD | NEW |