1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_COCOA_PROFILES_PROFILE_MENU_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_PROFILES_PROFILE_MENU_CONTROLLER_H_
8 #import <Cocoa/Cocoa.h>
10 #include "base/memory/scoped_ptr.h"
15 namespace ProfileMenuControllerInternal
{
19 // This controller manages the title and submenu of the Profiles item in the
20 // system menu bar. It updates the contents of the menu and the menu's title
21 // whenever the active browser changes.
22 @interface ProfileMenuController
: NSObject
{
24 // The controller for the profile submenu.
25 scoped_ptr
<AvatarMenu
> menu_
;
27 // An observer to be notified when the active browser changes and when the
28 // menu model changes.
29 scoped_ptr
<ProfileMenuControllerInternal::Observer
> observer_
;
31 // The main menu item to which the profile menu is attached.
32 __weak NSMenuItem
* mainMenuItem_
;
35 // Designated initializer.
36 - (id
)initWithMainMenuItem
:(NSMenuItem
*)item
;
38 // Actions for the menu items.
39 - (IBAction
)switchToProfileFromMenu
:(id
)sender
;
40 - (IBAction
)switchToProfileFromDock
:(id
)sender
;
41 - (IBAction
)editProfile
:(id
)sender
;
42 - (IBAction
)newProfile
:(id
)sender
;
44 // If profiles are enabled and there is more than one profile, this inserts
45 // profile menu items into the specified menu at the specified offset and
46 // returns YES. Otherwise, this returns NO and does not modify the menu.
47 - (BOOL
)insertItemsIntoMenu
:(NSMenu
*)menu
48 atOffset
:(NSInteger
)offset
53 @interface
ProfileMenuController (PrivateExposedForTesting
)
56 - (NSMenuItem
*)createItemWithTitle
:(NSString
*)title action
:(SEL
)sel
;
57 - (void)activeBrowserChangedTo
:(Browser
*)browser
;
60 #endif // CHROME_BROWSER_UI_COCOA_PROFILES_PROFILE_MENU_CONTROLLER_H_