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 APPS_UI_VIEWS_APP_WINDOW_FRAME_VIEW_H_ | 5 #ifndef APPS_UI_VIEWS_APP_WINDOW_FRAME_VIEW_H_ |
6 #define APPS_UI_VIEWS_APP_WINDOW_FRAME_VIEW_H_ | 6 #define APPS_UI_VIEWS_APP_WINDOW_FRAME_VIEW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
11 #include "ui/gfx/path.h" | 11 #include "ui/gfx/path.h" |
12 #include "ui/gfx/rect.h" | 12 #include "ui/gfx/rect.h" |
13 #include "ui/gfx/size.h" | 13 #include "ui/gfx/size.h" |
14 #include "ui/views/controls/button/button.h" | 14 #include "ui/views/controls/button/button.h" |
15 #include "ui/views/window/non_client_view.h" | 15 #include "ui/views/window/non_client_view.h" |
16 | 16 |
17 class SkRegion; | 17 class SkRegion; |
18 | 18 |
| 19 namespace extensions { |
| 20 class NativeAppWindow; |
| 21 } |
| 22 |
19 namespace gfx { | 23 namespace gfx { |
20 class Canvas; | 24 class Canvas; |
21 class Point; | 25 class Point; |
22 } | 26 } |
23 | 27 |
24 namespace ui { | 28 namespace ui { |
25 class Event; | 29 class Event; |
26 } | 30 } |
27 | 31 |
28 namespace views { | 32 namespace views { |
29 class ImageButton; | 33 class ImageButton; |
30 class Widget; | 34 class Widget; |
31 } | 35 } |
32 | 36 |
33 namespace apps { | 37 namespace apps { |
34 | 38 |
35 class NativeAppWindow; | |
36 | |
37 // A frameless or non-Ash, non-panel NonClientFrameView for app windows. | 39 // A frameless or non-Ash, non-panel NonClientFrameView for app windows. |
38 class AppWindowFrameView : public views::NonClientFrameView, | 40 class AppWindowFrameView : public views::NonClientFrameView, |
39 public views::ButtonListener { | 41 public views::ButtonListener { |
40 public: | 42 public: |
41 static const char kViewClassName[]; | 43 static const char kViewClassName[]; |
42 | 44 |
43 // AppWindowFrameView is used to draw frames for app windows when a non | 45 // AppWindowFrameView is used to draw frames for app windows when a non |
44 // standard frame is needed. This occurs if there is no frame needed, or if | 46 // standard frame is needed. This occurs if there is no frame needed, or if |
45 // there is a frame color. | 47 // there is a frame color. |
46 // If |draw_frame| is true, the view draws its own window title area and | 48 // If |draw_frame| is true, the view draws its own window title area and |
47 // controls, using |frame_color|. If |draw_frame| is not true, no frame is | 49 // controls, using |frame_color|. If |draw_frame| is not true, no frame is |
48 // drawn. | 50 // drawn. |
49 // TODO(benwells): Refactor this to split out frameless and colored frame | 51 // TODO(benwells): Refactor this to split out frameless and colored frame |
50 // views. See http://crbug.com/359432. | 52 // views. See http://crbug.com/359432. |
51 AppWindowFrameView(views::Widget* widget, | 53 AppWindowFrameView(views::Widget* widget, |
52 NativeAppWindow* window, | 54 extensions::NativeAppWindow* window, |
53 bool draw_frame, | 55 bool draw_frame, |
54 const SkColor& active_frame_color, | 56 const SkColor& active_frame_color, |
55 const SkColor& inactive_frame_color); | 57 const SkColor& inactive_frame_color); |
56 virtual ~AppWindowFrameView(); | 58 virtual ~AppWindowFrameView(); |
57 | 59 |
58 void Init(); | 60 void Init(); |
59 | 61 |
60 void SetResizeSizes(int resize_inside_bounds_size, | 62 void SetResizeSizes(int resize_inside_bounds_size, |
61 int resize_outside_bounds_size, | 63 int resize_outside_bounds_size, |
62 int resize_area_corner_size); | 64 int resize_area_corner_size); |
(...skipping 26 matching lines...) Expand all Loading... |
89 const ui::Event& event) OVERRIDE; | 91 const ui::Event& event) OVERRIDE; |
90 | 92 |
91 // Some button images we use depend on the color of the frame. This | 93 // Some button images we use depend on the color of the frame. This |
92 // will set these images based on the color of the frame. | 94 // will set these images based on the color of the frame. |
93 void SetButtonImagesForFrame(); | 95 void SetButtonImagesForFrame(); |
94 | 96 |
95 // Return the current frame color based on the active state of the window. | 97 // Return the current frame color based on the active state of the window. |
96 SkColor CurrentFrameColor(); | 98 SkColor CurrentFrameColor(); |
97 | 99 |
98 views::Widget* widget_; | 100 views::Widget* widget_; |
99 NativeAppWindow* window_; | 101 extensions::NativeAppWindow* window_; |
100 bool draw_frame_; | 102 bool draw_frame_; |
101 SkColor active_frame_color_; | 103 SkColor active_frame_color_; |
102 SkColor inactive_frame_color_; | 104 SkColor inactive_frame_color_; |
103 views::ImageButton* close_button_; | 105 views::ImageButton* close_button_; |
104 views::ImageButton* maximize_button_; | 106 views::ImageButton* maximize_button_; |
105 views::ImageButton* restore_button_; | 107 views::ImageButton* restore_button_; |
106 views::ImageButton* minimize_button_; | 108 views::ImageButton* minimize_button_; |
107 | 109 |
108 // Allow resize for clicks this many pixels inside the bounds. | 110 // Allow resize for clicks this many pixels inside the bounds. |
109 int resize_inside_bounds_size_; | 111 int resize_inside_bounds_size_; |
110 | 112 |
111 // Allow resize for clicks this many pixels outside the bounds. | 113 // Allow resize for clicks this many pixels outside the bounds. |
112 int resize_outside_bounds_size_; | 114 int resize_outside_bounds_size_; |
113 | 115 |
114 // Size in pixels of the lower-right corner resize handle. | 116 // Size in pixels of the lower-right corner resize handle. |
115 int resize_area_corner_size_; | 117 int resize_area_corner_size_; |
116 | 118 |
117 DISALLOW_COPY_AND_ASSIGN(AppWindowFrameView); | 119 DISALLOW_COPY_AND_ASSIGN(AppWindowFrameView); |
118 }; | 120 }; |
119 | 121 |
120 } // namespace apps | 122 } // namespace apps |
121 | 123 |
122 #endif // APPS_UI_VIEWS_APP_WINDOW_FRAME_VIEW_H_ | 124 #endif // APPS_UI_VIEWS_APP_WINDOW_FRAME_VIEW_H_ |
OLD | NEW |