| 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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 } | 339 } |
| 340 | 340 |
| 341 virtual bool ConfigureIncomingConnection( | 341 virtual bool ConfigureIncomingConnection( |
| 342 ApplicationConnection* connection) override { | 342 ApplicationConnection* connection) override { |
| 343 connection->AddService(&window_manager_factory_); | 343 connection->AddService(&window_manager_factory_); |
| 344 window_manager_app_->ConfigureIncomingConnection(connection); | 344 window_manager_app_->ConfigureIncomingConnection(connection); |
| 345 return true; | 345 return true; |
| 346 } | 346 } |
| 347 | 347 |
| 348 // Overridden from ViewManagerDelegate: | 348 // Overridden from ViewManagerDelegate: |
| 349 virtual void OnEmbed(ViewManager* view_manager, | 349 virtual void OnEmbed(View* root, |
| 350 View* root, | |
| 351 ServiceProviderImpl* exported_services, | 350 ServiceProviderImpl* exported_services, |
| 352 scoped_ptr<ServiceProvider> imported_services) override { | 351 scoped_ptr<ServiceProvider> imported_services) override { |
| 353 DCHECK(!view_manager_); | 352 DCHECK(!view_manager_); |
| 354 view_manager_ = view_manager; | 353 view_manager_ = root->view_manager(); |
| 355 | 354 |
| 356 View* view = View::Create(view_manager_); | 355 View* view = View::Create(view_manager_); |
| 357 root->AddChild(view); | 356 root->AddChild(view); |
| 358 Rect rect; | 357 Rect rect; |
| 359 rect.width = root->bounds().width; | 358 rect.width = root->bounds().width; |
| 360 rect.height = root->bounds().height; | 359 rect.height = root->bounds().height; |
| 361 view->SetBounds(rect); | 360 view->SetBounds(rect); |
| 362 view->SetVisible(true); | 361 view->SetVisible(true); |
| 363 content_view_id_ = view->id(); | 362 content_view_id_ = view->id(); |
| 364 | 363 |
| 365 Id launcher_ui_id = CreateLauncherUI(); | 364 Id launcher_ui_id = CreateLauncherUI(); |
| 366 Id control_panel_id = CreateControlPanel(view); | 365 Id control_panel_id = CreateControlPanel(view); |
| 367 | 366 |
| 368 root_layout_manager_.reset( | 367 root_layout_manager_.reset( |
| 369 new RootLayoutManager(view_manager, root, | 368 new RootLayoutManager(view_manager_, root, content_view_id_, |
| 370 content_view_id_, | 369 launcher_ui_id, control_panel_id)); |
| 371 launcher_ui_id, | |
| 372 control_panel_id)); | |
| 373 root->AddObserver(root_layout_manager_.get()); | 370 root->AddObserver(root_layout_manager_.get()); |
| 374 | 371 |
| 375 // TODO(erg): In the aura version, we explicitly added ourselves as a | 372 // TODO(erg): In the aura version, we explicitly added ourselves as a |
| 376 // PreTargetHandler to the window() here. We probably have to do something | 373 // PreTargetHandler to the window() here. We probably have to do something |
| 377 // analogous here. | 374 // analogous here. |
| 378 | 375 |
| 379 window_manager_app_->InitFocus( | 376 window_manager_app_->InitFocus( |
| 380 make_scoped_ptr(new window_manager::BasicFocusRules(view))); | 377 make_scoped_ptr(new window_manager::BasicFocusRules(view))); |
| 381 } | 378 } |
| 382 virtual void OnViewManagerDisconnected(ViewManager* view_manager) override { | 379 virtual void OnViewManagerDisconnected(ViewManager* view_manager) override { |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 window_manager_->RequestNavigate(view_id_, target, request.Pass()); | 546 window_manager_->RequestNavigate(view_id_, target, request.Pass()); |
| 550 } | 547 } |
| 551 | 548 |
| 552 } // namespace examples | 549 } // namespace examples |
| 553 } // namespace mojo | 550 } // namespace mojo |
| 554 | 551 |
| 555 MojoResult MojoMain(MojoHandle shell_handle) { | 552 MojoResult MojoMain(MojoHandle shell_handle) { |
| 556 mojo::ApplicationRunnerChromium runner(new mojo::examples::WindowManager); | 553 mojo::ApplicationRunnerChromium runner(new mojo::examples::WindowManager); |
| 557 return runner.Run(shell_handle); | 554 return runner.Run(shell_handle); |
| 558 } | 555 } |
| OLD | NEW |