Chromium Code Reviews| 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/widget/widget_gtk.h" |
| 13 | 14 |
| 14 class GURL; | 15 class GURL; |
| 15 | 16 |
| 16 namespace gfx { | 17 namespace gfx { |
| 17 class Rect; | 18 class Rect; |
| 18 class Size; | 19 class Size; |
| 19 } // namespace gfx | 20 } // namespace gfx |
| 20 | 21 |
| 21 namespace views { | 22 namespace views { |
| 22 class Label; | 23 class Label; |
| 23 class MenuButton; | 24 class MenuButton; |
| 24 class Painter; | 25 class Painter; |
| 25 class Textfield; | 26 class Textfield; |
| 26 class Throbber; | 27 class Throbber; |
| 28 class Widget; | |
| 27 } // namespace views | 29 } // namespace views |
| 28 | 30 |
| 29 namespace chromeos { | 31 namespace chromeos { |
| 30 | 32 |
| 33 // Class that provides interface for start/stop throbber above the view. | |
| 34 class ThrobberHost { | |
|
whywhat
2010/12/13 16:10:55
It'd be better if we could embed ThrobberHost into
altimofeev
2010/12/14 11:15:21
Subclassed from the views::View to avoid multiple
| |
| 35 public: | |
| 36 explicit ThrobberHost(views::View* host_view); | |
| 37 virtual ~ThrobberHost(); | |
| 38 | |
| 39 // Creates throbber above the view in the right side with the default | |
| 40 // margin. Also places throbber in the middle of the vertical host size. | |
| 41 // Override |CalculateThrobberBounds| method to change the throbber placing. | |
| 42 virtual void StartThrobber(); | |
| 43 | |
| 44 // Stops the throbber. | |
| 45 virtual void StopThrobber(); | |
| 46 | |
| 47 protected: | |
| 48 // Calculates the bounds of the throbber relatively to the host view. | |
| 49 // Default position is vertically centered right side of the host view. | |
| 50 virtual gfx::Rect CalculateThrobberBounds(views::Throbber* throbber); | |
| 51 | |
| 52 void set_host_view(views::View* host_view) { | |
| 53 host_view_ = host_view; | |
| 54 } | |
| 55 | |
| 56 private: | |
| 57 // View to show the throbber above. | |
| 58 views::View* host_view_; | |
| 59 | |
| 60 // Popup that contains the throbber. | |
| 61 views::Widget *throbber_widget_; | |
|
whywhat
2010/12/13 16:10:55
Align * with the type, please.
altimofeev
2010/12/14 11:15:21
Done.
| |
| 62 | |
| 63 DISALLOW_COPY_AND_ASSIGN(ThrobberHost); | |
| 64 }; | |
| 65 | |
| 31 // Creates default smoothed throbber for time consuming operations on login. | 66 // Creates default smoothed throbber for time consuming operations on login. |
| 32 views::Throbber* CreateDefaultSmoothedThrobber(); | 67 views::Throbber* CreateDefaultSmoothedThrobber(); |
| 33 | 68 |
| 34 // Creates default throbber. | 69 // Creates default throbber. |
| 35 views::Throbber* CreateDefaultThrobber(); | 70 views::Throbber* CreateDefaultThrobber(); |
| 36 | 71 |
| 37 // Creates painter for login background. | 72 // Creates painter for login background. |
| 38 views::Painter* CreateBackgroundPainter(); | 73 views::Painter* CreateBackgroundPainter(); |
| 39 | 74 |
| 40 // Returns bounds of the screen to use for login wizard. | 75 // Returns bounds of the screen to use for login wizard. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 | 109 |
| 75 // Background color of the login controls. | 110 // Background color of the login controls. |
| 76 const SkColor kBackgroundColor = SK_ColorWHITE; | 111 const SkColor kBackgroundColor = SK_ColorWHITE; |
| 77 | 112 |
| 78 // Text color on the login controls. | 113 // Text color on the login controls. |
| 79 const SkColor kTextColor = SK_ColorWHITE; | 114 const SkColor kTextColor = SK_ColorWHITE; |
| 80 | 115 |
| 81 // Default link color on login/OOBE controls. | 116 // Default link color on login/OOBE controls. |
| 82 const SkColor kLinkColor = 0xFF0066CC; | 117 const SkColor kLinkColor = 0xFF0066CC; |
| 83 | 118 |
| 119 const int kThrobberRightMargin = 10; | |
|
whywhat
2010/12/13 16:10:55
Comment about the constant?
altimofeev
2010/12/14 11:15:21
Done.
| |
| 120 | |
| 84 // Default size of the OOBE screen. Includes 10px shadow from each side. | 121 // Default size of the OOBE screen. Includes 10px shadow from each side. |
| 85 // See rounded_rect_painter.cc for border definitions. | 122 // See rounded_rect_painter.cc for border definitions. |
| 86 const int kWizardScreenWidth = 800; | 123 const int kWizardScreenWidth = 800; |
| 87 const int kWizardScreenHeight = 450; | 124 const int kWizardScreenHeight = 450; |
| 88 | 125 |
| 89 const int kScreenCornerRadius = 10; | 126 const int kScreenCornerRadius = 10; |
| 90 const int kUserCornerRadius = 6; | 127 const int kUserCornerRadius = 6; |
| 91 | 128 |
| 92 // Username label height in different states. | 129 // Username label height in different states. |
| 93 const int kSelectedLabelHeight = 25; | 130 const int kSelectedLabelHeight = 25; |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 123 | 160 |
| 124 // New pod sizes. | 161 // New pod sizes. |
| 125 const int kNewUserPodFullWidth = 372; | 162 const int kNewUserPodFullWidth = 372; |
| 126 const int kNewUserPodFullHeight = 372; | 163 const int kNewUserPodFullHeight = 372; |
| 127 const int kNewUserPodSmallWidth = 360; | 164 const int kNewUserPodSmallWidth = 360; |
| 128 const int kNewUserPodSmallHeight = 322; | 165 const int kNewUserPodSmallHeight = 322; |
| 129 | 166 |
| 130 } // namespace chromeos | 167 } // namespace chromeos |
| 131 | 168 |
| 132 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_HELPER_H_ | 169 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_HELPER_H_ |
| OLD | NEW |