| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_COCOA_PROFILES_PROFILE_CHOOSER_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_PROFILES_PROFILE_CHOOSER_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_PROFILES_PROFILE_CHOOSER_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_PROFILES_PROFILE_CHOOSER_CONTROLLER_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 |
| 9 #include <map> | 10 #include <map> |
| 11 #include <memory> |
| 10 #include <string> | 12 #include <string> |
| 11 | 13 |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "chrome/browser/profiles/profile_metrics.h" | 14 #include "chrome/browser/profiles/profile_metrics.h" |
| 14 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" | 15 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" |
| 15 #include "chrome/browser/ui/profile_chooser_constants.h" | 16 #include "chrome/browser/ui/profile_chooser_constants.h" |
| 16 #include "components/signin/core/browser/signin_header_helper.h" | 17 #include "components/signin/core/browser/signin_header_helper.h" |
| 17 | 18 |
| 18 class AvatarMenu; | 19 class AvatarMenu; |
| 19 class ActiveProfileObserverBridge; | 20 class ActiveProfileObserverBridge; |
| 20 class Browser; | 21 class Browser; |
| 21 class ProfileOAuth2TokenService; | 22 class ProfileOAuth2TokenService; |
| 22 | 23 |
| 23 namespace content { | 24 namespace content { |
| 24 class WebContents; | 25 class WebContents; |
| 25 } | 26 } |
| 26 | 27 |
| 27 namespace signin_metrics { | 28 namespace signin_metrics { |
| 28 enum class AccessPoint; | 29 enum class AccessPoint; |
| 29 } | 30 } |
| 30 | 31 |
| 31 class GaiaWebContentsDelegate; | 32 class GaiaWebContentsDelegate; |
| 32 | 33 |
| 33 // This window controller manages the bubble that displays a "menu" of profiles. | 34 // This window controller manages the bubble that displays a "menu" of profiles. |
| 34 // It is brought open by clicking on the avatar icon in the window frame. | 35 // It is brought open by clicking on the avatar icon in the window frame. |
| 35 @interface ProfileChooserController : BaseBubbleController<NSTextViewDelegate> { | 36 @interface ProfileChooserController : BaseBubbleController<NSTextViewDelegate> { |
| 36 @private | 37 @private |
| 37 // The menu that contains the data from the backend. | 38 // The menu that contains the data from the backend. |
| 38 scoped_ptr<AvatarMenu> avatarMenu_; | 39 std::unique_ptr<AvatarMenu> avatarMenu_; |
| 39 | 40 |
| 40 // An observer to be notified when the OAuth2 tokens change or the avatar | 41 // An observer to be notified when the OAuth2 tokens change or the avatar |
| 41 // menu model updates for the active profile. | 42 // menu model updates for the active profile. |
| 42 scoped_ptr<ActiveProfileObserverBridge> observer_; | 43 std::unique_ptr<ActiveProfileObserverBridge> observer_; |
| 43 | 44 |
| 44 // The browser that launched the bubble. Not owned. | 45 // The browser that launched the bubble. Not owned. |
| 45 Browser* browser_; | 46 Browser* browser_; |
| 46 | 47 |
| 47 // The id for the account that the user has requested to remove from the | 48 // The id for the account that the user has requested to remove from the |
| 48 // current profile. It is set in |showAccountRemovalView| and used in | 49 // current profile. It is set in |showAccountRemovalView| and used in |
| 49 // |removeAccount|. | 50 // |removeAccount|. |
| 50 std::string accountIdToRemove_; | 51 std::string accountIdToRemove_; |
| 51 | 52 |
| 52 // Active view mode. | 53 // Active view mode. |
| 53 profiles::BubbleViewMode viewMode_; | 54 profiles::BubbleViewMode viewMode_; |
| 54 | 55 |
| 55 // The current tutorial mode. | 56 // The current tutorial mode. |
| 56 profiles::TutorialMode tutorialMode_; | 57 profiles::TutorialMode tutorialMode_; |
| 57 | 58 |
| 58 // List of the full, un-elided accounts for the active profile. The keys are | 59 // List of the full, un-elided accounts for the active profile. The keys are |
| 59 // generated used to tag the UI buttons, and the values are the original | 60 // generated used to tag the UI buttons, and the values are the original |
| 60 // emails displayed by the buttons. | 61 // emails displayed by the buttons. |
| 61 std::map<int, std::string> currentProfileAccounts_; | 62 std::map<int, std::string> currentProfileAccounts_; |
| 62 | 63 |
| 63 // Web contents used by the inline signin view. | 64 // Web contents used by the inline signin view. |
| 64 scoped_ptr<content::WebContents> webContents_; | 65 std::unique_ptr<content::WebContents> webContents_; |
| 65 scoped_ptr<GaiaWebContentsDelegate> webContentsDelegate_; | 66 std::unique_ptr<GaiaWebContentsDelegate> webContentsDelegate_; |
| 66 | 67 |
| 67 // Whether the bubble is displayed for an active guest profile. | 68 // Whether the bubble is displayed for an active guest profile. |
| 68 BOOL isGuestSession_; | 69 BOOL isGuestSession_; |
| 69 | 70 |
| 70 // The GAIA service type that caused this menu to open. | 71 // The GAIA service type that caused this menu to open. |
| 71 signin::GAIAServiceType serviceType_; | 72 signin::GAIAServiceType serviceType_; |
| 72 | 73 |
| 73 // The current access point of sign in. | 74 // The current access point of sign in. |
| 74 signin_metrics::AccessPoint accessPoint_; | 75 signin_metrics::AccessPoint accessPoint_; |
| 75 } | 76 } |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 @interface ProfileChooserController (ExposedForTesting) | 138 @interface ProfileChooserController (ExposedForTesting) |
| 138 - (id)initWithBrowser:(Browser*)browser | 139 - (id)initWithBrowser:(Browser*)browser |
| 139 anchoredAt:(NSPoint)point | 140 anchoredAt:(NSPoint)point |
| 140 viewMode:(profiles::BubbleViewMode)viewMode | 141 viewMode:(profiles::BubbleViewMode)viewMode |
| 141 tutorialMode:(profiles::TutorialMode)tutorialMode | 142 tutorialMode:(profiles::TutorialMode)tutorialMode |
| 142 serviceType:(signin::GAIAServiceType)GAIAServiceType; | 143 serviceType:(signin::GAIAServiceType)GAIAServiceType; |
| 143 - (IBAction)dismissTutorial:(id)sender; | 144 - (IBAction)dismissTutorial:(id)sender; |
| 144 @end | 145 @end |
| 145 | 146 |
| 146 #endif // CHROME_BROWSER_UI_COCOA_PROFILES_PROFILE_CHOOSER_CONTROLLER_H_ | 147 #endif // CHROME_BROWSER_UI_COCOA_PROFILES_PROFILE_CHOOSER_CONTROLLER_H_ |
| OLD | NEW |