summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui
diff options
context:
space:
mode:
authorpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-20 22:18:12 +0000
committerpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-20 22:18:12 +0000
commit16d7415f2d746d7e41d03a97f93438e5cb467c9b (patch)
tree64b96ca10039d62ae511337edf2f787444f76ba5 /chrome/browser/ui
parentd1ec3f7f30d07132bf0f75e4938d50a508bc7637 (diff)
downloadchromium_src-16d7415f2d746d7e41d03a97f93438e5cb467c9b.zip
chromium_src-16d7415f2d746d7e41d03a97f93438e5cb467c9b.tar.gz
chromium_src-16d7415f2d746d7e41d03a97f93438e5cb467c9b.tar.bz2
Revert 224495 "Manually landing already reviewed https://coderev..."
Broke Linux ChromiumOS Tests : http://build.chromium.org/p/chromium.chromiumos/builders/Linux%20ChromiumOS%20Tests%20%281%29/builds/33127 > Manually landing already reviewed https://codereview.chromium.org/23876020/ on behalf of michaelpg@: > > Multiprofile avatar menu for ChromeOS users. > > This change affects ChromeOS when the multiple profiles flag is set. > If multiple user accounts have been logged in on a device, the avatar menu > will include a link to add a user to the session. Once some number of users > is added, the avatar menu will display all logged in users and allow the user > to switch to, or open, a browser window for a given profile. > > AvatarMenuModel moved to AvatarMenu, model and controller functions separated out into interfaces ProfileList and AvatarMenuActions. AvatarMenu instantiates components based on multi-profile flag and platform. ChromeOS version of ProfileList uses the UserManager to identify logged-in users and translate them into their corresponding profiles. > > BUG=288365 > TEST=manual, added /chrome/browser/chromeos/profiles/profile_list_chromeos_unittest.cc > TBR=ben,erg,dpolukhin,xiyuan,michaelpg > > Review URL: https://codereview.chromium.org/24330003 TBR=zelidrag@chromium.org Review URL: https://codereview.chromium.org/23497007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@224505 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui')
-rw-r--r--chrome/browser/ui/browser_command_controller.cc4
-rw-r--r--chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller.h18
-rw-r--r--chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller.mm41
-rw-r--r--chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller_unittest.mm15
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller.mm4
-rw-r--r--chrome/browser/ui/cocoa/profile_menu_controller.h8
-rw-r--r--chrome/browser/ui/cocoa/profile_menu_controller.mm53
-rw-r--r--chrome/browser/ui/gtk/avatar_menu_bubble_gtk.cc38
-rw-r--r--chrome/browser/ui/gtk/avatar_menu_bubble_gtk.h14
-rw-r--r--chrome/browser/ui/gtk/avatar_menu_item_gtk.cc2
-rw-r--r--chrome/browser/ui/gtk/avatar_menu_item_gtk.h6
-rw-r--r--chrome/browser/ui/gtk/browser_titlebar.cc4
-rw-r--r--chrome/browser/ui/views/avatar_menu_bubble_view.cc79
-rw-r--r--chrome/browser/ui/views/avatar_menu_bubble_view.h26
-rw-r--r--chrome/browser/ui/views/avatar_menu_button.cc2
-rw-r--r--chrome/browser/ui/views/avatar_menu_button_browsertest.cc16
-rw-r--r--chrome/browser/ui/views/frame/browser_non_client_frame_view.cc6
-rw-r--r--chrome/browser/ui/views/frame/browser_view.cc4
-rw-r--r--chrome/browser/ui/views/profile_chooser_view.cc51
-rw-r--r--chrome/browser/ui/views/profile_chooser_view.h24
-rw-r--r--chrome/browser/ui/webui/signin/user_manager_screen_handler.cc4
21 files changed, 203 insertions, 216 deletions
diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc
index 2afe9be..fea6d8d 100644
--- a/chrome/browser/ui/browser_command_controller.cc
+++ b/chrome/browser/ui/browser_command_controller.cc
@@ -12,7 +12,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/avatar_menu_model.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/sessions/tab_restore_service.h"
@@ -1194,7 +1194,7 @@ void BrowserCommandController::UpdateCommandsForMultipleProfiles() {
bool enable = IsShowingMainUI() &&
!profile()->IsOffTheRecord() &&
profile_manager_ &&
- AvatarMenu::ShouldShowAvatarMenu();
+ AvatarMenuModel::ShouldShowAvatarMenu();
command_updater_.UpdateCommandEnabled(IDC_SHOW_AVATAR_MENU,
enable);
}
diff --git a/chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller.h b/chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller.h
index 2f8465a..b0eb8f0 100644
--- a/chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller.h
+++ b/chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller.h
@@ -12,15 +12,15 @@
#import "chrome/browser/ui/cocoa/base_bubble_controller.h"
#import "ui/base/cocoa/tracking_area.h"
-class AvatarMenu;
+class AvatarMenuModel;
class Browser;
// This window controller manages the bubble that displays a "menu" of profiles.
// It is brought open by clicking on the avatar icon in the window frame.
@interface AvatarMenuBubbleController : BaseBubbleController {
@private
- // The menu that contains the data from the backend.
- scoped_ptr<AvatarMenu> menu_;
+ // The model that contains the data from the backend.
+ scoped_ptr<AvatarMenuModel> model_;
// Array of the below view controllers.
base::scoped_nsobject<NSMutableArray> items_;
@@ -29,7 +29,7 @@ class Browser;
BOOL expanded_;
}
-// Designated initializer. The browser is passed to the menu for profile
+// Designated initializer. The browser is passed to the model for profile
// information.
- (id)initWithBrowser:(Browser*)parentBrowser
anchoredAt:(NSPoint)point;
@@ -57,8 +57,8 @@ class Browser;
// The parent menu controller; owns this.
__weak AvatarMenuBubbleController* controller_;
- // The index of the item in the AvatarMenu.
- size_t menuIndex_;
+ // The AvatarMenuModel::item.model_index field.
+ size_t modelIndex_;
// Tracks whether this item is currently highlighted.
BOOL isHighlighted_;
@@ -77,7 +77,7 @@ class Browser;
__weak NSTextField* emailField_;
__weak NSButton* editButton_;
}
-@property(readonly, nonatomic) size_t menuIndex;
+@property(readonly, nonatomic) size_t modelIndex;
@property(assign, nonatomic) BOOL isHighlighted;
@property(assign, nonatomic) IBOutlet NSImageView* iconView;
@property(assign, nonatomic) IBOutlet NSImageView* activeView;
@@ -86,7 +86,7 @@ class Browser;
@property(assign, nonatomic) IBOutlet NSButton* editButton;
// Designated initializer.
-- (id)initWithMenuIndex:(size_t)menuIndex
+- (id)initWithModelIndex:(size_t)modelIndex
menuController:(AvatarMenuBubbleController*)controller;
// Actions that are forwarded to the |controller_|.
@@ -127,7 +127,7 @@ class Browser;
// Testing API /////////////////////////////////////////////////////////////////
@interface AvatarMenuBubbleController (ExposedForTesting)
-- (id)initWithMenu:(AvatarMenu*)menu
+- (id)initWithModel:(AvatarMenuModel*)model
parentWindow:(NSWindow*)parent
anchoredAt:(NSPoint)point;
- (void)performLayout;
diff --git a/chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller.mm b/chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller.mm
index 0f635be..f0ed688 100644
--- a/chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller.mm
@@ -8,7 +8,7 @@
#include "base/mac/mac_util.h"
#include "base/strings/sys_string_conversions.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/profiles/avatar_menu.h"
+#include "chrome/browser/profiles/avatar_menu_model.h"
#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h"
@@ -25,7 +25,7 @@
#include "ui/gfx/image/image.h"
@interface AvatarMenuBubbleController (Private)
-- (AvatarMenu*)menu;
+- (AvatarMenuModel*)model;
- (NSView*)configureManagedUserInformation:(CGFloat)width;
- (NSButton*)configureNewUserButton:(CGFloat)yOffset
updateWidthAdjust:(CGFloat*)widthAdjust;
@@ -72,12 +72,11 @@ const CGFloat kManagedUserSpacing = 26.0;
// to be positioned incorrectly. Since the bubble will be dismissed on losing
// key status, it's impossible for the user to edit the information in a
// meaningful way such that it would need to be redrawn.
- AvatarMenu* menu = new AvatarMenu(
+ AvatarMenuModel* model = new AvatarMenuModel(
&g_browser_process->profile_manager()->GetProfileInfoCache(),
NULL, parentBrowser);
- menu->RebuildMenu();
- if ((self = [self initWithMenu:menu
+ if ((self = [self initWithModel:model
parentWindow:parentBrowser->window()->GetNativeWindow()
anchoredAt:point])) {
}
@@ -85,18 +84,18 @@ const CGFloat kManagedUserSpacing = 26.0;
}
- (IBAction)newProfile:(id)sender {
- menu_->AddNewProfile(ProfileMetrics::ADD_NEW_USER_ICON);
+ model_->AddNewProfile(ProfileMetrics::ADD_NEW_USER_ICON);
}
- (IBAction)switchToProfile:(id)sender {
// Check the event flags to see if a new window should be crated.
bool always_create = ui::WindowOpenDispositionFromNSEvent(
[NSApp currentEvent]) == NEW_WINDOW;
- menu_->SwitchToProfile([sender menuIndex], always_create);
+ model_->SwitchToProfile([sender modelIndex], always_create);
}
- (IBAction)editProfile:(id)sender {
- menu_->EditProfile([sender menuIndex]);
+ model_->EditProfile([sender modelIndex]);
}
- (IBAction)switchProfile:(id)sender {
@@ -106,7 +105,7 @@ const CGFloat kManagedUserSpacing = 26.0;
// Private /////////////////////////////////////////////////////////////////////
-- (id)initWithMenu:(AvatarMenu*)menu
+- (id)initWithModel:(AvatarMenuModel*)model
parentWindow:(NSWindow*)parent
anchoredAt:(NSPoint)point {
// Use an arbitrary height because it will reflect the size of the content.
@@ -120,7 +119,7 @@ const CGFloat kManagedUserSpacing = 26.0;
if ((self = [super initWithWindow:window
parentWindow:parent
anchoredAt:point])) {
- menu_.reset(menu);
+ model_.reset(model);
[window accessibilitySetOverrideValue:
l10n_util::GetNSString(IDS_PROFILES_BUBBLE_ACCESSIBLE_NAME)
@@ -139,11 +138,11 @@ const CGFloat kManagedUserSpacing = 26.0;
updateWidthAdjust:(CGFloat*)widthAdjust
setYOffset:(CGFloat)yOffset {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- const AvatarMenu::Item& item = menu_->GetItemAt(itemIndex);
+ const AvatarMenuModel::Item& item = model_->GetItemAt(itemIndex);
// Create the item view controller. Autorelease it because it will be owned
// by the |items_| array.
AvatarMenuItemController* itemView =
- [[[AvatarMenuItemController alloc] initWithMenuIndex:itemIndex
+ [[[AvatarMenuItemController alloc] initWithModelIndex:item.model_index
menuController:self] autorelease];
itemView.iconView.image = item.icon.ToNSImage();
@@ -214,7 +213,7 @@ const CGFloat kManagedUserSpacing = 26.0;
CGFloat yOffset = kLinkSpacing;
CGFloat widthAdjust = 0;
- if (menu_->ShouldShowAddNewProfileLink()) {
+ if (model_->ShouldShowAddNewProfileLink()) {
// Since drawing happens bottom-up, start with the "New User" link.
NSButton* newButton =
[self configureNewUserButton:yOffset updateWidthAdjust:&widthAdjust];
@@ -232,7 +231,7 @@ const CGFloat kManagedUserSpacing = 26.0;
}
// Loop over the profiles in reverse, constructing the menu items.
- for (int i = menu_->GetNumberOfItems() - 1; i >= 0; --i) {
+ for (int i = model_->GetNumberOfItems() - 1; i >= 0; --i) {
AvatarMenuItemController* itemView = [self initAvatarItem:i
updateWidthAdjust:&widthAdjust
setYOffset:yOffset];
@@ -270,7 +269,7 @@ const CGFloat kManagedUserSpacing = 26.0;
// will have to adjust its frame later after adding general information about
// managed users.
AvatarMenuItemController* itemView =
- [self initAvatarItem:menu_->GetActiveProfileIndex()
+ [self initAvatarItem:model_->GetActiveProfileIndex()
updateWidthAdjust:&widthAdjust
setYOffset:yOffset];
@@ -309,7 +308,7 @@ const CGFloat kManagedUserSpacing = 26.0;
items_.reset([[NSMutableArray alloc] init]);
[contentView setSubviews:[NSArray array]];
- if (menu_->GetManagedUserInformation().empty() || expanded_)
+ if (model_->GetManagedUserInformation().empty() || expanded_)
[self initMenuContents];
else
[self initManagedUserContents];
@@ -322,11 +321,11 @@ const CGFloat kManagedUserSpacing = 26.0;
// Add the limited user icon on the left side of the information TextView.
base::scoped_nsobject<NSImageView> iconView(
[[NSImageView alloc] initWithFrame:NSMakeRect(5, 0, 16, 16)]);
- [iconView setImage:menu_->GetManagedUserIcon().ToNSImage()];
+ [iconView setImage:model_->GetManagedUserIcon().ToNSImage()];
[container addSubview:iconView];
NSString* info =
- base::SysUTF16ToNSString(menu_->GetManagedUserInformation());
+ base::SysUTF16ToNSString(model_->GetManagedUserInformation());
NSDictionary* attributes =
@{ NSFontAttributeName : [NSFont labelFontOfSize:12] };
base::scoped_nsobject<NSAttributedString> attrString(
@@ -464,7 +463,7 @@ const CGFloat kManagedUserSpacing = 26.0;
@implementation AvatarMenuItemController
-@synthesize menuIndex = menuIndex_;
+@synthesize modelIndex = modelIndex_;
@synthesize isHighlighted = isHighlighted_;
@synthesize iconView = iconView_;
@synthesize activeView = activeView_;
@@ -472,11 +471,11 @@ const CGFloat kManagedUserSpacing = 26.0;
@synthesize emailField = emailField_;
@synthesize editButton = editButton_;
-- (id)initWithMenuIndex:(size_t)menuIndex
+- (id)initWithModelIndex:(size_t)modelIndex
menuController:(AvatarMenuBubbleController*)controller {
if ((self = [super initWithNibName:@"AvatarMenuItem"
bundle:base::mac::FrameworkBundle()])) {
- menuIndex_ = menuIndex;
+ modelIndex_ = modelIndex;
controller_ = controller;
[self loadView];
[nameField_ setAutoresizingMask:NSViewNotSizable];
diff --git a/chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller_unittest.mm
index 1f7d23f..e91fb3b 100644
--- a/chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller_unittest.mm
@@ -9,8 +9,8 @@
#include "base/message_loop/message_pump_mac.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/prefs/pref_service_syncable.h"
-#include "chrome/browser/profiles/avatar_menu.h"
-#include "chrome/browser/profiles/avatar_menu_observer.h"
+#include "chrome/browser/profiles/avatar_menu_model.h"
+#include "chrome/browser/profiles/avatar_menu_model_observer.h"
#include "chrome/browser/profiles/profile_info_cache.h"
#import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
#include "chrome/test/base/testing_browser_process.h"
@@ -34,20 +34,19 @@ class AvatarMenuBubbleControllerTest : public CocoaTest {
manager_.CreateTestingProfile("test2", scoped_ptr<PrefServiceSyncable>(),
ASCIIToUTF16("Test 2"), 0, std::string());
- menu_ = new AvatarMenu(manager_.profile_info_cache(), NULL, NULL);
- menu_->RebuildMenu();
+ model_ = new AvatarMenuModel(manager_.profile_info_cache(), NULL, NULL);
NSRect frame = [test_window() frame];
NSPoint point = NSMakePoint(NSMidX(frame), NSMidY(frame));
controller_ =
- [[AvatarMenuBubbleController alloc] initWithMenu:menu()
+ [[AvatarMenuBubbleController alloc] initWithModel:model()
parentWindow:test_window()
anchoredAt:point];
}
TestingProfileManager* manager() { return &manager_; }
AvatarMenuBubbleController* controller() { return controller_; }
- AvatarMenu* menu() { return menu_; }
+ AvatarMenuModel* model() { return model_; }
AvatarMenuItemController* GetHighlightedItem() {
for (AvatarMenuItemController* item in [controller() items]) {
@@ -64,7 +63,7 @@ class AvatarMenuBubbleControllerTest : public CocoaTest {
AvatarMenuBubbleController* controller_;
// Weak; owned by |controller_|.
- AvatarMenu* menu_;
+ AvatarMenuModel* model_;
};
TEST_F(AvatarMenuBubbleControllerTest, InitialLayout) {
@@ -183,7 +182,7 @@ TEST_F(AvatarMenuBubbleControllerTest, PerformLayout) {
TEST_F(AvatarMenuBubbleControllerTest, HighlightForEventType) {
base::scoped_nsobject<TestingAvatarMenuItemController> item(
- [[TestingAvatarMenuItemController alloc] initWithMenuIndex:0
+ [[TestingAvatarMenuItemController alloc] initWithModelIndex:0
menuController:nil]);
// Test non-active states first.
[[item activeView] setHidden:YES];
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm
index 58048b9..9d73a30 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -17,7 +17,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/devtools/devtools_window.h"
#include "chrome/browser/fullscreen.h"
-#include "chrome/browser/profiles/avatar_menu.h"
+#include "chrome/browser/profiles/avatar_menu_model.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_manager.h"
@@ -1503,7 +1503,7 @@ enum {
return NO;
}
- return AvatarMenu::ShouldShowAvatarMenu();
+ return AvatarMenuModel::ShouldShowAvatarMenu();
}
- (BOOL)isBookmarkBarVisible {
diff --git a/chrome/browser/ui/cocoa/profile_menu_controller.h b/chrome/browser/ui/cocoa/profile_menu_controller.h
index ee0bbc6..d7e552b 100644
--- a/chrome/browser/ui/cocoa/profile_menu_controller.h
+++ b/chrome/browser/ui/cocoa/profile_menu_controller.h
@@ -9,7 +9,7 @@
#include "base/memory/scoped_ptr.h"
-class AvatarMenu;
+class AvatarMenuModel;
class Browser;
namespace ProfileMenuControllerInternal {
@@ -21,11 +21,11 @@ class Observer;
// whenever the active browser changes.
@interface ProfileMenuController : NSObject {
@private
- // The controller for the profile submenu.
- scoped_ptr<AvatarMenu> menu_;
+ // The model for the profile submenu.
+ scoped_ptr<AvatarMenuModel> model_;
// An observer to be notified when the active browser changes and when the
- // menu model changes.
+ // model changes.
scoped_ptr<ProfileMenuControllerInternal::Observer> observer_;
// The main menu item to which the profile menu is attached.
diff --git a/chrome/browser/ui/cocoa/profile_menu_controller.mm b/chrome/browser/ui/cocoa/profile_menu_controller.mm
index ce2b9e5..cdccc9e 100644
--- a/chrome/browser/ui/cocoa/profile_menu_controller.mm
+++ b/chrome/browser/ui/cocoa/profile_menu_controller.mm
@@ -7,8 +7,8 @@
#include "base/mac/scoped_nsobject.h"
#include "base/strings/sys_string_conversions.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/profiles/avatar_menu.h"
-#include "chrome/browser/profiles/avatar_menu_observer.h"
+#include "chrome/browser/profiles/avatar_menu_model.h"
+#include "chrome/browser/profiles/avatar_menu_model_observer.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_info_interface.h"
@@ -29,7 +29,7 @@
namespace ProfileMenuControllerInternal {
class Observer : public chrome::BrowserListObserver,
- public AvatarMenuObserver {
+ public AvatarMenuModelObserver {
public:
Observer(ProfileMenuController* controller) : controller_(controller) {
BrowserList::AddObserver(this);
@@ -48,8 +48,8 @@ class Observer : public chrome::BrowserListObserver,
[controller_ activeBrowserChangedTo:browser];
}
- // AvatarMenuObserver:
- virtual void OnAvatarMenuChanged(AvatarMenu* menu) OVERRIDE {
+ // AvatarMenuModelObserver:
+ virtual void OnAvatarMenuModelChanged(AvatarMenuModel* model) OVERRIDE {
[controller_ rebuildMenu];
}
@@ -82,29 +82,29 @@ class Observer : public chrome::BrowserListObserver,
}
- (IBAction)switchToProfileFromMenu:(id)sender {
- menu_->SwitchToProfile([sender tag], false);
+ model_->SwitchToProfile([sender tag], false);
ProfileMetrics::LogProfileSwitchUser(ProfileMetrics::SWITCH_PROFILE_MENU);
}
- (IBAction)switchToProfileFromDock:(id)sender {
// Explicitly bring to the foreground when taking action from the dock.
[NSApp activateIgnoringOtherApps:YES];
- menu_->SwitchToProfile([sender tag], false);
+ model_->SwitchToProfile([sender tag], false);
ProfileMetrics::LogProfileSwitchUser(ProfileMetrics::SWITCH_PROFILE_DOCK);
}
- (IBAction)editProfile:(id)sender {
- menu_->EditProfile(menu_->GetActiveProfileIndex());
+ model_->EditProfile(model_->GetActiveProfileIndex());
}
- (IBAction)newProfile:(id)sender {
- menu_->AddNewProfile(ProfileMetrics::ADD_NEW_USER_MENU);
+ model_->AddNewProfile(ProfileMetrics::ADD_NEW_USER_MENU);
}
- (BOOL)insertItemsIntoMenu:(NSMenu*)menu
atOffset:(NSInteger)offset
fromDock:(BOOL)dock {
- if (!menu_ || !menu_->ShouldShowAvatarMenu())
+ if (!model_ || !model_->ShouldShowAvatarMenu())
return NO;
if (dock) {
@@ -118,14 +118,14 @@ class Observer : public chrome::BrowserListObserver,
[menu insertItem:header atIndex:offset++];
}
- for (size_t i = 0; i < menu_->GetNumberOfItems(); ++i) {
- const AvatarMenu::Item& itemData = menu_->GetItemAt(i);
+ for (size_t i = 0; i < model_->GetNumberOfItems(); ++i) {
+ const AvatarMenuModel::Item& itemData = model_->GetItemAt(i);
NSString* name = base::SysUTF16ToNSString(itemData.name);
SEL action = dock ? @selector(switchToProfileFromDock:)
: @selector(switchToProfileFromMenu:);
NSMenuItem* item = [self createItemWithTitle:name
action:action];
- [item setTag:itemData.menu_index];
+ [item setTag:itemData.model_index];
if (dock) {
[item setIndentationLevel:1];
} else {
@@ -139,18 +139,20 @@ class Observer : public chrome::BrowserListObserver,
}
- (BOOL)validateMenuItem:(NSMenuItem*)menuItem {
- const AvatarMenu::Item& itemData = menu_->GetItemAt(
- menu_->GetActiveProfileIndex());
+ size_t activeProfileIndex = model_->GetActiveProfileIndex();
+ ProfileInfoCache* cache =
+ &g_browser_process->profile_manager()->GetProfileInfoCache();
+ BOOL profileIsManaged = cache->ProfileIsManagedAtIndex(activeProfileIndex);
if ([menuItem action] == @selector(switchToProfileFromDock:) ||
[menuItem action] == @selector(switchToProfileFromMenu:)) {
- if (!itemData.managed)
+ if (!profileIsManaged)
return YES;
- return [menuItem tag] == static_cast<NSInteger>(itemData.menu_index);
+ return [menuItem tag] == static_cast<NSInteger>(activeProfileIndex);
}
if ([menuItem action] == @selector(newProfile:))
- return !itemData.managed;
+ return !profileIsManaged;
return YES;
}
@@ -163,11 +165,10 @@ class Observer : public chrome::BrowserListObserver,
- (void)initializeMenu {
observer_.reset(new ProfileMenuControllerInternal::Observer(self));
- menu_.reset(new AvatarMenu(
+ model_.reset(new AvatarMenuModel(
&g_browser_process->profile_manager()->GetProfileInfoCache(),
observer_.get(),
NULL));
- menu_->RebuildMenu();
[[self menu] addItem:[NSMenuItem separatorItem]];
@@ -188,12 +189,12 @@ class Observer : public chrome::BrowserListObserver,
// Notifies the controller that the active browser has changed and that the
// menu item and menu need to be updated to reflect that.
- (void)activeBrowserChangedTo:(Browser*)browser {
- // Tell the menu that the browser has changed.
- menu_->ActiveBrowserChanged(browser);
+ // Tell the model that the browser has changed.
+ model_->set_browser(browser);
// If |browser| is NULL, it may be because the current profile was deleted
// and there are no other loaded profiles. In this case, calling
- // |menu_->GetActiveProfileIndex()| may result in a profile being loaded,
+ // |model_->GetActiveProfileIndex()| may result in a profile being loaded,
// which is inappropriate to do on the UI thread.
//
// An early return provides the desired behavior:
@@ -204,11 +205,11 @@ class Observer : public chrome::BrowserListObserver,
if (!browser)
return;
- size_t active_profile_index = menu_->GetActiveProfileIndex();
+ size_t active_profile_index = model_->GetActiveProfileIndex();
// Update the state for the menu items.
- for (size_t i = 0; i < menu_->GetNumberOfItems(); ++i) {
- size_t tag = menu_->GetItemAt(i).menu_index;
+ for (size_t i = 0; i < model_->GetNumberOfItems(); ++i) {
+ size_t tag = model_->GetItemAt(i).model_index;
[[[self menu] itemWithTag:tag]
setState:active_profile_index == tag ? NSOnState
: NSOffState];
diff --git a/chrome/browser/ui/gtk/avatar_menu_bubble_gtk.cc b/chrome/browser/ui/gtk/avatar_menu_bubble_gtk.cc
index 65d0b42..d68d933 100644
--- a/chrome/browser/ui/gtk/avatar_menu_bubble_gtk.cc
+++ b/chrome/browser/ui/gtk/avatar_menu_bubble_gtk.cc
@@ -8,7 +8,7 @@
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
-#include "chrome/browser/profiles/avatar_menu.h"
+#include "chrome/browser/profiles/avatar_menu_model.h"
#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h"
@@ -45,12 +45,11 @@ AvatarMenuBubbleGtk::AvatarMenuBubbleGtk(Browser* browser,
new_profile_link_(NULL),
minimum_width_(kBubbleMinWidth),
switching_(false) {
- avatar_menu_.reset(new AvatarMenu(
+ avatar_menu_model_.reset(new AvatarMenuModel(
&g_browser_process->profile_manager()->GetProfileInfoCache(),
this, browser));
- avatar_menu_->RebuildMenu();
- OnAvatarMenuChanged(avatar_menu_.get());
+ OnAvatarMenuModelChanged(avatar_menu_model_.get());
bubble_ = BubbleGtk::Show(anchor,
rect,
@@ -78,8 +77,8 @@ void AvatarMenuBubbleGtk::BubbleClosing(BubbleGtk* bubble,
bubble_ = NULL;
}
-void AvatarMenuBubbleGtk::OnAvatarMenuChanged(
- AvatarMenu* avatar_menu) {
+void AvatarMenuBubbleGtk::OnAvatarMenuModelChanged(
+ AvatarMenuModel* avatar_menu_model) {
items_.clear();
minimum_width_ = kBubbleMinWidth;
@@ -92,7 +91,7 @@ void AvatarMenuBubbleGtk::OpenProfile(size_t profile_index) {
GdkModifierType modifier_state;
gtk_get_current_event_state(&modifier_state);
guint modifier_state_uint = modifier_state;
- avatar_menu_->SwitchToProfile(profile_index,
+ avatar_menu_model_->SwitchToProfile(profile_index,
event_utils::DispositionFromGdkState(modifier_state_uint) == NEW_WINDOW);
CloseBubble();
}
@@ -100,7 +99,7 @@ void AvatarMenuBubbleGtk::OpenProfile(size_t profile_index) {
void AvatarMenuBubbleGtk::EditProfile(size_t profile_index) {
if (!bubble_)
return;
- avatar_menu_->EditProfile(profile_index);
+ avatar_menu_model_->EditProfile(profile_index);
CloseBubble();
}
@@ -116,20 +115,20 @@ void AvatarMenuBubbleGtk::OnSizeRequest(GtkWidget* widget,
void AvatarMenuBubbleGtk::OnNewProfileLinkClicked(GtkWidget* link) {
if (!bubble_)
return;
- avatar_menu_->AddNewProfile(ProfileMetrics::ADD_NEW_USER_ICON);
+ avatar_menu_model_->AddNewProfile(ProfileMetrics::ADD_NEW_USER_ICON);
CloseBubble();
}
void AvatarMenuBubbleGtk::OnSwitchProfileLinkClicked(GtkWidget* link) {
switching_ = true;
- OnAvatarMenuChanged(avatar_menu_.get());
+ OnAvatarMenuModelChanged(avatar_menu_model_.get());
}
void AvatarMenuBubbleGtk::InitMenuContents() {
- size_t profile_count = avatar_menu_->GetNumberOfItems();
+ size_t profile_count = avatar_menu_model_->GetNumberOfItems();
GtkWidget* items_vbox = gtk_vbox_new(FALSE, ui::kContentAreaSpacing);
for (size_t i = 0; i < profile_count; ++i) {
- AvatarMenu::Item menu_item = avatar_menu_->GetItemAt(i);
+ AvatarMenuModel::Item menu_item = avatar_menu_model_->GetItemAt(i);
AvatarMenuItemGtk* item = new AvatarMenuItemGtk(
this, menu_item, i, theme_service_);
items_.push_back(item);
@@ -141,7 +140,7 @@ void AvatarMenuBubbleGtk::InitMenuContents() {
}
gtk_box_pack_start(GTK_BOX(inner_contents_), items_vbox, TRUE, TRUE, 0);
- if (avatar_menu_->ShouldShowAddNewProfileLink()) {
+ if (avatar_menu_model_->ShouldShowAddNewProfileLink()) {
gtk_box_pack_start(GTK_BOX(inner_contents_),
gtk_hseparator_new(), TRUE, TRUE, 0);
@@ -158,12 +157,13 @@ void AvatarMenuBubbleGtk::InitMenuContents() {
gtk_box_pack_start(GTK_BOX(inner_contents_), link_align, FALSE, FALSE, 0);
}
+
}
void AvatarMenuBubbleGtk::InitManagedUserContents() {
- int active_index = avatar_menu_->GetActiveProfileIndex();
- AvatarMenu::Item menu_item =
- avatar_menu_->GetItemAt(active_index);
+ int active_index = avatar_menu_model_->GetActiveProfileIndex();
+ AvatarMenuModel::Item menu_item =
+ avatar_menu_model_->GetItemAt(active_index);
AvatarMenuItemGtk* item = new AvatarMenuItemGtk(
this, menu_item, active_index, theme_service_);
items_.push_back(item);
@@ -175,7 +175,7 @@ void AvatarMenuBubbleGtk::InitManagedUserContents() {
// Add information about managed users within a hbox.
GtkWidget* managed_user_info = gtk_hbox_new(FALSE, 5);
GdkPixbuf* limited_user_pixbuf =
- avatar_menu_->GetManagedUserIcon().ToGdkPixbuf();
+ avatar_menu_model_->GetManagedUserIcon().ToGdkPixbuf();
GtkWidget* limited_user_img = gtk_image_new_from_pixbuf(limited_user_pixbuf);
GtkWidget* icon_align = gtk_alignment_new(0, 0, 0, 0);
gtk_container_add(GTK_CONTAINER(icon_align), limited_user_img);
@@ -184,7 +184,7 @@ void AvatarMenuBubbleGtk::InitManagedUserContents() {
theme_service_->BuildLabel(std::string(), ui::kGdkBlack);
char* markup = g_markup_printf_escaped(
"<span size='small'>%s</span>",
- UTF16ToUTF8(avatar_menu_->GetManagedUserInformation()).c_str());
+ UTF16ToUTF8(avatar_menu_model_->GetManagedUserInformation()).c_str());
const int kLabelWidth = 150;
gtk_widget_set_size_request(status_label, kLabelWidth, -1);
gtk_label_set_markup(GTK_LABEL(status_label), markup);
@@ -222,7 +222,7 @@ void AvatarMenuBubbleGtk::InitContents() {
g_signal_connect(inner_contents_, "size-request",
G_CALLBACK(OnSizeRequestThunk), this);
- if (avatar_menu_->GetManagedUserInformation().empty() || switching_)
+ if (avatar_menu_model_->GetManagedUserInformation().empty() || switching_)
InitMenuContents();
else
InitManagedUserContents();
diff --git a/chrome/browser/ui/gtk/avatar_menu_bubble_gtk.h b/chrome/browser/ui/gtk/avatar_menu_bubble_gtk.h
index 4515dcb..f611f68 100644
--- a/chrome/browser/ui/gtk/avatar_menu_bubble_gtk.h
+++ b/chrome/browser/ui/gtk/avatar_menu_bubble_gtk.h
@@ -11,19 +11,19 @@
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
-#include "chrome/browser/profiles/avatar_menu_observer.h"
+#include "chrome/browser/profiles/avatar_menu_model_observer.h"
#include "chrome/browser/ui/gtk/avatar_menu_item_gtk.h"
#include "chrome/browser/ui/gtk/bubble/bubble_gtk.h"
#include "ui/base/gtk/gtk_signal.h"
-class AvatarMenu;
+class AvatarMenuModel;
class Browser;
class GtkThemeService;
// This bubble is displayed when the user clicks on the avatar button.
// It displays a list of profiles and allows users to switch between profiles.
class AvatarMenuBubbleGtk : public BubbleDelegateGtk,
- public AvatarMenuObserver,
+ public AvatarMenuModelObserver,
public AvatarMenuItemGtk::Delegate {
public:
AvatarMenuBubbleGtk(Browser* browser,
@@ -36,9 +36,9 @@ class AvatarMenuBubbleGtk : public BubbleDelegateGtk,
virtual void BubbleClosing(BubbleGtk* bubble,
bool closed_by_escape) OVERRIDE;
- // AvatarMenuObserver implementation.
- virtual void OnAvatarMenuChanged(
- AvatarMenu* avatar_menu) OVERRIDE;
+ // AvatarMenuModelObserver implementation.
+ virtual void OnAvatarMenuModelChanged(
+ AvatarMenuModel* avatar_menu_model) OVERRIDE;
// AvatarMenuItemGtk::Delegate implementation.
virtual void OpenProfile(size_t profile_index) OVERRIDE;
@@ -65,7 +65,7 @@ class AvatarMenuBubbleGtk : public BubbleDelegateGtk,
void CloseBubble();
// A model of all the profile information to be displayed in the menu.
- scoped_ptr<AvatarMenu> avatar_menu_;
+ scoped_ptr<AvatarMenuModel> avatar_menu_model_;
// A weak pointer to the parent widget of all widgets in the bubble.
GtkWidget* contents_;
diff --git a/chrome/browser/ui/gtk/avatar_menu_item_gtk.cc b/chrome/browser/ui/gtk/avatar_menu_item_gtk.cc
index b708d03..aabd490 100644
--- a/chrome/browser/ui/gtk/avatar_menu_item_gtk.cc
+++ b/chrome/browser/ui/gtk/avatar_menu_item_gtk.cc
@@ -44,7 +44,7 @@ const GdkColor kBackgroundColor = GDK_COLOR_RGB(0xff, 0xff, 0xff);
} // namespace
AvatarMenuItemGtk::AvatarMenuItemGtk(Delegate* delegate,
- const AvatarMenu::Item& item,
+ const AvatarMenuModel::Item& item,
size_t item_index,
GtkThemeService* theme_service)
: delegate_(delegate),
diff --git a/chrome/browser/ui/gtk/avatar_menu_item_gtk.h b/chrome/browser/ui/gtk/avatar_menu_item_gtk.h
index 058e134..5fe6655 100644
--- a/chrome/browser/ui/gtk/avatar_menu_item_gtk.h
+++ b/chrome/browser/ui/gtk/avatar_menu_item_gtk.h
@@ -7,7 +7,7 @@
#include <gtk/gtk.h>
-#include "chrome/browser/profiles/avatar_menu.h"
+#include "chrome/browser/profiles/avatar_menu_model.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "ui/base/gtk/gtk_signal.h"
@@ -32,7 +32,7 @@ class AvatarMenuItemGtk : public content::NotificationObserver {
};
AvatarMenuItemGtk(Delegate* delegate,
- const AvatarMenu::Item& item,
+ const AvatarMenuModel::Item& item,
size_t item_index,
GtkThemeService* theme_service);
virtual ~AvatarMenuItemGtk();
@@ -73,7 +73,7 @@ class AvatarMenuItemGtk : public content::NotificationObserver {
Delegate* delegate_;
// Profile information to display for this item, e.g. user name, sync status.
- AvatarMenu::Item item_;
+ AvatarMenuModel::Item item_;
// The index of this profile. The delegate uses this value to distinguish
// which profile should be switched to.
diff --git a/chrome/browser/ui/gtk/browser_titlebar.cc b/chrome/browser/ui/gtk/browser_titlebar.cc
index 42ce7c87..3400691 100644
--- a/chrome/browser/ui/gtk/browser_titlebar.cc
+++ b/chrome/browser/ui/gtk/browser_titlebar.cc
@@ -20,7 +20,7 @@
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
-#include "chrome/browser/profiles/avatar_menu.h"
+#include "chrome/browser/profiles/avatar_menu_model.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_manager.h"
@@ -1089,7 +1089,7 @@ bool BrowserTitlebar::ShouldDisplayAvatar() {
if (!browser_window_->browser()->is_type_tabbed())
return false;
- return AvatarMenu::ShouldShowAvatarMenu();
+ return AvatarMenuModel::ShouldShowAvatarMenu();
}
bool BrowserTitlebar::IsOffTheRecord() {
diff --git a/chrome/browser/ui/views/avatar_menu_bubble_view.cc b/chrome/browser/ui/views/avatar_menu_bubble_view.cc
index 401ff60..3089862 100644
--- a/chrome/browser/ui/views/avatar_menu_bubble_view.cc
+++ b/chrome/browser/ui/views/avatar_menu_bubble_view.cc
@@ -11,7 +11,7 @@
#include "base/strings/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/profiles/avatar_menu.h"
+#include "chrome/browser/profiles/avatar_menu_model.h"
#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_info_util.h"
#include "chrome/browser/profiles/profile_manager.h"
@@ -216,9 +216,8 @@ bool ProfileImageView::HitTestRect(const gfx::Rect& rect) const {
class ProfileItemView : public views::CustomButton,
public HighlightDelegate {
public:
- ProfileItemView(const AvatarMenu::Item& item,
- AvatarMenuBubbleView* parent,
- AvatarMenu* menu);
+ ProfileItemView(const AvatarMenuModel::Item& item,
+ AvatarMenuBubbleView* parent);
virtual gfx::Size GetPreferredSize() OVERRIDE;
virtual void Layout() OVERRIDE;
@@ -230,7 +229,7 @@ class ProfileItemView : public views::CustomButton,
virtual void OnHighlightStateChanged() OVERRIDE;
virtual void OnFocusStateChanged(bool has_focus) OVERRIDE;
- const AvatarMenu::Item& item() const { return item_; }
+ const AvatarMenuModel::Item& item() const { return item_; }
EditProfileLink* edit_link() { return edit_link_; }
private:
@@ -238,9 +237,8 @@ class ProfileItemView : public views::CustomButton,
bool IsHighlighted();
- AvatarMenu::Item item_;
+ AvatarMenuModel::Item item_;
AvatarMenuBubbleView* parent_;
- AvatarMenu* menu_;
views::ImageView* image_view_;
views::Label* name_label_;
views::Label* sync_state_label_;
@@ -249,13 +247,11 @@ class ProfileItemView : public views::CustomButton,
DISALLOW_COPY_AND_ASSIGN(ProfileItemView);
};
-ProfileItemView::ProfileItemView(const AvatarMenu::Item& item,
- AvatarMenuBubbleView* parent,
- AvatarMenu* menu)
+ProfileItemView::ProfileItemView(const AvatarMenuModel::Item& item,
+ AvatarMenuBubbleView* parent)
: views::CustomButton(parent),
item_(item),
- parent_(parent),
- menu_(menu) {
+ parent_(parent) {
set_notify_enter_exit_on_child(true);
image_view_ = new ProfileImageView();
@@ -369,8 +365,7 @@ void ProfileItemView::OnHighlightStateChanged() {
sync_state_label_->SetBackgroundColor(color);
edit_link_->SetBackgroundColor(color);
- bool show_edit = IsHighlighted() && item_.active &&
- menu_->ShouldShowEditProfileLink();
+ bool show_edit = IsHighlighted() && item_.active;
sync_state_label_->SetVisible(!show_edit);
edit_link_->SetVisible(show_edit);
SchedulePaint();
@@ -523,11 +518,9 @@ AvatarMenuBubbleView::AvatarMenuBubbleView(
managed_user_info_(NULL),
separator_switch_users_(NULL),
expanded_(false) {
- avatar_menu_.reset(new AvatarMenu(
+ avatar_menu_model_.reset(new AvatarMenuModel(
&g_browser_process->profile_manager()->GetProfileInfoCache(),
- this,
- browser_));
- avatar_menu_->RebuildMenu();
+ this, browser_));
}
AvatarMenuBubbleView::~AvatarMenuBubbleView() {
@@ -658,7 +651,7 @@ void AvatarMenuBubbleView::ButtonPressed(views::Button* sender,
chrome::ShowSettingsSubPage(browser_, subpage);
return;
} else if (sender->tag() == IDS_PROFILES_PROFILE_SIGNOUT_BUTTON) {
- avatar_menu_->BeginSignOut();
+ avatar_menu_model_->BeginSignOut();
return;
}
@@ -667,7 +660,7 @@ void AvatarMenuBubbleView::ButtonPressed(views::Button* sender,
if (sender == item_view) {
// Clicking on the active profile shouldn't do anything.
if (!item_view->item().active) {
- avatar_menu_->SwitchToProfile(
+ avatar_menu_model_->SwitchToProfile(
i, ui::DispositionFromEventFlags(event.flags()) == NEW_WINDOW);
}
break;
@@ -677,19 +670,19 @@ void AvatarMenuBubbleView::ButtonPressed(views::Button* sender,
void AvatarMenuBubbleView::LinkClicked(views::Link* source, int event_flags) {
if (source == buttons_view_) {
- avatar_menu_->AddNewProfile(ProfileMetrics::ADD_NEW_USER_ICON);
+ avatar_menu_model_->AddNewProfile(ProfileMetrics::ADD_NEW_USER_ICON);
return;
}
if (source == switch_profile_link_) {
expanded_ = true;
- OnAvatarMenuChanged(avatar_menu_.get());
+ OnAvatarMenuModelChanged(avatar_menu_model_.get());
return;
}
for (size_t i = 0; i < item_views_.size(); ++i) {
ProfileItemView* item_view = item_views_[i];
if (source == item_view->edit_link()) {
- avatar_menu_->EditProfile(i);
+ avatar_menu_model_->EditProfile(i);
return;
}
}
@@ -701,7 +694,7 @@ gfx::Rect AvatarMenuBubbleView::GetAnchorRect() {
void AvatarMenuBubbleView::Init() {
// Build the menu for the first time.
- OnAvatarMenuChanged(avatar_menu_.get());
+ OnAvatarMenuModelChanged(avatar_menu_model_.get());
AddAccelerator(ui::Accelerator(ui::VKEY_DOWN, ui::EF_NONE));
AddAccelerator(ui::Accelerator(ui::VKEY_UP, ui::EF_NONE));
}
@@ -712,12 +705,10 @@ void AvatarMenuBubbleView::WindowClosing() {
}
void AvatarMenuBubbleView::InitMenuContents(
- AvatarMenu* avatar_menu) {
- for (size_t i = 0; i < avatar_menu->GetNumberOfItems(); ++i) {
- const AvatarMenu::Item& item = avatar_menu->GetItemAt(i);
- ProfileItemView* item_view = new ProfileItemView(item,
- this,
- avatar_menu_.get());
+ AvatarMenuModel* avatar_menu_model) {
+ for (size_t i = 0; i < avatar_menu_model->GetNumberOfItems(); ++i) {
+ const AvatarMenuModel::Item& item = avatar_menu_model->GetItemAt(i);
+ ProfileItemView* item_view = new ProfileItemView(item, this);
item_view->SetAccessibleName(l10n_util::GetStringFUTF16(
IDS_PROFILES_SWITCH_TO_PROFILE_ACCESSIBLE_NAME, item.name));
item_view->set_focusable(true);
@@ -731,7 +722,7 @@ void AvatarMenuBubbleView::InitMenuContents(
AddChildView(separator_);
buttons_view_ = new ActionButtonView(this, browser_->profile());
AddChildView(buttons_view_);
- } else if (avatar_menu_->ShouldShowAddNewProfileLink()) {
+ } else if (avatar_menu_model_->ShouldShowAddNewProfileLink()) {
views::Link* add_profile_link = new views::Link(
l10n_util::GetStringUTF16(IDS_PROFILES_CREATE_NEW_PROFILE_LINK));
add_profile_link->set_listener(this);
@@ -745,14 +736,12 @@ void AvatarMenuBubbleView::InitMenuContents(
}
void AvatarMenuBubbleView::InitManagedUserContents(
- AvatarMenu* avatar_menu) {
+ AvatarMenuModel* avatar_menu_model) {
// Show the profile of the managed user.
- size_t active_index = avatar_menu->GetActiveProfileIndex();
- const AvatarMenu::Item& item =
- avatar_menu->GetItemAt(active_index);
- ProfileItemView* item_view = new ProfileItemView(item,
- this,
- avatar_menu_.get());
+ size_t active_index = avatar_menu_model->GetActiveProfileIndex();
+ const AvatarMenuModel::Item& item =
+ avatar_menu_model->GetItemAt(active_index);
+ ProfileItemView* item_view = new ProfileItemView(item, this);
item_view->SetAccessibleName(l10n_util::GetStringFUTF16(
IDS_PROFILES_SWITCH_TO_PROFILE_ACCESSIBLE_NAME, item.name));
item_views_.push_back(item_view);
@@ -762,7 +751,7 @@ void AvatarMenuBubbleView::InitManagedUserContents(
// Add information about managed users.
managed_user_info_ =
- new views::Label(avatar_menu_->GetManagedUserInformation(),
+ new views::Label(avatar_menu_model_->GetManagedUserInformation(),
ui::ResourceBundle::GetSharedInstance().GetFont(
ui::ResourceBundle::SmallFont));
managed_user_info_->SetMultiLine(true);
@@ -772,7 +761,7 @@ void AvatarMenuBubbleView::InitManagedUserContents(
// Add the managed user icon.
icon_view_ = new views::ImageView();
- icon_view_->SetImage(avatar_menu_->GetManagedUserIcon().ToImageSkia());
+ icon_view_->SetImage(avatar_menu_model_->GetManagedUserIcon().ToImageSkia());
AddChildView(icon_view_);
// Add a link for switching profiles.
@@ -786,8 +775,8 @@ void AvatarMenuBubbleView::InitManagedUserContents(
AddChildView(switch_profile_link_);
}
-void AvatarMenuBubbleView::OnAvatarMenuChanged(
- AvatarMenu* avatar_menu) {
+void AvatarMenuBubbleView::OnAvatarMenuModelChanged(
+ AvatarMenuModel* avatar_menu_model) {
// Unset all our child view references and call RemoveAllChildViews() which
// will actually delete them.
buttons_view_ = NULL;
@@ -795,10 +784,10 @@ void AvatarMenuBubbleView::OnAvatarMenuChanged(
item_views_.clear();
RemoveAllChildViews(true);
- if (avatar_menu_->GetManagedUserInformation().empty() || expanded_)
- InitMenuContents(avatar_menu);
+ if (avatar_menu_model_->GetManagedUserInformation().empty() || expanded_)
+ InitMenuContents(avatar_menu_model);
else
- InitManagedUserContents(avatar_menu);
+ InitManagedUserContents(avatar_menu_model);
// If the bubble has already been shown then resize and reposition the bubble.
Layout();
diff --git a/chrome/browser/ui/views/avatar_menu_bubble_view.h b/chrome/browser/ui/views/avatar_menu_bubble_view.h
index 781e6be..39d4f6f 100644
--- a/chrome/browser/ui/views/avatar_menu_bubble_view.h
+++ b/chrome/browser/ui/views/avatar_menu_bubble_view.h
@@ -10,12 +10,12 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
-#include "chrome/browser/profiles/avatar_menu_observer.h"
+#include "chrome/browser/profiles/avatar_menu_model_observer.h"
#include "ui/views/bubble/bubble_delegate.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/link_listener.h"
-class AvatarMenu;
+class AvatarMenuModel;
class Browser;
class ProfileItemView;
@@ -36,7 +36,7 @@ class Separator;
class AvatarMenuBubbleView : public views::BubbleDelegateView,
public views::ButtonListener,
public views::LinkListener,
- public AvatarMenuObserver {
+ public AvatarMenuModelObserver {
public:
// Helper function to show the bubble and ensure that it doesn't reshow.
// Normally this bubble is shown when there's a mouse down event on a button.
@@ -75,9 +75,9 @@ class AvatarMenuBubbleView : public views::BubbleDelegateView,
virtual void Init() OVERRIDE;
virtual void WindowClosing() OVERRIDE;
- // AvatarMenuObserver implementation.
- virtual void OnAvatarMenuChanged(
- AvatarMenu* avatar_menu) OVERRIDE;
+ // AvatarMenuModelObserver implementation.
+ virtual void OnAvatarMenuModelChanged(
+ AvatarMenuModel* avatar_menu_model) OVERRIDE;
// We normally close the bubble any time it becomes inactive but this can lead
// to flaky tests where unexpected UI events are triggering this behavior.
@@ -98,12 +98,12 @@ class AvatarMenuBubbleView : public views::BubbleDelegateView,
void SetBackgroundColors();
// Create the menu contents for a normal profile.
- void InitMenuContents(AvatarMenu* avatar_menu);
+ void InitMenuContents(AvatarMenuModel* avatar_menu_model);
// Create the managed user specific contents of the menu.
- void InitManagedUserContents(AvatarMenu* avatar_menu);
+ void InitManagedUserContents(AvatarMenuModel* avatar_menu_model);
- scoped_ptr<AvatarMenu> avatar_menu_;
+ scoped_ptr<AvatarMenuModel> avatar_menu_model_;
gfx::Rect anchor_rect_;
Browser* browser_;
std::vector<ProfileItemView*> item_views_;
@@ -112,13 +112,13 @@ class AvatarMenuBubbleView : public views::BubbleDelegateView,
views::Separator* separator_;
// This will be non-NULL if and only if
- // avatar_menu_->ShouldShowAddNewProfileLink() returns true. See
- // OnAvatarMenuChanged().
+ // avatar_menu_model_->ShouldShowAddNewProfileLink() returns true. See
+ // OnAvatarMenuModelChanged().
views::View* buttons_view_;
// This will be non-NULL if and only if |expanded_| is false and
- // avatar_menu_->GetManagedUserInformation() returns a non-empty string.
- // See OnAvatarMenuChanged().
+ // avatar_menu_model_->GetManagedUserInformation() returns a non-empty string.
+ // See OnAvatarMenuModelChanged().
views::Label* managed_user_info_;
views::ImageView* icon_view_;
views::Separator* separator_switch_users_;
diff --git a/chrome/browser/ui/views/avatar_menu_button.cc b/chrome/browser/ui/views/avatar_menu_button.cc
index 4eceb9e4..5cdb78f 100644
--- a/chrome/browser/ui/views/avatar_menu_button.cc
+++ b/chrome/browser/ui/views/avatar_menu_button.cc
@@ -8,7 +8,7 @@
#include "base/prefs/pref_service.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
-#include "chrome/browser/profiles/avatar_menu.h"
+#include "chrome/browser/profiles/avatar_menu_model.h"
#include "chrome/browser/profiles/profile_info_util.h"
#include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/browser/profiles/profiles_state.h"
diff --git a/chrome/browser/ui/views/avatar_menu_button_browsertest.cc b/chrome/browser/ui/views/avatar_menu_button_browsertest.cc
index a3c0125..757108d 100644
--- a/chrome/browser/ui/views/avatar_menu_button_browsertest.cc
+++ b/chrome/browser/ui/views/avatar_menu_button_browsertest.cc
@@ -8,7 +8,7 @@
#include "base/path_service.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/chrome_notification_types.h"
-#include "chrome/browser/profiles/avatar_menu.h"
+#include "chrome/browser/profiles/avatar_menu_model.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profiles_state.h"
#include "chrome/browser/ui/browser_list.h"
@@ -150,21 +150,21 @@ IN_PROC_BROWSER_TEST_P(AvatarMenuButtonTest, NewSignOut) {
chrome::NOTIFICATION_BROWSER_CLOSED,
content::Source<Browser>(browser()));
- AvatarMenu* menu =
- ProfileChooserView::profile_bubble_->avatar_menu_.get();
- const AvatarMenu::Item& menu_item_before =
- menu->GetItemAt(menu->GetActiveProfileIndex());
- EXPECT_FALSE(menu_item_before.signin_required);
+ AvatarMenuModel* model =
+ ProfileChooserView::profile_bubble_->avatar_menu_model_.get();
+ const AvatarMenuModel::Item& model_item_before =
+ model->GetItemAt(model->GetActiveProfileIndex());
+ EXPECT_FALSE(model_item_before.signin_required);
ui::MouseEvent mouse_ev(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), 0);
- menu->SetLogoutURL("about:blank");
+ model->SetLogoutURL("about:blank");
ProfileChooserView::profile_bubble_->LinkClicked(
static_cast<views::Link*>(
ProfileChooserView::profile_bubble_->signout_current_profile_link_),
0);
- EXPECT_TRUE(menu->GetItemAt(menu->GetActiveProfileIndex()).signin_required);
+ EXPECT_TRUE(model->GetItemAt(model->GetActiveProfileIndex()).signin_required);
window_close_observer.Wait(); // Rely on test timeout for failure indication.
EXPECT_TRUE(browser_list->empty());
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc
index d7a1ad9..ef8c258 100644
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc
@@ -5,7 +5,7 @@
#include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/profiles/avatar_menu.h"
+#include "chrome/browser/profiles/avatar_menu_model.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_manager.h"
@@ -86,7 +86,7 @@ void BrowserNonClientFrameView::UpdateAvatarInfo() {
avatar = rb.GetImageNamed(browser_view_->GetGuestIconResourceID());
} else if (browser_view_->IsOffTheRecord()) {
avatar = rb.GetImageNamed(browser_view_->GetOTRIconResourceID());
- } else if (AvatarMenu::ShouldShowAvatarMenu()) {
+ } else if (AvatarMenuModel::ShouldShowAvatarMenu()) {
ProfileInfoCache& cache =
g_browser_process->profile_manager()->GetProfileInfoCache();
Profile* profile = browser_view_->browser()->profile();
@@ -109,5 +109,5 @@ void BrowserNonClientFrameView::UpdateAvatarInfo() {
// need to draw the taskbar decoration.
chrome::DrawTaskbarDecoration(
frame_->GetNativeWindow(),
- AvatarMenu::ShouldShowAvatarMenu() ? &avatar : NULL);
+ AvatarMenuModel::ShouldShowAvatarMenu() ? &avatar : NULL);
}
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
index 58d24c7..3c48696 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -24,7 +24,7 @@
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/native_window_notification_source.h"
#include "chrome/browser/password_manager/password_manager.h"
-#include "chrome/browser/profiles/avatar_menu.h"
+#include "chrome/browser/profiles/avatar_menu_model.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_manager.h"
@@ -591,7 +591,7 @@ bool BrowserView::ShouldShowAvatar() const {
return false;
}
- return AvatarMenu::ShouldShowAvatarMenu();
+ return AvatarMenuModel::ShouldShowAvatarMenu();
}
bool BrowserView::GetAccelerator(int cmd_id, ui::Accelerator* accelerator) {
diff --git a/chrome/browser/ui/views/profile_chooser_view.cc b/chrome/browser/ui/views/profile_chooser_view.cc
index 6998c5e..64e81ca 100644
--- a/chrome/browser/ui/views/profile_chooser_view.cc
+++ b/chrome/browser/ui/views/profile_chooser_view.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/ui/views/profile_chooser_view.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/profiles/avatar_menu_model.h"
#include "chrome/browser/profiles/profile_info_util.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_window.h"
@@ -30,6 +31,7 @@
#include "ui/views/layout/layout_constants.h"
#include "ui/views/widget/widget.h"
+
// Helpers --------------------------------------------------------------------
namespace {
@@ -135,12 +137,9 @@ ProfileChooserView::ProfileChooserView(views::View* anchor_view,
set_margins(gfx::Insets());
ResetLinksAndButtons();
-
- avatar_menu_.reset(new AvatarMenu(
+ avatar_menu_model_.reset(new AvatarMenuModel(
&g_browser_process->profile_manager()->GetProfileInfoCache(),
- this,
- browser_));
- avatar_menu_->RebuildMenu();
+ this, browser_));
}
ProfileChooserView::~ProfileChooserView() {
@@ -158,24 +157,24 @@ void ProfileChooserView::ResetLinksAndButtons() {
}
void ProfileChooserView::Init() {
- ShowView(PROFILE_CHOOSER_VIEW, avatar_menu_.get());
+ ShowView(PROFILE_CHOOSER_VIEW, avatar_menu_model_.get());
}
-void ProfileChooserView::OnAvatarMenuChanged(
- AvatarMenu* avatar_menu) {
- // Refresh the view with the new menu. We can't just update the local copy
+void ProfileChooserView::OnAvatarMenuModelChanged(
+ AvatarMenuModel* avatar_menu_model) {
+ // Refresh the view with the new model. We can't just update the local copy
// as this may have been triggered by a sign out action, in which case
// the view is being destroyed.
- ShowView(PROFILE_CHOOSER_VIEW, avatar_menu);
+ ShowView(PROFILE_CHOOSER_VIEW, avatar_menu_model);
}
void ProfileChooserView::ShowView(BubbleViewMode view_to_display,
- AvatarMenu* avatar_menu) {
+ AvatarMenuModel* avatar_menu_model) {
// The account management view should only be displayed if the active profile
// is signed in.
if (view_to_display == ACCOUNT_MANAGEMENT_VIEW) {
- const AvatarMenu::Item& active_item = avatar_menu->GetItemAt(
- avatar_menu->GetActiveProfileIndex());
+ const AvatarMenuModel::Item& active_item = avatar_menu_model->GetItemAt(
+ avatar_menu_model->GetActiveProfileIndex());
DCHECK(active_item.signed_in);
}
@@ -190,8 +189,8 @@ void ProfileChooserView::ShowView(BubbleViewMode view_to_display,
bool is_guest_view = true;
views::View* current_profile_view = NULL;
views::View* current_profile_accounts = NULL;
- for (size_t i = 0; i < avatar_menu->GetNumberOfItems(); ++i) {
- const AvatarMenu::Item& item = avatar_menu->GetItemAt(i);
+ for (size_t i = 0; i < avatar_menu_model->GetNumberOfItems(); ++i) {
+ const AvatarMenuModel::Item& item = avatar_menu_model->GetItemAt(i);
if (item.active) {
if (view_to_display == PROFILE_CHOOSER_VIEW) {
current_profile_view = CreateCurrentProfileView(item, false);
@@ -247,7 +246,7 @@ void ProfileChooserView::ButtonPressed(views::Button* sender,
sender->SetEnabled(false);
if (sender == guest_button_) {
- avatar_menu_->SwitchToGuestProfileWindow(browser_);
+ avatar_menu_model_->SwitchToGuestProfileWindow(browser_);
} else if (sender == end_guest_button_) {
profiles::CloseGuestProfileWindows();
} else if (sender == users_button_) {
@@ -257,7 +256,7 @@ void ProfileChooserView::ButtonPressed(views::Button* sender,
ButtonIndexes::const_iterator match =
open_other_profile_indexes_map_.find(sender);
DCHECK(match != open_other_profile_indexes_map_.end());
- avatar_menu_->SwitchToProfile(
+ avatar_menu_model_->SwitchToProfile(
match->second,
ui::DispositionFromEventFlags(event.flags()) == NEW_WINDOW);
}
@@ -266,22 +265,22 @@ void ProfileChooserView::ButtonPressed(views::Button* sender,
void ProfileChooserView::LinkClicked(views::Link* sender, int event_flags) {
if (sender == manage_accounts_link_) {
// ShowView() will DCHECK if this view is displayed for non signed-in users.
- ShowView(ACCOUNT_MANAGEMENT_VIEW, avatar_menu_.get());
+ ShowView(ACCOUNT_MANAGEMENT_VIEW, avatar_menu_model_.get());
SizeToContents(); // The account list changes the height of the bubble.
} else if (sender == signout_current_profile_link_) {
- avatar_menu_->BeginSignOut();
+ avatar_menu_model_->BeginSignOut();
} else if (sender == signin_current_profile_link_) {
GURL page = signin::GetPromoURL(signin::SOURCE_MENU, false);
chrome::ShowSingletonTab(browser_, page);
} else {
DCHECK(sender == change_photo_link_);
- avatar_menu_->EditProfile(
- avatar_menu_->GetActiveProfileIndex());
+ avatar_menu_model_->EditProfile(
+ avatar_menu_model_->GetActiveProfileIndex());
}
}
views::View* ProfileChooserView::CreateCurrentProfileView(
- const AvatarMenu::Item& avatar_item,
+ const AvatarMenuModel::Item& avatar_item,
bool is_guest) {
views::View* view = new views::View();
views::GridLayout* layout = CreateDoubleColumnLayout(view);
@@ -338,7 +337,7 @@ views::View* ProfileChooserView::CreateCurrentProfileView(
}
views::View* ProfileChooserView::CreateCurrentProfileEditableView(
- const AvatarMenu::Item& avatar_item) {
+ const AvatarMenuModel::Item& avatar_item) {
DCHECK(avatar_item.signed_in);
views::View* view = new views::View();
views::GridLayout* layout = CreateDoubleColumnLayout(view);
@@ -378,7 +377,7 @@ views::View* ProfileChooserView::CreateCurrentProfileEditableView(
views::View* ProfileChooserView::CreateGuestProfileView() {
gfx::Image guest_icon =
ui::ResourceBundle::GetSharedInstance().GetImageNamed(IDR_GUEST_ICON);
- AvatarMenu::Item guest_avatar_item(0, 0, guest_icon);
+ AvatarMenuModel::Item guest_avatar_item(0, guest_icon);
guest_avatar_item.active = true;
guest_avatar_item.name = l10n_util::GetStringUTF16(
IDS_PROFILES_GUEST_PROFILE_NAME);
@@ -400,7 +399,7 @@ views::View* ProfileChooserView::CreateOtherProfilesView(
iter != avatars_to_show.end();
++iter) {
const size_t index = *iter;
- const AvatarMenu::Item& item = avatar_menu_->GetItemAt(index);
+ const AvatarMenuModel::Item& item = avatar_menu_model_->GetItemAt(index);
gfx::Image image = profiles::GetSizedAvatarIconWithBorder(
item.icon, true,
@@ -461,7 +460,7 @@ views::View* ProfileChooserView::CreateOptionsView(bool is_guest_view) {
}
views::View* ProfileChooserView::CreateCurrentProfileAccountsView(
- const AvatarMenu::Item& avatar_item) {
+ const AvatarMenuModel::Item& avatar_item) {
DCHECK(avatar_item.signed_in);
views::View* view = new views::View();
views::GridLayout* layout = CreateSingleColumnLayout(view);
diff --git a/chrome/browser/ui/views/profile_chooser_view.h b/chrome/browser/ui/views/profile_chooser_view.h
index 091dcb4..a1d99d2 100644
--- a/chrome/browser/ui/views/profile_chooser_view.h
+++ b/chrome/browser/ui/views/profile_chooser_view.h
@@ -8,8 +8,8 @@
#include <map>
#include <vector>
-#include "chrome/browser/profiles/avatar_menu.h"
-#include "chrome/browser/profiles/avatar_menu_observer.h"
+#include "chrome/browser/profiles/avatar_menu_model.h"
+#include "chrome/browser/profiles/avatar_menu_model_observer.h"
#include "ui/views/bubble/bubble_delegate.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/link_listener.h"
@@ -32,7 +32,7 @@ class ProfileItemView;
class ProfileChooserView : public views::BubbleDelegateView,
public views::ButtonListener,
public views::LinkListener,
- public AvatarMenuObserver {
+ public AvatarMenuModelObserver {
public:
// Shows the bubble if one is not already showing. This allows us to easily
// make a button toggle the bubble on and off when clicked: we unconditionally
@@ -63,7 +63,7 @@ class ProfileChooserView : public views::BubbleDelegateView,
typedef std::map<views::Button*, int> ButtonIndexes;
// Different views that can be displayed in the bubble.
- enum BubbleViewMode {
+ enum BubbleViewMode{
PROFILE_CHOOSER_VIEW, // Displays a "fast profile switcher" view.
ACCOUNT_MANAGEMENT_VIEW // Displays a list of accounts for the active user.
};
@@ -85,9 +85,9 @@ class ProfileChooserView : public views::BubbleDelegateView,
// LinkListener:
virtual void LinkClicked(views::Link* sender, int event_flags) OVERRIDE;
- // AvatarMenuObserver:
- virtual void OnAvatarMenuChanged(
- AvatarMenu* avatar_menu) OVERRIDE;
+ // AvatarMenuModelObserver:
+ virtual void OnAvatarMenuModelChanged(
+ AvatarMenuModel* avatar_menu_model) OVERRIDE;
static ProfileChooserView* profile_bubble_;
static bool close_on_deactivate_;
@@ -96,13 +96,13 @@ class ProfileChooserView : public views::BubbleDelegateView,
// Shows either the profile chooser or the account management views.
void ShowView(BubbleViewMode view_to_display,
- AvatarMenu* avatar_menu);
+ AvatarMenuModel* avatar_menu_model);
// Creates the main profile card for the profile |avatar_item|. |is_guest|
// is used to determine whether to show any Sign in/Sign out/Manage accounts
// links.
views::View* CreateCurrentProfileView(
- const AvatarMenu::Item& avatar_item,
+ const AvatarMenuModel::Item& avatar_item,
bool is_guest);
views::View* CreateGuestProfileView();
views::View* CreateOtherProfilesView(const Indexes& avatars_to_show);
@@ -110,11 +110,11 @@ class ProfileChooserView : public views::BubbleDelegateView,
// Account Management view for the profile |avatar_item|.
views::View* CreateCurrentProfileEditableView(
- const AvatarMenu::Item& avatar_item);
+ const AvatarMenuModel::Item& avatar_item);
views::View* CreateCurrentProfileAccountsView(
- const AvatarMenu::Item& avatar_item);
+ const AvatarMenuModel::Item& avatar_item);
- scoped_ptr<AvatarMenu> avatar_menu_;
+ scoped_ptr<AvatarMenuModel> avatar_menu_model_;
Browser* browser_;
// Other profiles used in the "fast profile switcher" view.
diff --git a/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc b/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc
index 308d0fc..5460bdb 100644
--- a/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc
+++ b/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc
@@ -8,7 +8,7 @@
#include "base/value_conversions.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/profiles/avatar_menu.h"
+#include "chrome/browser/profiles/avatar_menu_model.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_info_cache_observer.h"
@@ -211,7 +211,7 @@ void UserManagerScreenHandler::HandleRemoveUser(const base::ListValue* args) {
void UserManagerScreenHandler::HandleLaunchGuest(const base::ListValue* args) {
Browser* browser = chrome::FindOrCreateTabbedBrowser(
ProfileManager::GetLastUsedProfileAllowedByPolicy(), desktop_type_);
- AvatarMenu::SwitchToGuestProfileWindow(browser);
+ AvatarMenuModel::SwitchToGuestProfileWindow(browser);
}
void UserManagerScreenHandler::HandleLaunchUser(const base::ListValue* args) {