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 #ifndef MOJO_EXAMPLES_WINDOW_MANAGER_DEBUG_PANEL_H_ | 5 #ifndef MOJO_EXAMPLES_WINDOW_MANAGER_DEBUG_PANEL_H_ |
6 #define MOJO_EXAMPLES_WINDOW_MANAGER_DEBUG_PANEL_H_ | 6 #define MOJO_EXAMPLES_WINDOW_MANAGER_DEBUG_PANEL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "mojo/public/interfaces/service_provider/service_provider.mojom.h" | 10 #include "mojo/public/interfaces/service_provider/service_provider.mojom.h" |
11 #include "mojo/services/public/interfaces/navigation/navigation.mojom.h" | 11 #include "mojo/services/public/interfaces/navigation/navigation.mojom.h" |
12 #include "ui/views/controls/button/button.h" | 12 #include "ui/views/controls/button/button.h" |
13 #include "ui/views/layout/layout_manager.h" | 13 #include "ui/views/layout/layout_manager.h" |
14 #include "ui/views/widget/widget_delegate.h" | 14 #include "ui/views/widget/widget_delegate.h" |
15 | 15 |
16 namespace views { | 16 namespace views { |
17 class Label; | 17 class Label; |
18 class RadioButton; | 18 class RadioButton; |
19 } | 19 } |
20 | 20 |
21 namespace mojo { | 21 namespace mojo { |
22 | 22 |
23 namespace view_manager { | |
24 class Node; | 23 class Node; |
25 } | |
26 | 24 |
27 namespace examples { | 25 namespace examples { |
28 | 26 |
29 namespace { | 27 namespace { |
30 const SkColor kColors[] = { SK_ColorYELLOW, | 28 const SkColor kColors[] = { SK_ColorYELLOW, |
31 SK_ColorRED, | 29 SK_ColorRED, |
32 SK_ColorGREEN, | 30 SK_ColorGREEN, |
33 SK_ColorMAGENTA }; | 31 SK_ColorMAGENTA }; |
34 } | 32 } |
35 | 33 |
36 // A panel of controls intended to demonstrate the functionality of the window | 34 // A panel of controls intended to demonstrate the functionality of the window |
37 // manager. | 35 // manager. |
38 class DebugPanel : public views::LayoutManager, public views::ButtonListener { | 36 class DebugPanel : public views::LayoutManager, public views::ButtonListener { |
39 public: | 37 public: |
40 class Delegate { | 38 class Delegate { |
41 public: | 39 public: |
42 virtual void CloseTopWindow() = 0; | 40 virtual void CloseTopWindow() = 0; |
43 virtual void RequestNavigate( | 41 virtual void RequestNavigate( |
44 uint32 source_node_id, navigation::Target target, | 42 uint32 source_node_id, navigation::Target target, |
45 navigation::NavigationDetailsPtr nav_details) = 0; | 43 navigation::NavigationDetailsPtr nav_details) = 0; |
46 protected: | 44 protected: |
47 virtual ~Delegate(){} | 45 virtual ~Delegate(){} |
48 }; | 46 }; |
49 | 47 |
50 DebugPanel(Delegate* delegate, view_manager::Node* node); | 48 DebugPanel(Delegate* delegate, Node* node); |
51 virtual ~DebugPanel(); | 49 virtual ~DebugPanel(); |
52 | 50 |
53 navigation::Target navigation_target() const; | 51 navigation::Target navigation_target() const; |
54 | 52 |
55 private: | 53 private: |
56 // LayoutManager overrides: | 54 // LayoutManager overrides: |
57 virtual gfx::Size GetPreferredSize(const views::View* view) const OVERRIDE; | 55 virtual gfx::Size GetPreferredSize(const views::View* view) const OVERRIDE; |
58 virtual void Layout(views::View* host) OVERRIDE; | 56 virtual void Layout(views::View* host) OVERRIDE; |
59 virtual void ButtonPressed(views::Button* sender, | 57 virtual void ButtonPressed(views::Button* sender, |
60 const ui::Event& event) OVERRIDE; | 58 const ui::Event& event) OVERRIDE; |
61 | 59 |
62 void Navigate(const std::string& url); | 60 void Navigate(const std::string& url); |
63 | 61 |
64 Delegate* delegate_; | 62 Delegate* delegate_; |
65 view_manager::Node* node_; | 63 Node* node_; |
66 | 64 |
67 views::Label* navigation_target_label_; | 65 views::Label* navigation_target_label_; |
68 views::RadioButton* navigation_target_new_; | 66 views::RadioButton* navigation_target_new_; |
69 views::RadioButton* navigation_target_source_; | 67 views::RadioButton* navigation_target_source_; |
70 views::RadioButton* navigation_target_default_; | 68 views::RadioButton* navigation_target_default_; |
71 | 69 |
72 size_t next_color_; | 70 size_t next_color_; |
73 views::Button* colored_square_; | 71 views::Button* colored_square_; |
74 views::Button* close_last_; | 72 views::Button* close_last_; |
75 views::Button* cross_app_; | 73 views::Button* cross_app_; |
76 | 74 |
77 DISALLOW_COPY_AND_ASSIGN(DebugPanel); | 75 DISALLOW_COPY_AND_ASSIGN(DebugPanel); |
78 }; | 76 }; |
79 | 77 |
80 } // examples | 78 } // examples |
81 } // mojo | 79 } // mojo |
82 | 80 |
83 #endif // MOJO_EXAMPLES_WINDOW_MANAGER_DEBUG_PANEL_H_ | 81 #endif // MOJO_EXAMPLES_WINDOW_MANAGER_DEBUG_PANEL_H_ |
OLD | NEW |