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/examples/keyboard/keyboard.mojom.h" | 7 #include "mojo/examples/keyboard/keyboard.mojom.h" |
8 #include "mojo/examples/window_manager/debug_panel.h" | 8 #include "mojo/examples/window_manager/debug_panel.h" |
9 #include "mojo/examples/window_manager/window_manager.mojom.h" | 9 #include "mojo/examples/window_manager/window_manager.mojom.h" |
10 #include "mojo/public/cpp/application/application_connection.h" | 10 #include "mojo/public/cpp/application/application_connection.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "mojo/services/public/interfaces/navigation/navigation.mojom.h" | 25 #include "mojo/services/public/interfaces/navigation/navigation.mojom.h" |
26 #include "mojo/views/views_init.h" | 26 #include "mojo/views/views_init.h" |
27 #include "ui/events/event.h" | 27 #include "ui/events/event.h" |
28 #include "ui/events/event_constants.h" | 28 #include "ui/events/event_constants.h" |
29 #include "ui/gfx/geometry/size_conversions.h" | 29 #include "ui/gfx/geometry/size_conversions.h" |
30 | 30 |
31 #if defined CreateWindow | 31 #if defined CreateWindow |
32 #undef CreateWindow | 32 #undef CreateWindow |
33 #endif | 33 #endif |
34 | 34 |
35 using mojo::view_manager::Id; | |
36 using mojo::view_manager::Node; | |
37 using mojo::view_manager::NodeObserver; | |
38 using mojo::view_manager::View; | |
39 using mojo::view_manager::ViewManager; | |
40 using mojo::view_manager::ViewManagerClientFactory; | |
41 using mojo::view_manager::ViewManagerDelegate; | |
42 using mojo::view_manager::ViewObserver; | |
43 using mojo::view_manager::WindowManagerDelegate; | |
44 | |
45 namespace mojo { | 35 namespace mojo { |
46 namespace examples { | 36 namespace examples { |
47 | 37 |
48 class WindowManager; | 38 class WindowManager; |
49 | 39 |
50 namespace { | 40 namespace { |
51 | 41 |
52 const int kBorderInset = 25; | 42 const int kBorderInset = 25; |
53 const int kControlPanelWidth = 200; | 43 const int kControlPanelWidth = 200; |
54 const int kTextfieldHeight = 25; | 44 const int kTextfieldHeight = 25; |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 app_->ConnectToService(app_url, &navigator); | 471 app_->ConnectToService(app_url, &navigator); |
482 navigator->Navigate(node->id(), nav_details.Pass(), response.Pass()); | 472 navigator->Navigate(node->id(), nav_details.Pass(), response.Pass()); |
483 } | 473 } |
484 } | 474 } |
485 | 475 |
486 bool IsDescendantOfKeyboard(View* target) { | 476 bool IsDescendantOfKeyboard(View* target) { |
487 return keyboard_manager_.get() && | 477 return keyboard_manager_.get() && |
488 keyboard_manager_->node()->Contains(target->node()); | 478 keyboard_manager_->node()->Contains(target->node()); |
489 } | 479 } |
490 | 480 |
491 Id CreateControlPanel(view_manager::Node* root) { | 481 Id CreateControlPanel(Node* root) { |
492 Node* node = Node::Create(view_manager_); | 482 Node* node = Node::Create(view_manager_); |
493 View* view = view_manager::View::Create(view_manager_); | 483 View* view = View::Create(view_manager_); |
494 root->AddChild(node); | 484 root->AddChild(node); |
495 node->SetActiveView(view); | 485 node->SetActiveView(view); |
496 | 486 |
497 gfx::Rect bounds(root->bounds().width() - kControlPanelWidth - | 487 gfx::Rect bounds(root->bounds().width() - kControlPanelWidth - |
498 kBorderInset, | 488 kBorderInset, |
499 kBorderInset * 2 + kTextfieldHeight, | 489 kBorderInset * 2 + kTextfieldHeight, |
500 kControlPanelWidth, | 490 kControlPanelWidth, |
501 root->bounds().height() - kBorderInset * 3 - | 491 root->bounds().height() - kBorderInset * 3 - |
502 kTextfieldHeight); | 492 kTextfieldHeight); |
503 node->SetBounds(bounds); | 493 node->SetBounds(bounds); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 } | 539 } |
550 | 540 |
551 } // namespace examples | 541 } // namespace examples |
552 | 542 |
553 // static | 543 // static |
554 ApplicationDelegate* ApplicationDelegate::Create() { | 544 ApplicationDelegate* ApplicationDelegate::Create() { |
555 return new examples::WindowManager; | 545 return new examples::WindowManager; |
556 } | 546 } |
557 | 547 |
558 } // namespace mojo | 548 } // namespace mojo |
OLD | NEW |