Chromium Code Reviews| 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_AVATAR_MENU_BUTTON_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_PROFILE_MENU_BUTTON_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_AVATAR_MENU_BUTTON_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "ui/base/models/simple_menu_model.h" | 12 #include "ui/base/models/simple_menu_model.h" |
| 13 #include "views/controls/button/menu_button.h" | 13 #include "views/controls/button/menu_button.h" |
| 14 #include "views/controls/menu/view_menu_delegate.h" | 14 #include "views/controls/menu/view_menu_delegate.h" |
| 15 | 15 |
| 16 class Profile; | |
| 17 class ProfileMenuModel; | |
| 18 | |
| 19 namespace gfx { | 16 namespace gfx { |
| 20 class Canvas; | 17 class Canvas; |
| 21 } | 18 } |
| 22 | 19 |
| 23 namespace ui { | 20 // AvatarMenuButton |
| 24 class Accelerator; | 21 // |
| 25 } | 22 // A button used to show either the incognito avatar or the profile avatar. |
| 23 // The button can optionally have a menu attached to it. | |
| 26 | 24 |
| 27 // ProfileMenuButton | 25 class AvatarMenuButton : public views::MenuButton, |
| 28 // | 26 public views::ViewMenuDelegate { |
| 29 // Shows the button for the multiprofile menu with an image layered | 27 public: |
| 30 // underneath that displays the profile tag. | 28 AvatarMenuButton(const std::wstring& text, ui::MenuModel* menu_model); |
|
sky
2011/06/09 15:46:46
Document AvatarMenuButton takes ownership of the m
sail
2011/06/10 00:56:20
Done.
| |
| 31 | 29 |
| 32 class ProfileMenuButton : public views::MenuButton, | 30 virtual ~AvatarMenuButton(); |
| 33 public views::ViewMenuDelegate { | |
| 34 public: | |
| 35 // DefaultActiveTextShadow is a darkened blue color that works with Windows | |
| 36 // default theme background coloring. | |
| 37 static const SkColor kDefaultActiveTextShadow = 0xFF708DB3; | |
| 38 // InactiveTextShadow is a light gray for inactive default themed buttons. | |
| 39 static const SkColor kDefaultInactiveTextShadow = SK_ColorLTGRAY; | |
| 40 // DarkTextShadow is used to shadow names on themed browser frames. | |
| 41 static const SkColor kDarkTextShadow = SK_ColorGRAY; | |
| 42 // Space between window controls and end of profile tag. | |
| 43 static const int kProfileTagHorizontalSpacing = 5; | |
| 44 | 31 |
| 45 ProfileMenuButton(const std::wstring& text, Profile* profile); | 32 virtual void OnPaint(gfx::Canvas* canvas); |
|
Peter Kasting
2011/06/09 18:03:31
Nit: OVERRIDE?
May want to add "// views::MenuBut
sail
2011/06/10 00:56:20
Done.
| |
| 46 | |
| 47 virtual ~ProfileMenuButton(); | |
| 48 | |
| 49 // Override MenuButton to clamp text at kMaxTextWidth. | |
| 50 virtual void SetText(const std::wstring& text) OVERRIDE; | |
| 51 | 33 |
| 52 private: | 34 private: |
| 53 // Overridden from views::ViewMenuDelegate: | 35 // Overridden from views::ViewMenuDelegate: |
|
Peter Kasting
2011/06/09 18:03:31
Nit: Feel free to remove "Overridden from" and tra
sail
2011/06/10 00:56:20
Done.
| |
| 54 virtual void RunMenu(views::View* source, const gfx::Point& pt) OVERRIDE; | 36 virtual void RunMenu(views::View* source, const gfx::Point& pt) OVERRIDE; |
| 55 | 37 |
| 56 scoped_ptr<ProfileMenuModel> profile_menu_model_; | 38 scoped_ptr<ui::MenuModel> menu_model_; |
| 57 | 39 |
| 58 DISALLOW_COPY_AND_ASSIGN(ProfileMenuButton); | 40 DISALLOW_COPY_AND_ASSIGN(AvatarMenuButton); |
| 59 }; | 41 }; |
| 60 | 42 |
| 61 #endif // CHROME_BROWSER_UI_VIEWS_PROFILE_MENU_BUTTON_H_ | 43 #endif // CHROME_BROWSER_UI_VIEWS_AVATAR_MENU_BUTTON_H_ |
| OLD | NEW |