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/bind.h" | 6 #include "base/bind.h" |
7 #include "mojo/application/application_runner_chromium.h" | 7 #include "mojo/application/application_runner_chromium.h" |
8 #include "mojo/examples/keyboard/keyboard.mojom.h" | 8 #include "mojo/examples/keyboard/keyboard.mojom.h" |
9 #include "mojo/examples/window_manager/debug_panel.h" | 9 #include "mojo/examples/window_manager/debug_panel.h" |
10 #include "mojo/examples/window_manager/window_manager.mojom.h" | 10 #include "mojo/examples/window_manager/window_manager.mojom.h" |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 virtual void RequestNavigate(uint32 source_view_id, | 341 virtual void RequestNavigate(uint32 source_view_id, |
342 Target target, | 342 Target target, |
343 URLRequestPtr request) OVERRIDE { | 343 URLRequestPtr request) OVERRIDE { |
344 OnLaunch(source_view_id, target, request->url); | 344 OnLaunch(source_view_id, target, request->url); |
345 } | 345 } |
346 | 346 |
347 private: | 347 private: |
348 typedef std::vector<Window*> WindowVector; | 348 typedef std::vector<Window*> WindowVector; |
349 | 349 |
350 // Overridden from ApplicationDelegate: | 350 // Overridden from ApplicationDelegate: |
351 virtual void Initialize(ApplicationImpl* app) MOJO_OVERRIDE { | 351 virtual void Initialize(ApplicationImpl* app) override { |
352 app_ = app; | 352 app_ = app; |
353 views_init_.reset(new ViewsInit); | 353 views_init_.reset(new ViewsInit); |
354 window_manager_app_->Initialize(app); | 354 window_manager_app_->Initialize(app); |
355 } | 355 } |
356 | 356 |
357 virtual bool ConfigureIncomingConnection(ApplicationConnection* connection) | 357 virtual bool ConfigureIncomingConnection( |
358 MOJO_OVERRIDE { | 358 ApplicationConnection* connection) override { |
359 connection->AddService(&window_manager_factory_); | 359 connection->AddService(&window_manager_factory_); |
360 window_manager_app_->ConfigureIncomingConnection(connection); | 360 window_manager_app_->ConfigureIncomingConnection(connection); |
361 return true; | 361 return true; |
362 } | 362 } |
363 | 363 |
364 // Overridden from ViewManagerDelegate: | 364 // Overridden from ViewManagerDelegate: |
365 virtual void OnEmbed(ViewManager* view_manager, | 365 virtual void OnEmbed(ViewManager* view_manager, |
366 View* root, | 366 View* root, |
367 ServiceProviderImpl* exported_services, | 367 ServiceProviderImpl* exported_services, |
368 scoped_ptr<ServiceProvider> imported_services) OVERRIDE { | 368 scoped_ptr<ServiceProvider> imported_services) OVERRIDE { |
(...skipping 23 matching lines...) Expand all Loading... |
392 base::MessageLoop::current()->Quit(); | 392 base::MessageLoop::current()->Quit(); |
393 } | 393 } |
394 | 394 |
395 // Overridden from WindowManagerDelegate: | 395 // Overridden from WindowManagerDelegate: |
396 virtual void Embed( | 396 virtual void Embed( |
397 const String& url, | 397 const String& url, |
398 InterfaceRequest<ServiceProvider> service_provider) OVERRIDE { | 398 InterfaceRequest<ServiceProvider> service_provider) OVERRIDE { |
399 const Id kInvalidSourceViewId = 0; | 399 const Id kInvalidSourceViewId = 0; |
400 OnLaunch(kInvalidSourceViewId, TARGET_DEFAULT, url); | 400 OnLaunch(kInvalidSourceViewId, TARGET_DEFAULT, url); |
401 } | 401 } |
402 virtual void DispatchEvent(EventPtr event) MOJO_OVERRIDE {} | 402 virtual void DispatchEvent(EventPtr event) override {} |
403 | 403 |
404 // Overridden from ui::EventHandler: | 404 // Overridden from ui::EventHandler: |
405 virtual void OnEvent(ui::Event* event) OVERRIDE { | 405 virtual void OnEvent(ui::Event* event) OVERRIDE { |
406 View* view = WindowManagerApp::GetViewForWindow( | 406 View* view = WindowManagerApp::GetViewForWindow( |
407 static_cast<aura::Window*>(event->target())); | 407 static_cast<aura::Window*>(event->target())); |
408 if (event->type() == ui::ET_MOUSE_PRESSED && | 408 if (event->type() == ui::ET_MOUSE_PRESSED && |
409 !IsDescendantOfKeyboard(view)) { | 409 !IsDescendantOfKeyboard(view)) { |
410 view->SetFocus(); | 410 view->SetFocus(); |
411 } | 411 } |
412 } | 412 } |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 window_manager_->RequestNavigate(view_id_, target, request.Pass()); | 552 window_manager_->RequestNavigate(view_id_, target, request.Pass()); |
553 } | 553 } |
554 | 554 |
555 } // namespace examples | 555 } // namespace examples |
556 } // namespace mojo | 556 } // namespace mojo |
557 | 557 |
558 MojoResult MojoMain(MojoHandle shell_handle) { | 558 MojoResult MojoMain(MojoHandle shell_handle) { |
559 mojo::ApplicationRunnerChromium runner(new mojo::examples::WindowManager); | 559 mojo::ApplicationRunnerChromium runner(new mojo::examples::WindowManager); |
560 return runner.Run(shell_handle); | 560 return runner.Run(shell_handle); |
561 } | 561 } |
OLD | NEW |