| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "examples/wm_flow/wm/frame_controller.h" | 7 #include "examples/wm_flow/wm/frame_controller.h" |
| 8 #include "mojo/application/application_runner_chromium.h" | 8 #include "mojo/application/application_runner_chromium.h" |
| 9 #include "mojo/public/c/system/main.h" | 9 #include "mojo/public/c/system/main.h" |
| 10 #include "mojo/public/cpp/application/application_delegate.h" | 10 #include "mojo/public/cpp/application/application_delegate.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 return true; | 50 return true; |
| 51 } | 51 } |
| 52 | 52 |
| 53 // Overridden from mojo::ViewManagerDelegate: | 53 // Overridden from mojo::ViewManagerDelegate: |
| 54 virtual void OnEmbed( | 54 virtual void OnEmbed( |
| 55 mojo::View* root, | 55 mojo::View* root, |
| 56 mojo::ServiceProviderImpl* exported_services, | 56 mojo::ServiceProviderImpl* exported_services, |
| 57 scoped_ptr<mojo::ServiceProvider> remote_service_provider) override { | 57 scoped_ptr<mojo::ServiceProvider> remote_service_provider) override { |
| 58 root_ = root; | 58 root_ = root; |
| 59 | 59 |
| 60 window_container_ = mojo::View::Create(root->view_manager()); | 60 window_container_ = root->view_manager()->CreateView(); |
| 61 window_container_->SetBounds(root_->bounds()); | 61 window_container_->SetBounds(root_->bounds()); |
| 62 root_->AddChild(window_container_); | 62 root_->AddChild(window_container_); |
| 63 window_container_->SetVisible(true); | 63 window_container_->SetVisible(true); |
| 64 | 64 |
| 65 window_manager_app_->InitFocus(make_scoped_ptr( | 65 window_manager_app_->InitFocus(make_scoped_ptr( |
| 66 new window_manager::BasicFocusRules(window_container_))); | 66 new window_manager::BasicFocusRules(window_container_))); |
| 67 } | 67 } |
| 68 virtual void OnViewManagerDisconnected( | 68 virtual void OnViewManagerDisconnected( |
| 69 mojo::ViewManager* view_manager) override { | 69 mojo::ViewManager* view_manager) override { |
| 70 root_ = NULL; | 70 root_ = NULL; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 100 } | 100 } |
| 101 | 101 |
| 102 void CloseWindow(mojo::View* view) { | 102 void CloseWindow(mojo::View* view) { |
| 103 mojo::View* first_child = view->children().front(); | 103 mojo::View* first_child = view->children().front(); |
| 104 first_child->Destroy(); | 104 first_child->Destroy(); |
| 105 view->Destroy(); | 105 view->Destroy(); |
| 106 next_window_origin_.Offset(-50, -50); | 106 next_window_origin_.Offset(-50, -50); |
| 107 } | 107 } |
| 108 | 108 |
| 109 mojo::View* CreateTopLevelWindow(mojo::View** app_view) { | 109 mojo::View* CreateTopLevelWindow(mojo::View** app_view) { |
| 110 mojo::View* frame_view = mojo::View::Create(root_->view_manager()); | 110 mojo::View* frame_view = root_->view_manager()->CreateView(); |
| 111 // Add the View to it's parent before showing so that animations can happen. | 111 // Add the View to it's parent before showing so that animations can happen. |
| 112 window_container_->AddChild(frame_view); | 112 window_container_->AddChild(frame_view); |
| 113 mojo::Rect rect; | 113 mojo::Rect rect; |
| 114 rect.x = next_window_origin_.x(); | 114 rect.x = next_window_origin_.x(); |
| 115 rect.y = next_window_origin_.y(); | 115 rect.y = next_window_origin_.y(); |
| 116 rect.width = rect.height = 400; | 116 rect.width = rect.height = 400; |
| 117 frame_view->SetBounds(rect); | 117 frame_view->SetBounds(rect); |
| 118 next_window_origin_.Offset(50, 50); | 118 next_window_origin_.Offset(50, 50); |
| 119 | 119 |
| 120 new FrameController( | 120 new FrameController( |
| (...skipping 14 matching lines...) Expand all Loading... |
| 135 | 135 |
| 136 DISALLOW_COPY_AND_ASSIGN(SimpleWM); | 136 DISALLOW_COPY_AND_ASSIGN(SimpleWM); |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 } // namespace examples | 139 } // namespace examples |
| 140 | 140 |
| 141 MojoResult MojoMain(MojoHandle shell_handle) { | 141 MojoResult MojoMain(MojoHandle shell_handle) { |
| 142 mojo::ApplicationRunnerChromium runner(new examples::SimpleWM); | 142 mojo::ApplicationRunnerChromium runner(new examples::SimpleWM); |
| 143 return runner.Run(shell_handle); | 143 return runner.Run(shell_handle); |
| 144 } | 144 } |
| OLD | NEW |