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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USERNAME_VIEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USERNAME_VIEW_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERNAME_VIEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERNAME_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "views/controls/label.h" | 11 #include "views/controls/label.h" |
| 12 #include "third_party/skia/include/core/SkBitmap.h" | 12 #include "third_party/skia/include/core/SkBitmap.h" |
| 13 | 13 |
| 14 // Forward declaration. | 14 // Forward declaration. |
| 15 namespace gfx { | 15 namespace gfx { |
| 16 class Rect; | 16 class Rect; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace chromeos { | 19 namespace chromeos { |
| 20 // Label with customized paddings and long text fade out. | 20 // Label with customized paddings and long text fade out. |
| 21 class UsernameView : public views::Label { | 21 class UsernameView : public views::Label { |
| 22 public: | 22 public: |
| 23 UsernameView(const std::wstring& username); | |
| 24 virtual ~UsernameView() {} | 23 virtual ~UsernameView() {} |
| 25 | 24 |
| 26 // Overriden from views::Label. | 25 // Overriden from views::Label. |
| 27 virtual void Paint(gfx::Canvas* canvas); | 26 virtual void Paint(gfx::Canvas* canvas); |
| 28 | 27 |
| 28 // Returns the shaped username view to be used on the login screen. The caller | |
| 29 // gets the ownership. | |
|
Nikita (slow)
2010/12/07 09:32:40
Comment about |use_small_shape|, when it's used.
altimofeev
2010/12/10 10:25:25
Done.
| |
| 30 static UsernameView* CreateShapedUsernameView(const std::wstring& username, | |
| 31 bool use_small_shape); | |
| 32 | |
| 33 protected: | |
| 34 // Constructs username view for the given |username|. Consider using | |
| 35 // |CreateShapedUsernameView| to match the login page style. | |
| 36 explicit UsernameView(const std::wstring& username); | |
| 37 | |
| 29 private: | 38 private: |
| 39 | |
| 30 // Paints username to the bitmap with the bounds given. | 40 // Paints username to the bitmap with the bounds given. |
| 31 void PaintUsername(const gfx::Rect& bounds); | 41 void PaintUsername(const gfx::Rect& bounds); |
| 32 | 42 |
| 33 // Holds painted username. | 43 // Holds painted username. |
| 34 scoped_ptr<SkBitmap> text_image_; | 44 scoped_ptr<SkBitmap> text_image_; |
| 35 | 45 |
| 36 // Holds width of the text drawn. | |
| 37 int text_width_; | |
| 38 | |
| 39 // Holds margins width (depends on the height). | 46 // Holds margins width (depends on the height). |
| 40 int margin_width_; | 47 int margin_width_; |
| 41 | 48 |
| 42 DISALLOW_COPY_AND_ASSIGN(UsernameView); | 49 DISALLOW_COPY_AND_ASSIGN(UsernameView); |
| 43 }; | 50 }; |
| 44 | 51 |
| 45 } // namespace chromeos | 52 } // namespace chromeos |
| 46 | 53 |
| 47 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERNAME_VIEW_H_ | 54 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERNAME_VIEW_H_ |
| OLD | NEW |