Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(628)

Unified Diff: chrome/browser/ui/views/avatar_menu_bubble_view.cc

Issue 8621004: Revert 111018 - Rebase AvatarMenuBubbleView on the new views bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/avatar_menu_bubble_view.h ('k') | chrome/browser/ui/views/avatar_menu_button.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/avatar_menu_bubble_view.cc
===================================================================
--- chrome/browser/ui/views/avatar_menu_bubble_view.cc (revision 111023)
+++ chrome/browser/ui/views/avatar_menu_bubble_view.cc (working copy)
@@ -29,9 +29,6 @@
namespace {
-// TODO(msw): Get color from theme/window color.
-const SkColor kColor = SK_ColorWHITE;
-
const int kItemHeight = 44;
const int kItemMarginY = 4;
const int kIconWidth = 38;
@@ -237,7 +234,7 @@
image_view_->SetBoundsRect(icon_rect);
int label_x = icon_rect.right() + kIconMarginX;
- int max_label_width = std::max(width() - label_x, 0);
+ int max_label_width = width() - label_x;
gfx::Size name_size = name_label_->GetPreferredSize();
name_size.set_width(std::min(name_size.width(), max_label_width));
gfx::Size state_size = sync_state_label_->GetPreferredSize();
@@ -282,6 +279,11 @@
void ProfileItemView::OnHighlightStateChanged() {
set_background(IsHighlighted() ? views::Background::CreateSolidBackground(
SkColorSetRGB(0xe3, 0xed, 0xf6)) : NULL);
+ SkColor background_color = background() ?
+ background()->get_color() : Bubble::kBackgroundColor;
+ name_label_->SetBackgroundColor(background_color);
+ sync_state_label_->SetBackgroundColor(background_color);
+ edit_link_->SetBackgroundColor(background_color);
bool show_edit = IsHighlighted() && item_.active;
sync_state_label_->SetVisible(!show_edit);
@@ -328,14 +330,8 @@
// AvatarMenuBubbleView -------------------------------------------------------
-AvatarMenuBubbleView::AvatarMenuBubbleView(
- views::View* anchor_view,
- views::BubbleBorder::ArrowLocation arrow_location,
- const gfx::Rect& anchor_rect,
- Browser* browser)
- : BubbleDelegateView(anchor_view, arrow_location, kColor),
- anchor_rect_(anchor_rect),
- add_profile_link_(NULL),
+AvatarMenuBubbleView::AvatarMenuBubbleView(Browser* browser)
+ : add_profile_link_(NULL),
browser_(browser) {
avatar_menu_model_.reset(new AvatarMenuModel(
&g_browser_process->profile_manager()->GetProfileInfoCache(),
@@ -448,15 +444,25 @@
}
}
-gfx::Point AvatarMenuBubbleView::GetAnchorPoint() {
- return gfx::Point(anchor_rect_.CenterPoint().x(), anchor_rect_.bottom());
+void AvatarMenuBubbleView::BubbleShown() {
+ GetFocusManager()->RegisterAccelerator(
+ ui::Accelerator(ui::VKEY_DOWN, false, false, false), this);
+ GetFocusManager()->RegisterAccelerator(
+ ui::Accelerator(ui::VKEY_UP, false, false, false), this);
}
-void AvatarMenuBubbleView::Init() {
- AddAccelerator(ui::Accelerator(ui::VKEY_DOWN, 0));
- AddAccelerator(ui::Accelerator(ui::VKEY_UP, 0));
+void AvatarMenuBubbleView::BubbleClosing(Bubble* bubble,
+ bool closed_by_escape) {
}
+bool AvatarMenuBubbleView::CloseOnEscape() {
+ return true;
+}
+
+bool AvatarMenuBubbleView::FadeInOnShow() {
+ return false;
+}
+
void AvatarMenuBubbleView::OnAvatarMenuModelChanged(
AvatarMenuModel* avatar_menu_model) {
// Unset all our child view references and call RemoveAllChildViews() which
@@ -482,6 +488,7 @@
l10n_util::GetStringUTF16(IDS_PROFILES_CREATE_NEW_PROFILE_LINK));
add_profile_link_->set_listener(this);
add_profile_link_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
+ add_profile_link_->SetBackgroundColor(Bubble::kBackgroundColor);
add_profile_link_->SetEnabledColor(SkColorSetRGB(0xe3, 0xed, 0xf6));
AddChildView(add_profile_link_);
« no previous file with comments | « chrome/browser/ui/views/avatar_menu_bubble_view.h ('k') | chrome/browser/ui/views/avatar_menu_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698