OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This file contains helper functions used by Chromium OS login. | 5 // This file contains helper functions used by Chromium OS login. |
6 | 6 |
7 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_HELPER_H_ | 7 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_HELPER_H_ |
8 #define CHROME_BROWSER_CHROMEOS_LOGIN_HELPER_H_ | 8 #define CHROME_BROWSER_CHROMEOS_LOGIN_HELPER_H_ |
9 #pragma once | 9 #pragma once |
10 | 10 |
| 11 #include "third_party/skia/include/core/SkColor.h" |
11 #include "views/controls/button/native_button.h" | 12 #include "views/controls/button/native_button.h" |
12 #include "third_party/skia/include/core/SkColor.h" | 13 #include "views/view.h" |
| 14 #include "views/widget/widget_gtk.h" |
13 | 15 |
14 class GURL; | 16 class GURL; |
15 | 17 |
16 namespace gfx { | 18 namespace gfx { |
17 class Rect; | 19 class Rect; |
18 class Size; | 20 class Size; |
19 } // namespace gfx | 21 } // namespace gfx |
20 | 22 |
21 namespace views { | 23 namespace views { |
22 class Label; | 24 class Label; |
23 class MenuButton; | 25 class MenuButton; |
24 class Painter; | 26 class Painter; |
| 27 class SmoothedThrobber; |
25 class Textfield; | 28 class Textfield; |
26 class Throbber; | 29 class Throbber; |
| 30 class Widget; |
27 } // namespace views | 31 } // namespace views |
28 | 32 |
29 namespace chromeos { | 33 namespace chromeos { |
30 | 34 |
| 35 // View that provides interface for start/stop throbber above the view. |
| 36 class ThrobberHostView : public views::View { |
| 37 public: |
| 38 ThrobberHostView(); |
| 39 virtual ~ThrobberHostView(); |
| 40 |
| 41 // Creates throbber above the view in the right side with the default |
| 42 // margin. Also places throbber in the middle of the vertical host size. |
| 43 // Override |CalculateThrobberBounds| method to change the throbber placing. |
| 44 virtual void StartThrobber(); |
| 45 |
| 46 // Stops the throbber. |
| 47 virtual void StopThrobber(); |
| 48 |
| 49 protected: |
| 50 // Calculates the bounds of the throbber relatively to the host view. |
| 51 // Default position is vertically centered right side of the host view. |
| 52 virtual gfx::Rect CalculateThrobberBounds(views::Throbber* throbber); |
| 53 |
| 54 void set_host_view(views::View* host_view) { |
| 55 host_view_ = host_view; |
| 56 } |
| 57 |
| 58 private: |
| 59 // View to show the throbber above (default is |this|). |
| 60 views::View* host_view_; |
| 61 |
| 62 // Popup that contains the throbber. |
| 63 views::Widget* throbber_widget_; |
| 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(ThrobberHostView); |
| 66 }; |
| 67 |
31 // Creates default smoothed throbber for time consuming operations on login. | 68 // Creates default smoothed throbber for time consuming operations on login. |
32 views::Throbber* CreateDefaultSmoothedThrobber(); | 69 views::SmoothedThrobber* CreateDefaultSmoothedThrobber(); |
33 | 70 |
34 // Creates default throbber. | 71 // Creates default throbber. |
35 views::Throbber* CreateDefaultThrobber(); | 72 views::Throbber* CreateDefaultThrobber(); |
36 | 73 |
37 // Creates painter for login background. | 74 // Creates painter for login background. |
38 views::Painter* CreateBackgroundPainter(); | 75 views::Painter* CreateBackgroundPainter(); |
39 | 76 |
40 // Returns bounds of the screen to use for login wizard. | 77 // Returns bounds of the screen to use for login wizard. |
41 // The rect is centered within the default monitor and sized accordingly if | 78 // The rect is centered within the default monitor and sized accordingly if |
42 // |size| is not empty. Otherwise the whole monitor is occupied. | 79 // |size| is not empty. Otherwise the whole monitor is occupied. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 111 |
75 // Background color of the login controls. | 112 // Background color of the login controls. |
76 const SkColor kBackgroundColor = SK_ColorWHITE; | 113 const SkColor kBackgroundColor = SK_ColorWHITE; |
77 | 114 |
78 // Text color on the login controls. | 115 // Text color on the login controls. |
79 const SkColor kTextColor = SK_ColorWHITE; | 116 const SkColor kTextColor = SK_ColorWHITE; |
80 | 117 |
81 // Default link color on login/OOBE controls. | 118 // Default link color on login/OOBE controls. |
82 const SkColor kLinkColor = 0xFF0066CC; | 119 const SkColor kLinkColor = 0xFF0066CC; |
83 | 120 |
| 121 // Right margin for placing throbber above the view. |
| 122 const int kThrobberRightMargin = 10; |
| 123 |
84 // Default size of the OOBE screen. Includes 10px shadow from each side. | 124 // Default size of the OOBE screen. Includes 10px shadow from each side. |
85 // See rounded_rect_painter.cc for border definitions. | 125 // See rounded_rect_painter.cc for border definitions. |
86 const int kWizardScreenWidth = 800; | 126 const int kWizardScreenWidth = 800; |
87 const int kWizardScreenHeight = 450; | 127 const int kWizardScreenHeight = 450; |
88 | 128 |
89 const int kScreenCornerRadius = 10; | 129 const int kScreenCornerRadius = 10; |
90 const int kUserCornerRadius = 6; | 130 const int kUserCornerRadius = 6; |
91 | 131 |
92 // Username label height in different states. | 132 // Username label height in different states. |
93 const int kSelectedLabelHeight = 25; | 133 const int kSelectedLabelHeight = 25; |
(...skipping 29 matching lines...) Expand all Loading... |
123 | 163 |
124 // New pod sizes. | 164 // New pod sizes. |
125 const int kNewUserPodFullWidth = 372; | 165 const int kNewUserPodFullWidth = 372; |
126 const int kNewUserPodFullHeight = 372; | 166 const int kNewUserPodFullHeight = 372; |
127 const int kNewUserPodSmallWidth = 360; | 167 const int kNewUserPodSmallWidth = 360; |
128 const int kNewUserPodSmallHeight = 322; | 168 const int kNewUserPodSmallHeight = 322; |
129 | 169 |
130 } // namespace chromeos | 170 } // namespace chromeos |
131 | 171 |
132 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_HELPER_H_ | 172 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_HELPER_H_ |
OLD | NEW |