| 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 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 // Returns the shaped username view to be used on the login screen. If | 28 // Returns the shaped username view to be used on the login screen. If |
| 29 // |user_small_shape| is true, then one pixel margins are used. This is done | 29 // |user_small_shape| is true, then one pixel margins are used. This is done |
| 30 // to match the shape of the scaled frame of the user image. The caller gets | 30 // to match the shape of the scaled frame of the user image. The caller gets |
| 31 // the ownership. | 31 // the ownership. |
| 32 static UsernameView* CreateShapedUsernameView(const std::wstring& username, | 32 static UsernameView* CreateShapedUsernameView(const std::wstring& username, |
| 33 bool use_small_shape); | 33 bool use_small_shape); |
| 34 | 34 |
| 35 protected: | 35 protected: |
| 36 // Constructs username view for the given |username|. Consider using | 36 // Constructs username view for the given |username|. Consider using |
| 37 // |CreateShapedUsernameView| to match the login page style. | 37 // |CreateShapedUsernameView| to match the login page style. |
| 38 explicit UsernameView(const std::wstring& username); | 38 UsernameView(const std::wstring& username, bool use_small_shape); |
| 39 |
| 40 // True indicates that this UsernameView is used for a user pod not |
| 41 // currently selected. |
| 42 bool use_small_shape() const { return use_small_shape_; } |
| 39 | 43 |
| 40 private: | 44 private: |
| 45 // Overriden from View. |
| 46 gfx::NativeCursor GetCursorForPoint( |
| 47 views::Event::EventType event_type, |
| 48 const gfx::Point& p); |
| 41 | 49 |
| 42 // Paints username to the bitmap with the bounds given. | 50 // Paints username to the bitmap with the bounds given. |
| 43 void PaintUsername(const gfx::Rect& bounds); | 51 void PaintUsername(const gfx::Rect& bounds); |
| 44 | 52 |
| 45 // Holds painted username. | 53 // Holds painted username. |
| 46 scoped_ptr<SkBitmap> text_image_; | 54 scoped_ptr<SkBitmap> text_image_; |
| 47 | 55 |
| 48 // Holds margins width (depends on the height). | 56 // Holds margins width (depends on the height). |
| 49 int margin_width_; | 57 int margin_width_; |
| 50 | 58 |
| 59 // Whether the shape for the smaller view should be used. |
| 60 bool use_small_shape_; |
| 61 |
| 51 DISALLOW_COPY_AND_ASSIGN(UsernameView); | 62 DISALLOW_COPY_AND_ASSIGN(UsernameView); |
| 52 }; | 63 }; |
| 53 | 64 |
| 54 } // namespace chromeos | 65 } // namespace chromeos |
| 55 | 66 |
| 56 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERNAME_VIEW_H_ | 67 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERNAME_VIEW_H_ |
| OLD | NEW |