OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_UI_VIEWS_PROFILE_MENU_BUTTON_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PROFILE_MENU_BUTTON_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_PROFILE_MENU_BUTTON_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PROFILE_MENU_BUTTON_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 namespace views { | 27 namespace views { |
28 class Menu2; | 28 class Menu2; |
29 } | 29 } |
30 | 30 |
31 // ProfileMenuButton | 31 // ProfileMenuButton |
32 // | 32 // |
33 // Shows the button for the multiprofile menu with an image layered | 33 // Shows the button for the multiprofile menu with an image layered |
34 // underneath that displays the profile tag. | 34 // underneath that displays the profile tag. |
35 | 35 |
36 class ProfileMenuButton : public views::MenuButton, | 36 class ProfileMenuButton : public views::MenuButton, |
37 public views::ViewMenuDelegate, | 37 public views::ViewMenuDelegate { |
38 public ui::SimpleMenuModel::Delegate { | |
39 public: | 38 public: |
40 // DefaultActiveTextShadow is a darkened blue color that works with Windows | 39 // DefaultActiveTextShadow is a darkened blue color that works with Windows |
41 // default theme background coloring. | 40 // default theme background coloring. |
42 static const SkColor kDefaultActiveTextShadow = 0xFF708DB3; | 41 static const SkColor kDefaultActiveTextShadow = 0xFF708DB3; |
43 // InactiveTextShadow is a light gray for inactive default themed buttons. | 42 // InactiveTextShadow is a light gray for inactive default themed buttons. |
44 static const SkColor kDefaultInactiveTextShadow = SK_ColorLTGRAY; | 43 static const SkColor kDefaultInactiveTextShadow = SK_ColorLTGRAY; |
45 // DarkTextShadow is used to shadow names on themed browser frames. | 44 // DarkTextShadow is used to shadow names on themed browser frames. |
46 static const SkColor kDarkTextShadow = SK_ColorGRAY; | 45 static const SkColor kDarkTextShadow = SK_ColorGRAY; |
47 // Space between window controls and end of profile tag. | 46 // Space between window controls and end of profile tag. |
48 static const int kProfileTagHorizontalSpacing = 5; | 47 static const int kProfileTagHorizontalSpacing = 5; |
49 | 48 |
50 ProfileMenuButton(const std::wstring& text, Profile* profile); | 49 ProfileMenuButton(const std::wstring& text, Profile* profile); |
51 | 50 |
52 virtual ~ProfileMenuButton(); | 51 virtual ~ProfileMenuButton(); |
53 | 52 |
54 // Override MenuButton to clamp text at kMaxTextWidth. | 53 // Override MenuButton to clamp text at kMaxTextWidth. |
55 virtual void SetText(const std::wstring& text) OVERRIDE; | 54 virtual void SetText(const std::wstring& text) OVERRIDE; |
56 | 55 |
57 // ui::SimpleMenuModel::Delegate implementation | |
58 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | |
59 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | |
60 virtual bool GetAcceleratorForCommandId( | |
61 int command_id, ui::Accelerator* accelerator) OVERRIDE; | |
62 virtual void ExecuteCommand(int command_id) OVERRIDE; | |
63 | |
64 private: | 56 private: |
65 // Overridden from views::ViewMenuDelegate: | 57 // Overridden from views::ViewMenuDelegate: |
66 virtual void RunMenu(views::View* source, const gfx::Point& pt) OVERRIDE; | 58 virtual void RunMenu(views::View* source, const gfx::Point& pt) OVERRIDE; |
67 | 59 |
68 scoped_ptr<views::Menu2> menu_; | 60 scoped_ptr<views::Menu2> menu_; |
69 scoped_ptr<ProfileMenuModel> profile_menu_model_; | 61 scoped_ptr<ProfileMenuModel> profile_menu_model_; |
70 | 62 |
71 DISALLOW_COPY_AND_ASSIGN(ProfileMenuButton); | 63 DISALLOW_COPY_AND_ASSIGN(ProfileMenuButton); |
72 }; | 64 }; |
73 | 65 |
74 #endif // CHROME_BROWSER_UI_VIEWS_PROFILE_MENU_BUTTON_H_ | 66 #endif // CHROME_BROWSER_UI_VIEWS_PROFILE_MENU_BUTTON_H_ |
75 | 67 |
OLD | NEW |