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_AVATAR_BASE_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_PROFILES_AVATAR_BASE_CONTROLLER_H_
8 #import <AppKit/AppKit.h>
10 #import "base/mac/scoped_nsobject.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/ui/browser_window.h"
13 #import "chrome/browser/ui/cocoa/has_weak_browser_pointer.h"
14 #include "components/signin/core/browser/signin_header_helper.h"
16 @
class BaseBubbleController
;
18 class ProfileInfoUpdateObserver
;
20 // This view controller manages the button that sits in the top of the
21 // window frame when using multi-profiles, and shows information about the
22 // current profile. Clicking the button will open the profile menu.
23 @interface AvatarBaseController
: NSViewController
<HasWeakBrowserPointer
> {
27 // The avatar button. Child classes are responsible for implementing it.
28 base::scoped_nsobject
<NSButton
> button_
;
31 // The menu controller, if the menu is open.
32 BaseBubbleController
* menuController_
;
34 // Observer that listens for updates to the ProfileInfoCache.
35 scoped_ptr
<ProfileInfoUpdateObserver
> profileInfoObserver_
;
38 // The avatar button view.
39 @
property(readonly
, nonatomic
) NSButton
* buttonView
;
41 // Designated initializer.
42 - (id
)initWithBrowser
:(Browser
*)browser
;
44 // Shows the avatar bubble in the given mode.
45 - (void)showAvatarBubbleAnchoredAt
:(NSView
*)anchor
46 withMode
:(BrowserWindow::AvatarBubbleMode
)mode
47 withServiceType
:(signin::GAIAServiceType
)serviceType
;
51 @interface
AvatarBaseController (ExposedForTesting
)
52 - (BaseBubbleController
*)menuController
;
54 - (BOOL
)isCtrlPressed
;
57 #endif // CHROME_BROWSER_UI_COCOA_PROFILES_AVATAR_BASE_CONTROLLER_H_