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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/macros.h" | 6 #include "base/macros.h" |
7 #include "examples/keyboard/keyboard.mojom.h" | 7 #include "examples/keyboard/keyboard.mojom.h" |
8 #include "examples/window_manager/debug_panel.h" | 8 #include "examples/window_manager/debug_panel.h" |
9 #include "examples/window_manager/window_manager.mojom.h" | 9 #include "examples/window_manager/window_manager.mojom.h" |
10 #include "mojo/application/application_runner_chromium.h" | 10 #include "mojo/application/application_runner_chromium.h" |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 // Overridden from WindowManagerDelegate: | 389 // Overridden from WindowManagerDelegate: |
390 virtual void Embed( | 390 virtual void Embed( |
391 const String& url, | 391 const String& url, |
392 InterfaceRequest<ServiceProvider> service_provider) override { | 392 InterfaceRequest<ServiceProvider> service_provider) override { |
393 const Id kInvalidSourceViewId = 0; | 393 const Id kInvalidSourceViewId = 0; |
394 OnLaunch(kInvalidSourceViewId, TARGET_DEFAULT, url); | 394 OnLaunch(kInvalidSourceViewId, TARGET_DEFAULT, url); |
395 } | 395 } |
396 | 396 |
397 // Overridden from ui::EventHandler: | 397 // Overridden from ui::EventHandler: |
398 virtual void OnEvent(ui::Event* event) override { | 398 virtual void OnEvent(ui::Event* event) override { |
399 View* view = WindowManagerApp::GetViewForViewTarget( | 399 View* view = static_cast<ViewTarget*>(event->target())->view(); |
400 static_cast<ViewTarget*>(event->target())); | |
401 if (event->type() == ui::ET_MOUSE_PRESSED && | 400 if (event->type() == ui::ET_MOUSE_PRESSED && |
402 !IsDescendantOfKeyboard(view)) { | 401 !IsDescendantOfKeyboard(view)) { |
403 view->SetFocus(); | 402 view->SetFocus(); |
404 } | 403 } |
405 } | 404 } |
406 | 405 |
407 void OnLaunch(uint32 source_view_id, | 406 void OnLaunch(uint32 source_view_id, |
408 Target requested_target, | 407 Target requested_target, |
409 const mojo::String& url) { | 408 const mojo::String& url) { |
410 Target target = debug_panel_->navigation_target(); | 409 Target target = debug_panel_->navigation_target(); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 window_manager_->RequestNavigate(view_id_, target, request.Pass()); | 547 window_manager_->RequestNavigate(view_id_, target, request.Pass()); |
549 } | 548 } |
550 | 549 |
551 } // namespace examples | 550 } // namespace examples |
552 } // namespace mojo | 551 } // namespace mojo |
553 | 552 |
554 MojoResult MojoMain(MojoHandle shell_handle) { | 553 MojoResult MojoMain(MojoHandle shell_handle) { |
555 mojo::ApplicationRunnerChromium runner(new mojo::examples::WindowManager); | 554 mojo::ApplicationRunnerChromium runner(new mojo::examples::WindowManager); |
556 return runner.Run(shell_handle); | 555 return runner.Run(shell_handle); |
557 } | 556 } |
OLD | NEW |