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