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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 194 |
195 private: | 195 private: |
196 // Overridden from ViewObserver: | 196 // Overridden from ViewObserver: |
197 virtual void OnViewBoundsChanged(View* view, | 197 virtual void OnViewBoundsChanged(View* view, |
198 const gfx::Rect& old_bounds, | 198 const gfx::Rect& old_bounds, |
199 const gfx::Rect& new_bounds) OVERRIDE { | 199 const gfx::Rect& new_bounds) OVERRIDE { |
200 DCHECK_EQ(view, root_); | 200 DCHECK_EQ(view, root_); |
201 | 201 |
202 View* content_view = view_manager_->GetViewById(content_view_id_); | 202 View* content_view = view_manager_->GetViewById(content_view_id_); |
203 content_view->SetBounds(new_bounds); | 203 content_view->SetBounds(new_bounds); |
204 // Force the view's bitmap to be recreated | |
205 content_view->SetColor(SK_ColorBLUE); | |
206 | 204 |
207 int delta_width = new_bounds.width() - old_bounds.width(); | 205 int delta_width = new_bounds.width() - old_bounds.width(); |
208 int delta_height = new_bounds.height() - old_bounds.height(); | 206 int delta_height = new_bounds.height() - old_bounds.height(); |
209 | 207 |
210 View* launcher_ui_view = | 208 View* launcher_ui_view = |
211 view_manager_->GetViewById(launcher_ui_view_id_); | 209 view_manager_->GetViewById(launcher_ui_view_id_); |
212 gfx::Rect launcher_ui_bounds(launcher_ui_view->bounds()); | 210 gfx::Rect launcher_ui_bounds(launcher_ui_view->bounds()); |
213 launcher_ui_bounds.set_width(launcher_ui_bounds.width() + delta_width); | 211 launcher_ui_bounds.set_width(launcher_ui_bounds.width() + delta_width); |
214 launcher_ui_view->SetBounds(launcher_ui_bounds); | 212 launcher_ui_view->SetBounds(launcher_ui_bounds); |
215 | 213 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 ServiceProviderImpl* exported_services, | 366 ServiceProviderImpl* exported_services, |
369 scoped_ptr<ServiceProvider> imported_services) OVERRIDE { | 367 scoped_ptr<ServiceProvider> imported_services) OVERRIDE { |
370 DCHECK(!view_manager_); | 368 DCHECK(!view_manager_); |
371 view_manager_ = view_manager; | 369 view_manager_ = view_manager; |
372 | 370 |
373 View* view = View::Create(view_manager_); | 371 View* view = View::Create(view_manager_); |
374 root->AddChild(view); | 372 root->AddChild(view); |
375 view->SetBounds(gfx::Rect(root->bounds().size())); | 373 view->SetBounds(gfx::Rect(root->bounds().size())); |
376 content_view_id_ = view->id(); | 374 content_view_id_ = view->id(); |
377 | 375 |
378 root->SetColor(SK_ColorBLUE); | |
379 | |
380 Id launcher_ui_id = CreateLauncherUI(); | 376 Id launcher_ui_id = CreateLauncherUI(); |
381 Id control_panel_id = CreateControlPanel(view); | 377 Id control_panel_id = CreateControlPanel(view); |
382 | 378 |
383 root_layout_manager_.reset( | 379 root_layout_manager_.reset( |
384 new RootLayoutManager(view_manager, root, | 380 new RootLayoutManager(view_manager, root, |
385 content_view_id_, | 381 content_view_id_, |
386 launcher_ui_id, | 382 launcher_ui_id, |
387 control_panel_id)); | 383 control_panel_id)); |
388 root->AddObserver(root_layout_manager_.get()); | 384 root->AddObserver(root_layout_manager_.get()); |
389 | 385 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 window_manager_->RequestNavigate(view_id_, target, request.Pass()); | 551 window_manager_->RequestNavigate(view_id_, target, request.Pass()); |
556 } | 552 } |
557 | 553 |
558 } // namespace examples | 554 } // namespace examples |
559 } // namespace mojo | 555 } // namespace mojo |
560 | 556 |
561 MojoResult MojoMain(MojoHandle shell_handle) { | 557 MojoResult MojoMain(MojoHandle shell_handle) { |
562 mojo::ApplicationRunnerChromium runner(new mojo::examples::WindowManager); | 558 mojo::ApplicationRunnerChromium runner(new mojo::examples::WindowManager); |
563 return runner.Run(shell_handle); | 559 return runner.Run(shell_handle); |
564 } | 560 } |
OLD | NEW |