Commit 338416c0 authored by msw@chromium.org's avatar msw@chromium.org

Support full-screen and single-profile avatar bubbles.

Enable IDC_SHOW_AVATAR_MENU for normal browser windows.
(full-screen and single-profile windows are now allowed)
(non-tabbed and incognito windows are still disallowed)

Nix BrowserCommandController's use of ProfileManager.
(no commands rely on the profile count anymore)
Cleanup some BrowserCommandController code.

Inline AvatarMenuButton::ShowAvatarBubble in BrowserView.
(ShowAvatarBubbleFromAvatarButton needs to set an anchor)
(single-profile windows have no avatar icon; use hotdogs)
Anchor to the Chrome menu button in Mac single-profile too.

Take an ArrowPaintType in AvatarMenuBubbleView::ShowBubble.
(lets fullscreen hide the arrow, there's no visible anchor)
(this corresponds with fullscreen bookmark bubble behavior)

Remove a stale Windows Valgrind DrMemory test exclusion entry.
(test name was changed, but the exclusion wasn't; isn't needed)

BUG=255452,167014
TEST=The avatar menu shows for Ctrl+Shift+M even in fullscreen and even for single-profile Chrome windows. Test with and without the experimental --new-profile-management, and in LTR and RTL Chrome UI modes.
R=pkasting@chromium.org, asvitkine@chromium.org

Review URL: https://codereview.chromium.org/264303006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270126 0039d316-1c4b-4281-b951-d872f2087c98
parent 11f85951
......@@ -66,7 +66,6 @@
#include "chrome/browser/prefs/incognito_mode_prefs.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_destroyer.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/browser/repost_form_warning_controller.h"
#include "chrome/browser/search/search.h"
......@@ -347,8 +346,7 @@ Browser::Browser(const CreateParams& params)
tab_restore_service_delegate_(new BrowserTabRestoreServiceDelegate(this)),
synced_window_delegate_(new BrowserSyncedWindowDelegate(this)),
bookmark_bar_state_(BookmarkBar::HIDDEN),
command_controller_(new chrome::BrowserCommandController(
this, g_browser_process->profile_manager())),
command_controller_(new chrome::BrowserCommandController(this)),
window_has_shown_(false),
chrome_updater_factory_(this),
weak_factory_(this),
......
......@@ -13,9 +13,7 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/prefs/incognito_mode_prefs.h"
#include "chrome/browser/profiles/avatar_menu.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/sessions/tab_restore_service.h"
#include "chrome/browser/sessions/tab_restore_service_factory.h"
#include "chrome/browser/shell_integration.h"
......@@ -183,17 +181,12 @@ namespace chrome {
///////////////////////////////////////////////////////////////////////////////
// BrowserCommandController, public:
BrowserCommandController::BrowserCommandController(
Browser* browser,
ProfileManager* profile_manager)
BrowserCommandController::BrowserCommandController(Browser* browser)
: browser_(browser),
profile_manager_(profile_manager),
command_updater_(this),
block_command_execution_(false),
last_blocked_command_id_(-1),
last_blocked_command_disposition_(CURRENT_TAB) {
if (profile_manager_)
profile_manager_->GetProfileInfoCache().AddObserver(this);
browser_->tab_strip_model()->AddObserver(this);
PrefService* local_state = g_browser_process->local_state();
if (local_state) {
......@@ -259,8 +252,6 @@ BrowserCommandController::~BrowserCommandController() {
profile_pref_registrar_.RemoveAll();
local_pref_registrar_.RemoveAll();
browser_->tab_strip_model()->RemoveObserver(this);
if (profile_manager_)
profile_manager_->GetProfileInfoCache().RemoveObserver(this);
}
bool BrowserCommandController::IsReservedCommandOrKey(
......@@ -781,20 +772,6 @@ void BrowserCommandController::ExecuteCommandWithDisposition(
}
}
////////////////////////////////////////////////////////////////////////////////
// BrowserCommandController, ProfileInfoCacheObserver implementation:
void BrowserCommandController::OnProfileAdded(
const base::FilePath& profile_path) {
UpdateCommandsForMultipleProfiles();
}
void BrowserCommandController::OnProfileWasRemoved(
const base::FilePath& profile_path,
const base::string16& profile_name) {
UpdateCommandsForMultipleProfiles();
}
////////////////////////////////////////////////////////////////////////////////
// BrowserCommandController, SigninPrefObserver implementation:
......@@ -969,29 +946,31 @@ void BrowserCommandController::InitCommandState() {
command_updater_.UpdateCommandEnabled(IDC_ZOOM_MINUS, true);
// Show various bits of UI
const bool guest_session = profile()->IsGuestSession();
const bool normal_window = browser_->is_type_tabbed();
UpdateOpenFileState(&command_updater_);
command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS, false);
UpdateCommandsForDevTools();
command_updater_.UpdateCommandEnabled(IDC_TASK_MANAGER, CanOpenTaskManager());
command_updater_.UpdateCommandEnabled(IDC_SHOW_HISTORY,
!profile()->IsGuestSession());
command_updater_.UpdateCommandEnabled(IDC_SHOW_HISTORY, !guest_session);
command_updater_.UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, true);
command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE_VIA_KEYBOARD, true);
command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE_VIA_MENU, true);
command_updater_.UpdateCommandEnabled(IDC_BOOKMARKS_MENU,
!profile()->IsGuestSession());
command_updater_.UpdateCommandEnabled(IDC_BOOKMARKS_MENU, !guest_session);
command_updater_.UpdateCommandEnabled(IDC_RECENT_TABS_MENU,
!profile()->IsGuestSession() &&
!guest_session &&
!profile()->IsOffTheRecord());
command_updater_.UpdateCommandEnabled(IDC_CLEAR_BROWSING_DATA, normal_window);
#if defined(OS_CHROMEOS)
command_updater_.UpdateCommandEnabled(IDC_TAKE_SCREENSHOT, true);
#else
// Chrome OS uses the system tray menu to handle multi-profiles.
if (normal_window && (guest_session || !profile()->IsOffTheRecord()))
command_updater_.UpdateCommandEnabled(IDC_SHOW_AVATAR_MENU, true);
#endif
UpdateShowSyncState(true);
// Initialize other commands based on the window type.
bool normal_window = browser_->is_type_tabbed();
// Navigation commands
command_updater_.UpdateCommandEnabled(
IDC_HOME,
......@@ -1015,39 +994,24 @@ void BrowserCommandController::InitCommandState() {
command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_7, normal_window);
command_updater_.UpdateCommandEnabled(IDC_SELECT_LAST_TAB, normal_window);
#if defined(OS_WIN)
#if !defined(USE_AURA)
const bool metro_mode = base::win::IsMetroProcess();
#else
const bool metro_mode =
browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ?
true : false;
#endif
command_updater_.UpdateCommandEnabled(IDC_METRO_SNAP_ENABLE, metro_mode);
command_updater_.UpdateCommandEnabled(IDC_METRO_SNAP_DISABLE, metro_mode);
int restart_mode = metro_mode ?
IDC_WIN8_DESKTOP_RESTART : IDC_WIN8_METRO_RESTART;
bool metro = browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH;
command_updater_.UpdateCommandEnabled(IDC_METRO_SNAP_ENABLE, metro);
command_updater_.UpdateCommandEnabled(IDC_METRO_SNAP_DISABLE, metro);
int restart_mode = metro ? IDC_WIN8_DESKTOP_RESTART : IDC_WIN8_METRO_RESTART;
command_updater_.UpdateCommandEnabled(restart_mode, normal_window);
#endif
// Show various bits of UI
command_updater_.UpdateCommandEnabled(IDC_CLEAR_BROWSING_DATA, normal_window);
// The upgrade entry and the view incompatibility entry should always be
// enabled. Whether they are visible is a separate matter determined on menu
// show.
// These are always enabled; the menu determines their menu item visibility.
command_updater_.UpdateCommandEnabled(IDC_UPGRADE_DIALOG, true);
command_updater_.UpdateCommandEnabled(IDC_VIEW_INCOMPATIBILITIES, true);
// Toggle speech input
command_updater_.UpdateCommandEnabled(IDC_TOGGLE_SPEECH_INPUT, true);
// Initialize other commands whose state changes based on fullscreen mode.
// Initialize other commands whose state changes based on various conditions.
UpdateCommandsForFullscreenMode();
UpdateCommandsForContentRestrictionState();
UpdateCommandsForBookmarkEditing();
UpdateCommandsForIncognitoAvailability();
}
......@@ -1279,18 +1243,6 @@ void BrowserCommandController::UpdateCommandsForFullscreenMode() {
fullscreen_enabled);
UpdateCommandsForBookmarkBar();
UpdateCommandsForMultipleProfiles();
}
void BrowserCommandController::UpdateCommandsForMultipleProfiles() {
bool is_regular_or_guest_session =
profile()->IsGuestSession() || !profile()->IsOffTheRecord();
bool enable = IsShowingMainUI() &&
is_regular_or_guest_session &&
profile_manager_ &&
AvatarMenu::ShouldShowAvatarMenu();
command_updater_.UpdateCommandEnabled(IDC_SHOW_AVATAR_MENU,
enable);
}
void BrowserCommandController::UpdatePrintingState() {
......
......@@ -11,7 +11,6 @@
#include "base/prefs/pref_member.h"
#include "chrome/browser/command_updater.h"
#include "chrome/browser/command_updater_delegate.h"
#include "chrome/browser/profiles/profile_info_cache_observer.h"
#include "chrome/browser/sessions/tab_restore_service_observer.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "ui/base/window_open_disposition.h"
......@@ -19,7 +18,6 @@
class Browser;
class BrowserWindow;
class Profile;
class ProfileManager;
namespace content {
struct NativeWebKeyboardEvent;
......@@ -28,11 +26,10 @@ struct NativeWebKeyboardEvent;
namespace chrome {
class BrowserCommandController : public CommandUpdaterDelegate,
public ProfileInfoCacheObserver,
public TabStripModelObserver,
public TabRestoreServiceObserver {
public:
BrowserCommandController(Browser* browser, ProfileManager* profile_manager);
explicit BrowserCommandController(Browser* browser);
virtual ~BrowserCommandController();
CommandUpdater* command_updater() { return &command_updater_; }
......@@ -84,11 +81,6 @@ class BrowserCommandController : public CommandUpdaterDelegate,
int id,
WindowOpenDisposition disposition) OVERRIDE;
// Overridden from ProfileInfoCacheObserver:
virtual void OnProfileAdded(const base::FilePath& profile_path) OVERRIDE;
virtual void OnProfileWasRemoved(const base::FilePath& profile_path,
const base::string16& profile_name) OVERRIDE;
// Overridden from TabStripModelObserver:
virtual void TabInsertedAt(content::WebContents* contents,
int index,
......@@ -141,10 +133,6 @@ class BrowserCommandController : public CommandUpdaterDelegate,
// window is in.
void UpdateCommandsForFullscreenMode();
// Update commands whose state depends on whether multiple profiles are
// allowed.
void UpdateCommandsForMultipleProfiles();
// Updates the printing command state.
void UpdatePrintingState();
......@@ -175,8 +163,6 @@ class BrowserCommandController : public CommandUpdaterDelegate,
Browser* browser_;
ProfileManager* profile_manager_;
// The CommandUpdater that manages the browser window commands.
CommandUpdater command_updater_;
......
......@@ -171,7 +171,7 @@ TEST_F(BrowserCommandControllerTest, AppFullScreen) {
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN));
}
TEST_F(BrowserCommandControllerTest, OldAvatarMenuDisabledWhenOnlyOneProfile) {
TEST_F(BrowserCommandControllerTest, OldAvatarMenuEnabledForOneOrMoreProfiles) {
#if defined(OS_CHROMEOS)
// TODO(nkostylev): Cleanup this code once multi-profiles are enabled by
// default on CrOS. http://crbug.com/351655
......@@ -188,26 +188,26 @@ TEST_F(BrowserCommandControllerTest, OldAvatarMenuDisabledWhenOnlyOneProfile) {
ASSERT_TRUE(testing_profile_manager.SetUp());
ProfileManager* profile_manager = testing_profile_manager.profile_manager();
chrome::BrowserCommandController command_controller(browser(),
profile_manager);
chrome::BrowserCommandController command_controller(browser());
const CommandUpdater* command_updater = command_controller.command_updater();
bool enabled = true;
#if defined(OS_CHROMEOS)
// Chrome OS uses system tray menu to handle multi-profiles.
enabled = false;
#endif
testing_profile_manager.CreateTestingProfile("p1");
ASSERT_EQ(1U, profile_manager->GetNumberOfProfiles());
EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU));
EXPECT_EQ(enabled, command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU));
testing_profile_manager.CreateTestingProfile("p2");
ASSERT_EQ(2U, profile_manager->GetNumberOfProfiles());
#if defined(OS_CHROMEOS)
// Chrome OS uses system tray menu to handle multi-profiles.
EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU));
#else
EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU));
#endif
EXPECT_EQ(enabled, command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU));
testing_profile_manager.DeleteTestingProfile("p1");
ASSERT_EQ(1U, profile_manager->GetNumberOfProfiles());
EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU));
EXPECT_EQ(enabled, command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU));
testing_profile_manager.DeleteTestingProfile("p2");
}
......@@ -232,8 +232,7 @@ TEST_F(BrowserCommandControllerTest, NewAvatarMenuEnabledWhenOnlyOneProfile) {
ASSERT_TRUE(testing_profile_manager.SetUp());
ProfileManager* profile_manager = testing_profile_manager.profile_manager();
chrome::BrowserCommandController command_controller(browser(),
profile_manager);
chrome::BrowserCommandController command_controller(browser());
const CommandUpdater* command_updater = command_controller.command_updater();
testing_profile_manager.CreateTestingProfile("p1");
......@@ -265,7 +264,6 @@ TEST_F(BrowserCommandControllerTest, NewAvatarMenuEnabledInGuestMode) {
TestingProfileManager testing_profile_manager(
TestingBrowserProcess::GetGlobal());
ASSERT_TRUE(testing_profile_manager.SetUp());
ProfileManager* profile_manager = testing_profile_manager.profile_manager();
// Set up guest a profile.
TestingProfile::Builder guest_builder;
......@@ -281,8 +279,7 @@ TEST_F(BrowserCommandControllerTest, NewAvatarMenuEnabledInGuestMode) {
chrome::GetActiveDesktop());
scoped_ptr<Browser> guest_browser(
chrome::CreateBrowserWithTestWindowForParams(&profile_params));
chrome::BrowserCommandController command_controller(guest_browser.get(),
profile_manager);
chrome::BrowserCommandController command_controller(guest_browser.get());
const CommandUpdater* command_updater = command_controller.command_updater();
#if defined(OS_CHROMEOS)
// Chrome OS uses system tray menu to handle multi-profiles.
......@@ -302,10 +299,6 @@ TEST_F(BrowserCommandControllerTest, AvatarMenuAlwaysDisabledInIncognitoMode) {
if (!profiles::IsMultipleProfilesEnabled())
return;
TestingProfileManager testing_profile_manager(
TestingBrowserProcess::GetGlobal());
ASSERT_TRUE(testing_profile_manager.SetUp());
// Set up a profile with an off the record profile.
TestingProfile::Builder normal_builder;
scoped_ptr<TestingProfile> original_profile = normal_builder.Build();
......@@ -316,9 +309,7 @@ TEST_F(BrowserCommandControllerTest, AvatarMenuAlwaysDisabledInIncognitoMode) {
scoped_ptr<Browser> otr_browser(
chrome::CreateBrowserWithTestWindowForParams(&profile_params));
ProfileManager* profile_manager = testing_profile_manager.profile_manager();
chrome::BrowserCommandController command_controller(otr_browser.get(),
profile_manager);
chrome::BrowserCommandController command_controller(otr_browser.get());
const CommandUpdater* command_updater = command_controller.command_updater();
// The old style avatar menu should be disabled.
......@@ -465,10 +456,6 @@ TEST_F(BrowserCommandControllerFullscreenTest,
}
TEST_F(BrowserCommandControllerTest, IncognitoModeOnSigninAllowedPrefChange) {
TestingProfileManager testing_profile_manager(
TestingBrowserProcess::GetGlobal());
ASSERT_TRUE(testing_profile_manager.SetUp());
// Set up a profile with an off the record profile.
TestingProfile::Builder builder;
builder.SetIncognito();
......@@ -485,9 +472,7 @@ TEST_F(BrowserCommandControllerTest, IncognitoModeOnSigninAllowedPrefChange) {
scoped_ptr<Browser> browser2(
chrome::CreateBrowserWithTestWindowForParams(&profile_params));
ProfileManager* profile_manager = testing_profile_manager.profile_manager();
chrome::BrowserCommandController command_controller(browser2.get(),
profile_manager);
chrome::BrowserCommandController command_controller(browser2.get());
const CommandUpdater* command_updater = command_controller.command_updater();
// Check that the SYNC_SETUP command is updated on preference change.
......@@ -497,12 +482,7 @@ TEST_F(BrowserCommandControllerTest, IncognitoModeOnSigninAllowedPrefChange) {
}
TEST_F(BrowserCommandControllerTest, OnSigninAllowedPrefChange) {
TestingProfileManager testing_profile_manager(
TestingBrowserProcess::GetGlobal());
ASSERT_TRUE(testing_profile_manager.SetUp());
ProfileManager* profile_manager = testing_profile_manager.profile_manager();
chrome::BrowserCommandController command_controller(browser(),
profile_manager);
chrome::BrowserCommandController command_controller(browser());
const CommandUpdater* command_updater = command_controller.command_updater();
// Check that the SYNC_SETUP command is updated on preference change.
......
......@@ -706,7 +706,10 @@ void BrowserWindowCocoa::ShowAvatarBubble(WebContents* web_contents,
void BrowserWindowCocoa::ShowAvatarBubbleFromAvatarButton(
AvatarBubbleMode mode) {
AvatarBaseController* controller = [controller_ avatarButtonController];
[controller showAvatarBubble:[controller buttonView] withMode:mode];
NSView* anchor = [controller buttonView];
if ([anchor isHiddenOrHasHiddenAncestor])
anchor = [[controller_ toolbarController] wrenchButton];
[controller showAvatarBubble:anchor withMode:mode];
}
void BrowserWindowCocoa::ShowPasswordGenerationBubble(
......
......@@ -2369,7 +2369,8 @@ void BrowserView::ShowAvatarBubble(WebContents* web_contents,
views::View::ConvertPointToScreen(GetTabContentsContainerView(), &origin);
gfx::Rect bounds(origin, rect.size());
AvatarMenuBubbleView::ShowBubble(this, views::BubbleBorder::TOP_RIGHT,
AvatarMenuBubbleView::ShowBubble(
this, views::BubbleBorder::TOP_RIGHT, views::BubbleBorder::PAINT_NORMAL,
views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, bounds, browser_.get());
}
......@@ -2390,9 +2391,21 @@ void BrowserView::ShowAvatarBubbleFromAvatarButton(AvatarBubbleMode mode) {
views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, bounds, browser());
}
} else {
AvatarMenuButton* button = frame_->GetAvatarMenuButton();
if (button)
button->ShowAvatarBubble();
views::BubbleBorder::Arrow arrow = views::BubbleBorder::TOP_RIGHT;
views::View* anchor_view = frame_->GetAvatarMenuButton();
if (!anchor_view)
anchor_view = toolbar_->app_menu();
else if (!frame_->GetAvatarMenuButton()->button_on_right())
arrow = views::BubbleBorder::TOP_LEFT;
gfx::Point origin;
views::View::ConvertPointToScreen(anchor_view, &origin);
gfx::Rect bounds(origin, anchor_view->size());
views::BubbleBorder::ArrowPaintType arrow_paint_type =
ShouldHideUIForFullscreen() ? views::BubbleBorder::PAINT_TRANSPARENT :
views::BubbleBorder::PAINT_NORMAL;
AvatarMenuBubbleView::ShowBubble(anchor_view, arrow, arrow_paint_type,
views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, bounds, browser());
ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE);
}
}
......
......@@ -485,6 +485,7 @@ bool AvatarMenuBubbleView::close_on_deactivate_for_testing_ = true;
void AvatarMenuBubbleView::ShowBubble(
views::View* anchor_view,
views::BubbleBorder::Arrow arrow,
views::BubbleBorder::ArrowPaintType arrow_paint_type,
views::BubbleBorder::BubbleAlignment border_alignment,
const gfx::Rect& anchor_rect,
Browser* browser) {
......@@ -498,6 +499,7 @@ void AvatarMenuBubbleView::ShowBubble(
avatar_bubble_->set_close_on_deactivate(close_on_deactivate_for_testing_);
avatar_bubble_->SetBackgroundColors();
avatar_bubble_->SetAlignment(border_alignment);
avatar_bubble_->SetArrowPaintType(arrow_paint_type);
avatar_bubble_->GetWidget()->Show();
}
......
......@@ -50,6 +50,7 @@ class AvatarMenuBubbleView : public views::BubbleDelegateView,
// and (2) will correctly hide the old bubble instance.
static void ShowBubble(views::View* anchor_view,
views::BubbleBorder::Arrow arrow,
views::BubbleBorder::ArrowPaintType arrow_paint_type,
views::BubbleBorder::BubbleAlignment border_alignment,
const gfx::Rect& anchor_rect,
Browser* browser);
......
......@@ -12,6 +12,7 @@
#include "chrome/browser/profiles/profile_avatar_icon_util.h"
#include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/profiles/avatar_menu_bubble_view.h"
#include "chrome/browser/ui/views/profiles/profile_chooser_view.h"
......@@ -77,9 +78,7 @@ void AvatarMenuButton::OnPaint(gfx::Canvas* canvas) {
}
bool AvatarMenuButton::HitTestRect(const gfx::Rect& rect) const {
if (disabled_)
return false;
return views::MenuButton::HitTestRect(rect);
return !disabled_ && views::MenuButton::HitTestRect(rect);
}
void AvatarMenuButton::SetAvatarIcon(const gfx::Image& icon,
......@@ -93,28 +92,6 @@ void AvatarMenuButton::SetAvatarIcon(const gfx::Image& icon,
// views::MenuButtonListener implementation
void AvatarMenuButton::OnMenuButtonClicked(views::View* source,
const gfx::Point& point) {
if (disabled_)
return;
ShowAvatarBubble();
}
void AvatarMenuButton::ShowAvatarBubble() {
gfx::Point origin;
views::View::ConvertPointToScreen(this, &origin);
gfx::Rect bounds(origin, size());
views::BubbleBorder::Arrow arrow = button_on_right_ ?
views::BubbleBorder::TOP_RIGHT : views::BubbleBorder::TOP_LEFT;
if (switches::IsNewAvatarMenu()) {
ProfileChooserView::ShowBubble(
ProfileChooserView::BUBBLE_VIEW_MODE_PROFILE_CHOOSER,
this, arrow, views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, bounds,
browser_);
} else {
AvatarMenuBubbleView::ShowBubble(
this, arrow, views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, bounds,
browser_);
}
ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE);
if (!disabled_)
chrome::ShowAvatarMenu(browser_);
}
......@@ -49,8 +49,6 @@ class AvatarMenuButton : public views::MenuButton,
}
bool button_on_right() { return button_on_right_; }
void ShowAvatarBubble();
private:
// views::MenuButtonListener:
virtual void OnMenuButtonClicked(views::View* source,
......
......@@ -50,9 +50,6 @@ GAIAInfoUpdateServiceTest.*
ProfileManagerTest.*
ProfileInfoCacheTest.*
# Failing on the bot. http://crbug.com/167014
BrowserCommandControllerTest.AvatarMenuDisabledWhenOnlyOneProfile
# Failing on the bot. http://crbug.com/168882
UserCloudPolicyStoreTest.LoadWithInvalidFile
UserCloudPolicyStoreTest.LoadWithNoFile
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment