Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / profiles / profile_menu_controller.h
blob91d74be49b92d6b8d47306743ac135dc9913eb5f
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"
12 class AvatarMenu;
13 class Browser;
15 namespace ProfileMenuControllerInternal {
16 class Observer;
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 {
23 @private
24 // The controller for the profile submenu.
25 scoped_ptr<AvatarMenu> avatarMenu_;
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
49 fromDock:(BOOL)dock;
51 @end
53 @interface ProfileMenuController (PrivateExposedForTesting)
54 - (NSMenu*)menu;
55 - (void)rebuildMenu;
56 - (NSMenuItem*)createItemWithTitle:(NSString*)title action:(SEL)sel;
57 - (void)activeBrowserChangedTo:(Browser*)browser;
58 @end
60 #endif // CHROME_BROWSER_UI_COCOA_PROFILES_PROFILE_MENU_CONTROLLER_H_