Chromium Code Reviews| 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h" | 7 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h" |
| 8 | 8 |
| 9 #include "base/mac/bundle_locations.h" | 9 #include "base/mac/bundle_locations.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 271 DCHECK(oauth2_token_service); | 271 DCHECK(oauth2_token_service); |
| 272 oauth2_token_service->RemoveObserver(this); | 272 oauth2_token_service->RemoveObserver(this); |
| 273 token_observer_registered_ = false; | 273 token_observer_registered_ = false; |
| 274 } | 274 } |
| 275 | 275 |
| 276 // OAuth2TokenService::Observer: | 276 // OAuth2TokenService::Observer: |
| 277 virtual void OnRefreshTokenAvailable(const std::string& account_id) OVERRIDE { | 277 virtual void OnRefreshTokenAvailable(const std::string& account_id) OVERRIDE { |
| 278 // Tokens can only be added by adding an account through the inline flow, | 278 // Tokens can only be added by adding an account through the inline flow, |
| 279 // which is started from the account management view. Refresh it to show the | 279 // which is started from the account management view. Refresh it to show the |
| 280 // update. | 280 // update. |
| 281 BubbleViewMode viewMode = [controller_ viewMode]; | 281 profiles::BubbleViewMode viewMode = [controller_ viewMode]; |
| 282 if (viewMode == BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT || | 282 if (viewMode == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT || |
| 283 viewMode == BUBBLE_VIEW_MODE_GAIA_SIGNIN || | 283 viewMode == profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN || |
| 284 viewMode == BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT) { | 284 viewMode == profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT) { |
| 285 [controller_ | 285 [controller_ initMenuContentsWithView: |
| 286 initMenuContentsWithView:BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT]; | 286 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT]; |
| 287 } | 287 } |
| 288 } | 288 } |
| 289 | 289 |
| 290 virtual void OnRefreshTokenRevoked(const std::string& account_id) OVERRIDE { | 290 virtual void OnRefreshTokenRevoked(const std::string& account_id) OVERRIDE { |
| 291 // Tokens can only be removed from the account management view. Refresh it | 291 // Tokens can only be removed from the account management view. Refresh it |
| 292 // to show the update. | 292 // to show the update. |
| 293 if ([controller_ viewMode] == BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT) | 293 if ([controller_ viewMode] == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT) |
| 294 [controller_ | 294 [controller_ initMenuContentsWithView: |
| 295 initMenuContentsWithView:BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT]; | 295 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT]; |
| 296 } | 296 } |
| 297 | 297 |
| 298 // AvatarMenuObserver: | 298 // AvatarMenuObserver: |
| 299 virtual void OnAvatarMenuChanged(AvatarMenu* avatar_menu) OVERRIDE { | 299 virtual void OnAvatarMenuChanged(AvatarMenu* avatar_menu) OVERRIDE { |
| 300 // While the bubble is open, the avatar menu can only change from the | 300 // While the bubble is open, the avatar menu can only change from the |
| 301 // profile chooser view by modifying the current profile's photo or name. | 301 // profile chooser view by modifying the current profile's photo or name. |
| 302 [controller_ initMenuContentsWithView:BUBBLE_VIEW_MODE_PROFILE_CHOOSER]; | 302 [controller_ |
| 303 initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER]; | |
| 303 } | 304 } |
| 304 | 305 |
| 305 // content::NotificationObserver: | 306 // content::NotificationObserver: |
| 306 virtual void Observe( | 307 virtual void Observe( |
| 307 int type, | 308 int type, |
| 308 const content::NotificationSource& source, | 309 const content::NotificationSource& source, |
| 309 const content::NotificationDetails& details) OVERRIDE { | 310 const content::NotificationDetails& details) OVERRIDE { |
| 310 DCHECK_EQ(chrome::NOTIFICATION_BROWSER_CLOSING, type); | 311 DCHECK_EQ(chrome::NOTIFICATION_BROWSER_CLOSING, type); |
| 311 if (browser_ == content::Source<Browser>(source).ptr()) { | 312 if (browser_ == content::Source<Browser>(source).ptr()) { |
| 312 RemoveTokenServiceObserver(); | 313 RemoveTokenServiceObserver(); |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 656 | 657 |
| 657 @interface ProfileChooserController () | 658 @interface ProfileChooserController () |
| 658 // Builds the profile chooser view. | 659 // Builds the profile chooser view. |
| 659 - (NSView*)buildProfileChooserView; | 660 - (NSView*)buildProfileChooserView; |
| 660 | 661 |
| 661 // Builds a tutorial card with a title label using |titleMessageId|, a content | 662 // Builds a tutorial card with a title label using |titleMessageId|, a content |
| 662 // label using |contentMessageId|, and a bottom row with a right-aligned link | 663 // label using |contentMessageId|, and a bottom row with a right-aligned link |
| 663 // using |linkMessageId|, and a left aligned button using |buttonMessageId|. | 664 // using |linkMessageId|, and a left aligned button using |buttonMessageId|. |
| 664 // On click, the link would execute |linkAction|, and the button would execute | 665 // On click, the link would execute |linkAction|, and the button would execute |
| 665 // |buttonAction|. It sets |tutorialMode_| to the given |mode|. | 666 // |buttonAction|. It sets |tutorialMode_| to the given |mode|. |
| 666 - (NSView*)tutorialViewWithMode:(TutorialMode)mode | 667 - (NSView*)tutorialViewWithMode:(profiles::TutorialMode)mode |
| 667 titleMessage:(int)titleMessageId | 668 titleMessage:(int)titleMessageId |
| 668 contentMessage:(int)contentMessageId | 669 contentMessage:(int)contentMessageId |
| 669 linkMessage:(int)linkMessageId | 670 linkMessage:(int)linkMessageId |
| 670 buttonMessage:(int)buttonMessageId | 671 buttonMessage:(int)buttonMessageId |
| 671 linkAction:(SEL)linkAction | 672 linkAction:(SEL)linkAction |
| 672 buttonAction:(SEL)buttonAction; | 673 buttonAction:(SEL)buttonAction; |
| 673 | 674 |
| 674 // Builds a a tutorial card for new profile management preview if needed. if | 675 // Builds a a tutorial card for new profile management preview if needed. if |
| 675 // new profile management is not enabled yet, then it prompts the user to try | 676 // new profile management is not enabled yet, then it prompts the user to try |
| 676 // out the feature. Otherwise, it notifies the user that the feature has been | 677 // out the feature. Otherwise, it notifies the user that the feature has been |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 728 | 729 |
| 729 // Creates an email account button with |title| and a remove icon. |tag| | 730 // Creates an email account button with |title| and a remove icon. |tag| |
| 730 // indicates which account the button refers to. | 731 // indicates which account the button refers to. |
| 731 - (NSButton*)accountButtonWithRect:(NSRect)rect | 732 - (NSButton*)accountButtonWithRect:(NSRect)rect |
| 732 title:(const std::string&)title | 733 title:(const std::string&)title |
| 733 tag:(int)tag; | 734 tag:(int)tag; |
| 734 | 735 |
| 735 @end | 736 @end |
| 736 | 737 |
| 737 @implementation ProfileChooserController | 738 @implementation ProfileChooserController |
| 738 - (BubbleViewMode) viewMode { | 739 - (profiles::BubbleViewMode) viewMode { |
| 739 return viewMode_; | 740 return viewMode_; |
| 740 } | 741 } |
| 741 | 742 |
| 742 - (IBAction)switchToProfile:(id)sender { | 743 - (IBAction)switchToProfile:(id)sender { |
| 743 // Check the event flags to see if a new window should be created. | 744 // Check the event flags to see if a new window should be created. |
| 744 bool alwaysCreate = ui::WindowOpenDispositionFromNSEvent( | 745 bool alwaysCreate = ui::WindowOpenDispositionFromNSEvent( |
| 745 [NSApp currentEvent]) == NEW_WINDOW; | 746 [NSApp currentEvent]) == NEW_WINDOW; |
| 746 avatarMenu_->SwitchToProfile([sender tag], alwaysCreate, | 747 avatarMenu_->SwitchToProfile([sender tag], alwaysCreate, |
| 747 ProfileMetrics::SWITCH_PROFILE_ICON); | 748 ProfileMetrics::SWITCH_PROFILE_ICON); |
| 748 } | 749 } |
| 749 | 750 |
| 750 - (IBAction)showUserManager:(id)sender { | 751 - (IBAction)showUserManager:(id)sender { |
| 751 profiles::ShowUserManagerMaybeWithTutorial(browser_->profile()); | 752 profiles::ShowUserManagerMaybeWithTutorial(browser_->profile()); |
| 752 } | 753 } |
| 753 | 754 |
| 754 - (IBAction)exitGuest:(id)sender { | 755 - (IBAction)exitGuest:(id)sender { |
| 755 DCHECK(browser_->profile()->IsGuestSession()); | 756 DCHECK(browser_->profile()->IsGuestSession()); |
| 756 [self showUserManager:sender]; | 757 [self showUserManager:sender]; |
| 757 profiles::CloseGuestProfileWindows(); | 758 profiles::CloseGuestProfileWindows(); |
| 758 } | 759 } |
| 759 | 760 |
| 760 - (IBAction)showAccountManagement:(id)sender { | 761 - (IBAction)showAccountManagement:(id)sender { |
| 761 [self initMenuContentsWithView:BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT]; | 762 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT]; |
| 762 } | 763 } |
| 763 | 764 |
| 764 - (IBAction)hideAccountManagement:(id)sender { | 765 - (IBAction)hideAccountManagement:(id)sender { |
| 765 [self initMenuContentsWithView:BUBBLE_VIEW_MODE_PROFILE_CHOOSER]; | 766 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER]; |
| 766 } | 767 } |
| 767 | 768 |
| 768 - (IBAction)lockProfile:(id)sender { | 769 - (IBAction)lockProfile:(id)sender { |
| 769 profiles::LockProfile(browser_->profile()); | 770 profiles::LockProfile(browser_->profile()); |
| 770 } | 771 } |
| 771 | 772 |
| 772 - (IBAction)showInlineSigninPage:(id)sender { | 773 - (IBAction)showInlineSigninPage:(id)sender { |
| 773 [self initMenuContentsWithView:BUBBLE_VIEW_MODE_GAIA_SIGNIN]; | 774 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN]; |
| 774 } | 775 } |
| 775 | 776 |
| 776 - (IBAction)showTabbedSigninPage:(id)sender { | 777 - (IBAction)showTabbedSigninPage:(id)sender { |
| 777 chrome::ShowBrowserSignin(browser_, signin::SOURCE_MENU); | 778 chrome::ShowBrowserSignin(browser_, signin::SOURCE_MENU); |
| 778 } | 779 } |
| 779 | 780 |
| 780 - (IBAction)addAccount:(id)sender { | 781 - (IBAction)addAccount:(id)sender { |
| 781 [self initMenuContentsWithView:BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT]; | 782 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT]; |
| 782 } | 783 } |
| 783 | 784 |
| 784 - (IBAction)navigateBackFromSigninPage:(id)sender { | 785 - (IBAction)navigateBackFromSigninPage:(id)sender { |
| 785 std::string primaryAccount = SigninManagerFactory::GetForProfile( | 786 std::string primaryAccount = SigninManagerFactory::GetForProfile( |
| 786 browser_->profile())->GetAuthenticatedUsername(); | 787 browser_->profile())->GetAuthenticatedUsername(); |
| 787 [self initMenuContentsWithView:primaryAccount.empty() ? | 788 [self initMenuContentsWithView:primaryAccount.empty() ? |
| 788 BUBBLE_VIEW_MODE_PROFILE_CHOOSER : BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT]; | 789 profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER : |
| 790 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT]; | |
| 789 } | 791 } |
| 790 | 792 |
| 791 - (IBAction)showAccountRemovalView:(id)sender { | 793 - (IBAction)showAccountRemovalView:(id)sender { |
| 792 DCHECK(!isGuestSession_); | 794 DCHECK(!isGuestSession_); |
| 793 | 795 |
| 794 // Tag is either |kPrimaryProfileTag| for the primary account, or equal to the | 796 // Tag is either |kPrimaryProfileTag| for the primary account, or equal to the |
| 795 // index in |currentProfileAccounts_| for a secondary account. | 797 // index in |currentProfileAccounts_| for a secondary account. |
| 796 int tag = [sender tag]; | 798 int tag = [sender tag]; |
| 797 if (tag == kPrimaryProfileTag) { | 799 if (tag == kPrimaryProfileTag) { |
| 798 accountIdToRemove_ = SigninManagerFactory::GetForProfile( | 800 accountIdToRemove_ = SigninManagerFactory::GetForProfile( |
| 799 browser_->profile())->GetAuthenticatedUsername(); | 801 browser_->profile())->GetAuthenticatedUsername(); |
| 800 } else { | 802 } else { |
| 801 DCHECK(ContainsKey(currentProfileAccounts_, tag)); | 803 DCHECK(ContainsKey(currentProfileAccounts_, tag)); |
| 802 accountIdToRemove_ = currentProfileAccounts_[tag]; | 804 accountIdToRemove_ = currentProfileAccounts_[tag]; |
| 803 } | 805 } |
| 804 | 806 |
| 805 [self initMenuContentsWithView:BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL]; | 807 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL]; |
| 806 } | 808 } |
| 807 | 809 |
| 808 - (IBAction)removeAccount:(id)sender { | 810 - (IBAction)removeAccount:(id)sender { |
| 809 DCHECK(!accountIdToRemove_.empty()); | 811 DCHECK(!accountIdToRemove_.empty()); |
| 810 ProfileOAuth2TokenServiceFactory::GetPlatformSpecificForProfile( | 812 ProfileOAuth2TokenServiceFactory::GetPlatformSpecificForProfile( |
| 811 browser_->profile())->RevokeCredentials(accountIdToRemove_); | 813 browser_->profile())->RevokeCredentials(accountIdToRemove_); |
| 812 accountIdToRemove_.clear(); | 814 accountIdToRemove_.clear(); |
| 813 | 815 |
| 814 [self initMenuContentsWithView:BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT]; | 816 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT]; |
| 815 } | 817 } |
| 816 | 818 |
| 817 - (IBAction)openTutorialLearnMoreURL:(id)sender { | 819 - (IBAction)openTutorialLearnMoreURL:(id)sender { |
| 818 // TODO(guohui): update |learnMoreUrl| once it is decided. | 820 // TODO(guohui): update |learnMoreUrl| once it is decided. |
| 819 const GURL learnMoreUrl("https://support.google.com/chrome/?hl=en#to"); | 821 const GURL learnMoreUrl("https://support.google.com/chrome/?hl=en#to"); |
| 820 chrome::NavigateParams params(browser_->profile(), learnMoreUrl, | 822 chrome::NavigateParams params(browser_->profile(), learnMoreUrl, |
| 821 content::PAGE_TRANSITION_LINK); | 823 content::PAGE_TRANSITION_LINK); |
| 822 params.disposition = NEW_FOREGROUND_TAB; | 824 params.disposition = NEW_FOREGROUND_TAB; |
| 823 chrome::Navigate(¶ms); | 825 chrome::Navigate(¶ms); |
| 824 } | 826 } |
| 825 | 827 |
| 826 - (IBAction)enableNewProfileManagementPreview:(id)sender { | 828 - (IBAction)enableNewProfileManagementPreview:(id)sender { |
| 827 profiles::EnableNewProfileManagementPreview(); | 829 profiles::EnableNewProfileManagementPreview(); |
| 828 } | 830 } |
| 829 | 831 |
| 830 - (IBAction)dismissTutorial:(id)sender { | 832 - (IBAction)dismissTutorial:(id)sender { |
| 831 // If the user manually dismissed the tutorial, never show it again by setting | 833 // If the user manually dismissed the tutorial, never show it again by setting |
| 832 // the number of times shown to the maximum plus 1, so that later we could | 834 // the number of times shown to the maximum plus 1, so that later we could |
| 833 // distinguish between the dismiss case and the case when the tutorial is | 835 // distinguish between the dismiss case and the case when the tutorial is |
| 834 // indeed shown for the maximum number of times. | 836 // indeed shown for the maximum number of times. |
| 835 browser_->profile()->GetPrefs()->SetInteger( | 837 browser_->profile()->GetPrefs()->SetInteger( |
| 836 prefs::kProfileAvatarTutorialShown, kProfileAvatarTutorialShowMax + 1); | 838 prefs::kProfileAvatarTutorialShown, kProfileAvatarTutorialShowMax + 1); |
| 837 [self initMenuContentsWithView:BUBBLE_VIEW_MODE_PROFILE_CHOOSER]; | 839 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER]; |
| 838 } | 840 } |
| 839 | 841 |
| 840 - (IBAction)showSendFeedbackTutorial:(id)sender { | 842 - (IBAction)showSendFeedbackTutorial:(id)sender { |
| 841 tutorialMode_ = TUTORIAL_MODE_SEND_FEEDBACK; | 843 tutorialMode_ = profiles::TUTORIAL_MODE_SEND_FEEDBACK; |
| 842 [self initMenuContentsWithView:BUBBLE_VIEW_MODE_PROFILE_CHOOSER]; | 844 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER]; |
| 843 } | 845 } |
| 844 | 846 |
| 845 - (IBAction)showEndPreviewView:(id)sender { | 847 - (IBAction)showEndPreviewView:(id)sender { |
| 846 [self initMenuContentsWithView:BUBBLE_VIEW_MODE_END_PREVIEW]; | 848 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_END_PREVIEW]; |
| 847 } | 849 } |
| 848 | 850 |
| 849 - (IBAction)sendFeedback:(id)sender { | 851 - (IBAction)sendFeedback:(id)sender { |
| 850 chrome::OpenFeedbackDialog(browser_); | 852 chrome::OpenFeedbackDialog(browser_); |
| 851 } | 853 } |
| 852 | 854 |
| 853 - (IBAction)endPreviewAndRelaunch:(id)sender { | 855 - (IBAction)endPreviewAndRelaunch:(id)sender { |
| 854 profiles::DisableNewProfileManagementPreview(); | 856 profiles::DisableNewProfileManagementPreview(); |
| 855 } | 857 } |
| 856 | 858 |
| 857 - (void)cleanUpEmbeddedViewContents { | 859 - (void)cleanUpEmbeddedViewContents { |
| 858 webContents_.reset(); | 860 webContents_.reset(); |
| 859 } | 861 } |
| 860 | 862 |
| 861 - (id)initWithBrowser:(Browser*)browser | 863 - (id)initWithBrowser:(Browser*)browser |
| 862 anchoredAt:(NSPoint)point | 864 anchoredAt:(NSPoint)point |
| 863 withMode:(BubbleViewMode)mode { | 865 withMode:(profiles::BubbleViewMode)mode { |
| 864 base::scoped_nsobject<InfoBubbleWindow> window([[InfoBubbleWindow alloc] | 866 base::scoped_nsobject<InfoBubbleWindow> window([[InfoBubbleWindow alloc] |
| 865 initWithContentRect:ui::kWindowSizeDeterminedLater | 867 initWithContentRect:ui::kWindowSizeDeterminedLater |
| 866 styleMask:NSBorderlessWindowMask | 868 styleMask:NSBorderlessWindowMask |
| 867 backing:NSBackingStoreBuffered | 869 backing:NSBackingStoreBuffered |
| 868 defer:NO]); | 870 defer:NO]); |
| 869 | 871 |
| 870 if ((self = [super initWithWindow:window | 872 if ((self = [super initWithWindow:window |
| 871 parentWindow:browser->window()->GetNativeWindow() | 873 parentWindow:browser->window()->GetNativeWindow() |
| 872 anchoredAt:point])) { | 874 anchoredAt:point])) { |
| 873 browser_ = browser; | 875 browser_ = browser; |
| 874 viewMode_ = mode; | 876 viewMode_ = mode; |
| 875 tutorialMode_ = TUTORIAL_MODE_NONE; | 877 tutorialMode_ = profiles::TUTORIAL_MODE_NONE; |
| 876 observer_.reset(new ActiveProfileObserverBridge(self, browser_)); | 878 observer_.reset(new ActiveProfileObserverBridge(self, browser_)); |
| 877 | 879 |
| 878 avatarMenu_.reset(new AvatarMenu( | 880 avatarMenu_.reset(new AvatarMenu( |
| 879 &g_browser_process->profile_manager()->GetProfileInfoCache(), | 881 &g_browser_process->profile_manager()->GetProfileInfoCache(), |
| 880 observer_.get(), | 882 observer_.get(), |
| 881 browser_)); | 883 browser_)); |
| 882 avatarMenu_->RebuildMenu(); | 884 avatarMenu_->RebuildMenu(); |
| 883 | 885 |
| 884 // Guest profiles do not have a token service. | 886 // Guest profiles do not have a token service. |
| 885 isGuestSession_ = browser_->profile()->IsGuestSession(); | 887 isGuestSession_ = browser_->profile()->IsGuestSession(); |
| 886 | 888 |
| 887 [[self bubble] setAlignment:info_bubble::kAlignRightEdgeToAnchorEdge]; | 889 [[self bubble] setAlignment:info_bubble::kAlignRightEdgeToAnchorEdge]; |
| 888 [[self bubble] setArrowLocation:info_bubble::kNoArrow]; | 890 [[self bubble] setArrowLocation:info_bubble::kNoArrow]; |
| 889 [[self bubble] setBackgroundColor:GetDialogBackgroundColor()]; | 891 [[self bubble] setBackgroundColor:GetDialogBackgroundColor()]; |
| 890 [self initMenuContentsWithView:viewMode_]; | 892 [self initMenuContentsWithView:viewMode_]; |
| 891 } | 893 } |
| 892 | 894 |
| 893 return self; | 895 return self; |
| 894 } | 896 } |
| 895 | 897 |
| 896 - (void)initMenuContentsWithView:(BubbleViewMode)viewToDisplay { | 898 - (void)initMenuContentsWithView:(profiles::BubbleViewMode)viewToDisplay { |
| 897 viewMode_ = viewToDisplay; | 899 viewMode_ = viewToDisplay; |
| 898 NSView* contentView = [[self window] contentView]; | 900 NSView* contentView = [[self window] contentView]; |
| 899 [contentView setSubviews:[NSArray array]]; | 901 [contentView setSubviews:[NSArray array]]; |
| 900 NSView* subView; | 902 NSView* subView; |
| 901 | 903 |
| 902 switch (viewMode_) { | 904 switch (viewMode_) { |
| 903 case BUBBLE_VIEW_MODE_GAIA_SIGNIN: | 905 case profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN: |
| 904 case BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT: | 906 case profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT: |
| 905 subView = [self buildGaiaEmbeddedView]; | 907 subView = [self buildGaiaEmbeddedView]; |
| 906 break; | 908 break; |
| 907 case BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL: | 909 case profiles::BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL: |
| 908 subView = [self buildAccountRemovalView]; | 910 subView = [self buildAccountRemovalView]; |
| 909 break; | 911 break; |
| 910 case BUBBLE_VIEW_MODE_END_PREVIEW: | 912 case profiles::BUBBLE_VIEW_MODE_END_PREVIEW: |
| 911 subView = [self buildEndPreviewView]; | 913 subView = [self buildEndPreviewView]; |
| 912 break; | 914 break; |
| 913 case BUBBLE_VIEW_MODE_PROFILE_CHOOSER: | 915 case profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER: |
| 914 case BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT: | 916 case profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT: |
| 915 subView = [self buildProfileChooserView]; | 917 subView = [self buildProfileChooserView]; |
| 916 } | 918 } |
|
Scott Hess - ex-Googler
2014/05/21 18:42:44
While you're here, put the missing break; in to ma
Mike Lerman
2014/05/21 18:58:22
Done.
| |
| 917 | 919 |
| 918 [contentView addSubview:subView]; | 920 [contentView addSubview:subView]; |
| 919 SetWindowSize([self window], | 921 SetWindowSize([self window], |
| 920 NSMakeSize(NSWidth([subView frame]), NSHeight([subView frame]))); | 922 NSMakeSize(NSWidth([subView frame]), NSHeight([subView frame]))); |
| 921 } | 923 } |
| 922 | 924 |
| 923 - (NSView*)buildProfileChooserView { | 925 - (NSView*)buildProfileChooserView { |
| 924 base::scoped_nsobject<NSView> container( | 926 base::scoped_nsobject<NSView> container( |
| 925 [[NSView alloc] initWithFrame:NSZeroRect]); | 927 [[NSView alloc] initWithFrame:NSZeroRect]); |
| 926 | 928 |
| 927 NSView* tutorialView = nil; | 929 NSView* tutorialView = nil; |
| 928 NSView* currentProfileView = nil; | 930 NSView* currentProfileView = nil; |
| 929 base::scoped_nsobject<NSMutableArray> otherProfiles( | 931 base::scoped_nsobject<NSMutableArray> otherProfiles( |
| 930 [[NSMutableArray alloc] init]); | 932 [[NSMutableArray alloc] init]); |
| 931 // Local and guest profiles cannot lock their profile. | 933 // Local and guest profiles cannot lock their profile. |
| 932 bool enableLock = false; | 934 bool enableLock = false; |
| 933 | 935 |
| 934 // Loop over the profiles in reverse, so that they are sorted by their | 936 // Loop over the profiles in reverse, so that they are sorted by their |
| 935 // y-coordinate, and separate them into active and "other" profiles. | 937 // y-coordinate, and separate them into active and "other" profiles. |
| 936 for (int i = avatarMenu_->GetNumberOfItems() - 1; i >= 0; --i) { | 938 for (int i = avatarMenu_->GetNumberOfItems() - 1; i >= 0; --i) { |
| 937 const AvatarMenu::Item& item = avatarMenu_->GetItemAt(i); | 939 const AvatarMenu::Item& item = avatarMenu_->GetItemAt(i); |
| 938 if (item.active) { | 940 if (item.active) { |
| 939 if (viewMode_ == BUBBLE_VIEW_MODE_PROFILE_CHOOSER) | 941 if (viewMode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) |
| 940 tutorialView = [self buildPreviewTutorialIfNeeded:item]; | 942 tutorialView = [self buildPreviewTutorialIfNeeded:item]; |
| 941 currentProfileView = [self createCurrentProfileView:item]; | 943 currentProfileView = [self createCurrentProfileView:item]; |
| 942 enableLock = item.signed_in; | 944 enableLock = item.signed_in; |
| 943 } else { | 945 } else { |
| 944 [otherProfiles addObject:[self createOtherProfileView:i]]; | 946 [otherProfiles addObject:[self createOtherProfileView:i]]; |
| 945 } | 947 } |
| 946 } | 948 } |
| 947 if (!currentProfileView) // Guest windows don't have an active profile. | 949 if (!currentProfileView) // Guest windows don't have an active profile. |
| 948 currentProfileView = [self createGuestProfileView]; | 950 currentProfileView = [self createGuestProfileView]; |
| 949 | 951 |
| 950 // |yOffset| is the next position at which to draw in |container| | 952 // |yOffset| is the next position at which to draw in |container| |
| 951 // coordinates. | 953 // coordinates. |
| 952 CGFloat yOffset = 0; | 954 CGFloat yOffset = 0; |
| 953 | 955 |
| 954 // Option buttons. Only available with the new profile management flag. | 956 // Option buttons. Only available with the new profile management flag. |
| 955 if (switches::IsNewProfileManagement()) { | 957 if (switches::IsNewProfileManagement()) { |
| 956 NSRect rect = NSMakeRect(0, yOffset, kFixedMenuWidth, 0); | 958 NSRect rect = NSMakeRect(0, yOffset, kFixedMenuWidth, 0); |
| 957 NSView* optionsView = [self createOptionsViewWithRect:rect | 959 NSView* optionsView = [self createOptionsViewWithRect:rect |
| 958 enableLock:enableLock]; | 960 enableLock:enableLock]; |
| 959 [container addSubview:optionsView]; | 961 [container addSubview:optionsView]; |
| 960 rect.origin.y = NSMaxY([optionsView frame]); | 962 rect.origin.y = NSMaxY([optionsView frame]); |
| 961 | 963 |
| 962 NSBox* separator = [self separatorWithFrame:rect]; | 964 NSBox* separator = [self separatorWithFrame:rect]; |
| 963 [container addSubview:separator]; | 965 [container addSubview:separator]; |
| 964 yOffset = NSMaxY([separator frame]); | 966 yOffset = NSMaxY([separator frame]); |
| 965 } | 967 } |
| 966 | 968 |
| 967 if (viewMode_ == BUBBLE_VIEW_MODE_PROFILE_CHOOSER && | 969 if (viewMode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER && |
| 968 switches::IsFastUserSwitching()) { | 970 switches::IsFastUserSwitching()) { |
| 969 // Other profiles switcher. The profiles have already been sorted | 971 // Other profiles switcher. The profiles have already been sorted |
| 970 // by their y-coordinate, so they can be added in the existing order. | 972 // by their y-coordinate, so they can be added in the existing order. |
| 971 for (NSView *otherProfileView in otherProfiles.get()) { | 973 for (NSView *otherProfileView in otherProfiles.get()) { |
| 972 [otherProfileView setFrameOrigin:NSMakePoint(0, yOffset)]; | 974 [otherProfileView setFrameOrigin:NSMakePoint(0, yOffset)]; |
| 973 [container addSubview:otherProfileView]; | 975 [container addSubview:otherProfileView]; |
| 974 yOffset = NSMaxY([otherProfileView frame]); | 976 yOffset = NSMaxY([otherProfileView frame]); |
| 975 | 977 |
| 976 NSBox* separator = | 978 NSBox* separator = |
| 977 [self separatorWithFrame:NSMakeRect(0, yOffset, kFixedMenuWidth, 0)]; | 979 [self separatorWithFrame:NSMakeRect(0, yOffset, kFixedMenuWidth, 0)]; |
| 978 [container addSubview:separator]; | 980 [container addSubview:separator]; |
| 979 yOffset = NSMaxY([separator frame]); | 981 yOffset = NSMaxY([separator frame]); |
| 980 } | 982 } |
| 981 } else if (viewMode_ == BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT) { | 983 } else if (viewMode_ == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT) { |
| 982 NSView* currentProfileAccountsView = [self createCurrentProfileAccountsView: | 984 NSView* currentProfileAccountsView = [self createCurrentProfileAccountsView: |
| 983 NSMakeRect(0, yOffset, kFixedMenuWidth, 0)]; | 985 NSMakeRect(0, yOffset, kFixedMenuWidth, 0)]; |
| 984 [container addSubview:currentProfileAccountsView]; | 986 [container addSubview:currentProfileAccountsView]; |
| 985 yOffset = NSMaxY([currentProfileAccountsView frame]); | 987 yOffset = NSMaxY([currentProfileAccountsView frame]); |
| 986 | 988 |
| 987 NSBox* accountsSeparator = [self separatorWithFrame: | 989 NSBox* accountsSeparator = [self separatorWithFrame: |
| 988 NSMakeRect(0, yOffset, kFixedMenuWidth, 0)]; | 990 NSMakeRect(0, yOffset, kFixedMenuWidth, 0)]; |
| 989 [container addSubview:accountsSeparator]; | 991 [container addSubview:accountsSeparator]; |
| 990 yOffset = NSMaxY([accountsSeparator frame]); | 992 yOffset = NSMaxY([accountsSeparator frame]); |
| 991 } | 993 } |
| 992 | 994 |
| 993 // Active profile card. | 995 // Active profile card. |
| 994 if (currentProfileView) { | 996 if (currentProfileView) { |
| 995 yOffset += kVerticalSpacing; | 997 yOffset += kVerticalSpacing; |
| 996 [currentProfileView setFrameOrigin:NSMakePoint(0, yOffset)]; | 998 [currentProfileView setFrameOrigin:NSMakePoint(0, yOffset)]; |
| 997 [container addSubview:currentProfileView]; | 999 [container addSubview:currentProfileView]; |
| 998 yOffset = NSMaxY([currentProfileView frame]) + kVerticalSpacing; | 1000 yOffset = NSMaxY([currentProfileView frame]) + kVerticalSpacing; |
| 999 } | 1001 } |
| 1000 | 1002 |
| 1001 if (tutorialView) { | 1003 if (tutorialView) { |
| 1002 [tutorialView setFrameOrigin:NSMakePoint(0, yOffset)]; | 1004 [tutorialView setFrameOrigin:NSMakePoint(0, yOffset)]; |
| 1003 [container addSubview:tutorialView]; | 1005 [container addSubview:tutorialView]; |
| 1004 yOffset = NSMaxY([tutorialView frame]); | 1006 yOffset = NSMaxY([tutorialView frame]); |
| 1005 } else { | 1007 } else { |
| 1006 tutorialMode_ = TUTORIAL_MODE_NONE; | 1008 tutorialMode_ = profiles::TUTORIAL_MODE_NONE; |
| 1007 } | 1009 } |
| 1008 | 1010 |
| 1009 [container setFrameSize:NSMakeSize(kFixedMenuWidth, yOffset)]; | 1011 [container setFrameSize:NSMakeSize(kFixedMenuWidth, yOffset)]; |
| 1010 return container.autorelease();; | 1012 return container.autorelease();; |
| 1011 } | 1013 } |
| 1012 | 1014 |
| 1013 - (NSView*)buildPreviewTutorialIfNeeded:(const AvatarMenu::Item&)item { | 1015 - (NSView*)buildPreviewTutorialIfNeeded:(const AvatarMenu::Item&)item { |
| 1014 if (!switches::IsNewProfileManagement()) { | 1016 if (!switches::IsNewProfileManagement()) { |
| 1015 return [self tutorialViewWithMode:TUTORIAL_MODE_ENABLE_PREVIEW | 1017 return [self tutorialViewWithMode:profiles::TUTORIAL_MODE_ENABLE_PREVIEW |
| 1016 titleMessage:IDS_PROFILES_PREVIEW_TUTORIAL_TITLE | 1018 titleMessage:IDS_PROFILES_PREVIEW_TUTORIAL_TITLE |
| 1017 contentMessage:IDS_PROFILES_PREVIEW_TUTORIAL_CONTENT_TEXT | 1019 contentMessage:IDS_PROFILES_PREVIEW_TUTORIAL_CONTENT_TEXT |
| 1018 linkMessage:IDS_PROFILES_PROFILE_TUTORIAL_LEARN_MORE | 1020 linkMessage:IDS_PROFILES_PROFILE_TUTORIAL_LEARN_MORE |
| 1019 buttonMessage:IDS_PROFILES_TUTORIAL_TRY_BUTTON | 1021 buttonMessage:IDS_PROFILES_TUTORIAL_TRY_BUTTON |
| 1020 linkAction:@selector(openTutorialLearnMoreURL:) | 1022 linkAction:@selector(openTutorialLearnMoreURL:) |
| 1021 buttonAction: | 1023 buttonAction: |
| 1022 @selector(enableNewProfileManagementPreview:)]; | 1024 @selector(enableNewProfileManagementPreview:)]; |
| 1023 } | 1025 } |
| 1024 | 1026 |
| 1025 if (!switches::IsNewProfileManagementPreviewEnabled()) | 1027 if (!switches::IsNewProfileManagementPreviewEnabled()) |
| 1026 return nil; | 1028 return nil; |
| 1027 | 1029 |
| 1028 if (tutorialMode_ == TUTORIAL_MODE_SEND_FEEDBACK) { | 1030 if (tutorialMode_ == profiles::TUTORIAL_MODE_SEND_FEEDBACK) { |
| 1029 return [self tutorialViewWithMode:TUTORIAL_MODE_SEND_FEEDBACK | 1031 return [self tutorialViewWithMode:profiles::TUTORIAL_MODE_SEND_FEEDBACK |
| 1030 titleMessage:IDS_PROFILES_FEEDBACK_TUTORIAL_TITLE | 1032 titleMessage:IDS_PROFILES_FEEDBACK_TUTORIAL_TITLE |
| 1031 contentMessage: | 1033 contentMessage: |
| 1032 IDS_PROFILES_FEEDBACK_TUTORIAL_CONTENT_TEXT | 1034 IDS_PROFILES_FEEDBACK_TUTORIAL_CONTENT_TEXT |
| 1033 linkMessage:IDS_PROFILES_END_PREVIEW | 1035 linkMessage:IDS_PROFILES_END_PREVIEW |
| 1034 buttonMessage:IDS_PROFILES_SEND_FEEDBACK_BUTTON | 1036 buttonMessage:IDS_PROFILES_SEND_FEEDBACK_BUTTON |
| 1035 linkAction:@selector(showEndPreviewView:) | 1037 linkAction:@selector(showEndPreviewView:) |
| 1036 buttonAction:@selector(sendFeedback:)]; | 1038 buttonAction:@selector(sendFeedback:)]; |
| 1037 } | 1039 } |
| 1038 | 1040 |
| 1039 Profile* profile = browser_->profile(); | 1041 Profile* profile = browser_->profile(); |
| 1040 const int showCount = profile->GetPrefs()->GetInteger( | 1042 const int showCount = profile->GetPrefs()->GetInteger( |
| 1041 prefs::kProfileAvatarTutorialShown); | 1043 prefs::kProfileAvatarTutorialShown); |
| 1042 // Do not show the tutorial if user has dismissed it. | 1044 // Do not show the tutorial if user has dismissed it. |
| 1043 if (showCount > kProfileAvatarTutorialShowMax) | 1045 if (showCount > kProfileAvatarTutorialShowMax) |
| 1044 return nil; | 1046 return nil; |
| 1045 | 1047 |
| 1046 if (tutorialMode_ != TUTORIAL_MODE_WELCOME) { | 1048 if (tutorialMode_ != profiles::TUTORIAL_MODE_WELCOME) { |
| 1047 if (showCount == kProfileAvatarTutorialShowMax) | 1049 if (showCount == kProfileAvatarTutorialShowMax) |
| 1048 return nil; | 1050 return nil; |
| 1049 profile->GetPrefs()->SetInteger( | 1051 profile->GetPrefs()->SetInteger( |
| 1050 prefs::kProfileAvatarTutorialShown, showCount + 1); | 1052 prefs::kProfileAvatarTutorialShown, showCount + 1); |
| 1051 } | 1053 } |
| 1052 | 1054 |
| 1053 return [self tutorialViewWithMode:TUTORIAL_MODE_WELCOME | 1055 return [self tutorialViewWithMode:profiles::TUTORIAL_MODE_WELCOME |
| 1054 titleMessage:IDS_PROFILES_PREVIEW_ENABLED_TUTORIAL_TITLE | 1056 titleMessage:IDS_PROFILES_PREVIEW_ENABLED_TUTORIAL_TITLE |
| 1055 contentMessage: | 1057 contentMessage: |
| 1056 IDS_PROFILES_PREVIEW_ENABLED_TUTORIAL_CONTENT_TEXT | 1058 IDS_PROFILES_PREVIEW_ENABLED_TUTORIAL_CONTENT_TEXT |
| 1057 linkMessage:IDS_PROFILES_PROFILE_TUTORIAL_LEARN_MORE | 1059 linkMessage:IDS_PROFILES_PROFILE_TUTORIAL_LEARN_MORE |
| 1058 buttonMessage:IDS_PROFILES_TUTORIAL_OK_BUTTON | 1060 buttonMessage:IDS_PROFILES_TUTORIAL_OK_BUTTON |
| 1059 linkAction:@selector(openTutorialLearnMoreURL:) | 1061 linkAction:@selector(openTutorialLearnMoreURL:) |
| 1060 buttonAction:@selector(dismissTutorial:)]; | 1062 buttonAction:@selector(dismissTutorial:)]; |
| 1061 } | 1063 } |
| 1062 | 1064 |
| 1063 - (NSView*)tutorialViewWithMode:(TutorialMode)mode | 1065 - (NSView*)tutorialViewWithMode:(profiles::TutorialMode)mode |
| 1064 titleMessage:(int)titleMessageId | 1066 titleMessage:(int)titleMessageId |
| 1065 contentMessage:(int)contentMessageId | 1067 contentMessage:(int)contentMessageId |
| 1066 linkMessage:(int)linkMessageId | 1068 linkMessage:(int)linkMessageId |
| 1067 buttonMessage:(int)buttonMessageId | 1069 buttonMessage:(int)buttonMessageId |
| 1068 linkAction:(SEL)linkAction | 1070 linkAction:(SEL)linkAction |
| 1069 buttonAction:(SEL)buttonAction { | 1071 buttonAction:(SEL)buttonAction { |
| 1070 tutorialMode_ = mode; | 1072 tutorialMode_ = mode; |
| 1071 | 1073 |
| 1072 NSColor* tutorialBackgroundColor = | 1074 NSColor* tutorialBackgroundColor = |
| 1073 gfx::SkColorToSRGBNSColor(profiles::kAvatarTutorialBackgroundColor); | 1075 gfx::SkColorToSRGBNSColor(profiles::kAvatarTutorialBackgroundColor); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1234 base::scoped_nsobject<NSView> container([[NSView alloc] initWithFrame:rect]); | 1236 base::scoped_nsobject<NSView> container([[NSView alloc] initWithFrame:rect]); |
| 1235 | 1237 |
| 1236 // Don't double-apply the left margin to the sub-views. | 1238 // Don't double-apply the left margin to the sub-views. |
| 1237 rect.origin.x = 0; | 1239 rect.origin.x = 0; |
| 1238 | 1240 |
| 1239 // The available links depend on the type of profile that is active. | 1241 // The available links depend on the type of profile that is active. |
| 1240 NSButton* link; | 1242 NSButton* link; |
| 1241 if (item.signed_in) { | 1243 if (item.signed_in) { |
| 1242 if (switches::IsNewProfileManagement()) { | 1244 if (switches::IsNewProfileManagement()) { |
| 1243 NSString* linkTitle = l10n_util::GetNSString( | 1245 NSString* linkTitle = l10n_util::GetNSString( |
| 1244 viewMode_ == BUBBLE_VIEW_MODE_PROFILE_CHOOSER ? | 1246 viewMode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER ? |
| 1245 IDS_PROFILES_PROFILE_MANAGE_ACCOUNTS_BUTTON : | 1247 IDS_PROFILES_PROFILE_MANAGE_ACCOUNTS_BUTTON : |
| 1246 IDS_PROFILES_PROFILE_HIDE_MANAGE_ACCOUNTS_BUTTON); | 1248 IDS_PROFILES_PROFILE_HIDE_MANAGE_ACCOUNTS_BUTTON); |
| 1247 SEL linkSelector = (viewMode_ == BUBBLE_VIEW_MODE_PROFILE_CHOOSER) ? | 1249 SEL linkSelector = |
| 1250 (viewMode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) ? | |
| 1248 @selector(showAccountManagement:) : @selector(hideAccountManagement:); | 1251 @selector(showAccountManagement:) : @selector(hideAccountManagement:); |
| 1249 link = [self linkButtonWithTitle:linkTitle | 1252 link = [self linkButtonWithTitle:linkTitle |
| 1250 frameOrigin:rect.origin | 1253 frameOrigin:rect.origin |
| 1251 action:linkSelector]; | 1254 action:linkSelector]; |
| 1252 } else { | 1255 } else { |
| 1253 link = [self linkButtonWithTitle:base::SysUTF16ToNSString(item.sync_state) | 1256 link = [self linkButtonWithTitle:base::SysUTF16ToNSString(item.sync_state) |
| 1254 frameOrigin:rect.origin | 1257 frameOrigin:rect.origin |
| 1255 action:nil]; | 1258 action:nil]; |
| 1256 [[link cell] setTextColor:[NSColor blackColor]]; | 1259 [[link cell] setTextColor:[NSColor blackColor]]; |
| 1257 } | 1260 } |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1431 [container setFrameSize:NSMakeSize(NSWidth([container frame]), | 1434 [container setFrameSize:NSMakeSize(NSWidth([container frame]), |
| 1432 NSMaxY([accountButton frame]))]; | 1435 NSMaxY([accountButton frame]))]; |
| 1433 return container.autorelease(); | 1436 return container.autorelease(); |
| 1434 } | 1437 } |
| 1435 | 1438 |
| 1436 - (NSView*)buildGaiaEmbeddedView { | 1439 - (NSView*)buildGaiaEmbeddedView { |
| 1437 base::scoped_nsobject<NSView> container( | 1440 base::scoped_nsobject<NSView> container( |
| 1438 [[NSView alloc] initWithFrame:NSZeroRect]); | 1441 [[NSView alloc] initWithFrame:NSZeroRect]); |
| 1439 CGFloat yOffset = 0; | 1442 CGFloat yOffset = 0; |
| 1440 | 1443 |
| 1441 bool addSecondaryAccount = viewMode_ == BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT; | 1444 bool addSecondaryAccount = |
| 1445 viewMode_ == profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT; | |
| 1442 signin::Source source = addSecondaryAccount ? | 1446 signin::Source source = addSecondaryAccount ? |
| 1443 signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT : | 1447 signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT : |
| 1444 signin::SOURCE_AVATAR_BUBBLE_SIGN_IN; | 1448 signin::SOURCE_AVATAR_BUBBLE_SIGN_IN; |
| 1445 | 1449 |
| 1446 webContents_.reset(content::WebContents::Create( | 1450 webContents_.reset(content::WebContents::Create( |
| 1447 content::WebContents::CreateParams(browser_->profile()))); | 1451 content::WebContents::CreateParams(browser_->profile()))); |
| 1448 webContents_->GetController().LoadURL( | 1452 webContents_->GetController().LoadURL( |
| 1449 signin::GetPromoURL( | 1453 signin::GetPromoURL( |
| 1450 source, false /* auto_close */, true /* is_constrained */), | 1454 source, false /* auto_close */, true /* is_constrained */), |
| 1451 content::Referrer(), | 1455 content::Referrer(), |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1683 IDR_CLOSE_1_P).ToNSImage()]; | 1687 IDR_CLOSE_1_P).ToNSImage()]; |
| 1684 [deleteButton setTarget:self]; | 1688 [deleteButton setTarget:self]; |
| 1685 [deleteButton setAction:@selector(showAccountRemovalView:)]; | 1689 [deleteButton setAction:@selector(showAccountRemovalView:)]; |
| 1686 [deleteButton setTag:tag]; | 1690 [deleteButton setTag:tag]; |
| 1687 | 1691 |
| 1688 [button addSubview:deleteButton]; | 1692 [button addSubview:deleteButton]; |
| 1689 return button.autorelease(); | 1693 return button.autorelease(); |
| 1690 } | 1694 } |
| 1691 | 1695 |
| 1692 @end | 1696 @end |
| OLD | NEW |