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

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

Issue 7003080: Change profile menu button to avatar button (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Change profile menu button to avatar button Created 9 years, 6 months 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/profile_menu_button.h ('k') | chrome/browser/ui/views/profile_tag_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/profile_menu_button.cc
===================================================================
--- chrome/browser/ui/views/profile_menu_button.cc (revision 88686)
+++ chrome/browser/ui/views/profile_menu_button.cc (working copy)
@@ -1,62 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/views/profile_menu_button.h"
-
-#include "chrome/browser/ui/profile_menu_model.h"
-#include "ui/base/text/text_elider.h"
-#include "ui/gfx/color_utils.h"
-#include "views/controls/button/button.h"
-#include "views/controls/menu/menu_item_view.h"
-#include "views/controls/menu/menu_model_adapter.h"
-#include "views/window/window.h"
-
-// Menu should display below the profile button tag image on the frame. This
-// offset size depends on whether the frame is in glass or opaque mode.
-const int kMenuDisplayOffset = 7;
-
-// TextHover is slightly darker than enabled color, for a subtle hover shift.
-const SkColor kTextHover = 0xFFDDDDDD;
-const SkColor kTextEnabled = SK_ColorWHITE;
-const SkColor kTextHighlighted = SK_ColorWHITE;
-
-// Horizontal padding beside profile menu button, to center it in the
-// underlying tag image.
-const int kProfileButtonBorderSpacing = 10;
-
-// Maximum width for name string in pixels.
-const int kMaxTextWidth = 200;
-
-ProfileMenuButton::ProfileMenuButton(const std::wstring& text, Profile* profile)
- : MenuButton(NULL, text, this, true) {
- // Turn off hover highlighting and position button in the center of the
- // underlying profile tag image.
- set_border(views::Border::CreateEmptyBorder(
- 0, kProfileButtonBorderSpacing, 0, kProfileButtonBorderSpacing));
- SetHoverColor(kTextHover);
- SetEnabledColor(kTextEnabled);
- SetHighlightColor(kTextHighlighted);
-
- profile_menu_model_.reset(new ProfileMenuModel);
-}
-
-ProfileMenuButton::~ProfileMenuButton() {}
-
-void ProfileMenuButton::SetText(const std::wstring& text) {
- MenuButton::SetText(UTF16ToWideHack(ui::ElideText(WideToUTF16Hack(text),
- font(), kMaxTextWidth, false)));
-}
-
-// views::ViewMenuDelegate implementation
-void ProfileMenuButton::RunMenu(views::View* source, const gfx::Point &pt) {
- views::MenuModelAdapter menu_model_adapter(profile_menu_model_.get());
- views::MenuItemView menu(&menu_model_adapter);
- menu_model_adapter.BuildMenu(&menu);
-
- gfx::Point menu_point(pt.x(), pt.y() + kMenuDisplayOffset);
- menu.RunMenuAt(source->GetWidget()->GetNativeWindow(), NULL,
- gfx::Rect(pt, gfx::Size(0, 0)),
- views::MenuItemView::TOPRIGHT,
- true);
-}
« no previous file with comments | « chrome/browser/ui/views/profile_menu_button.h ('k') | chrome/browser/ui/views/profile_tag_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698