Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Side by Side Diff: ios/chrome/browser/ui/authentication/re_signin_infobar_delegate.mm

Issue 2936583002: [ObjC ARC] Converts ios/chrome/browser/ui/authentication:authentication to ARC. (Closed)
Patch Set: Review fixes. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ios/chrome/browser/ui/authentication/re_signin_infobar_delegate.h" 5 #import "ios/chrome/browser/ui/authentication/re_signin_infobar_delegate.h"
6 6
7 #import <UIKit/UIKit.h> 7 #import <UIKit/UIKit.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
14 #include "base/metrics/user_metrics.h" 14 #include "base/metrics/user_metrics.h"
15 #include "components/infobars/core/infobar_manager.h" 15 #include "components/infobars/core/infobar_manager.h"
16 #include "components/strings/grit/components_strings.h" 16 #include "components/strings/grit/components_strings.h"
17 #import "ios/chrome/browser/browser_state/chrome_browser_state.h" 17 #import "ios/chrome/browser/browser_state/chrome_browser_state.h"
18 #include "ios/chrome/browser/infobars/infobar.h" 18 #include "ios/chrome/browser/infobars/infobar.h"
19 #include "ios/chrome/browser/signin/authentication_service.h" 19 #include "ios/chrome/browser/signin/authentication_service.h"
20 #include "ios/chrome/browser/signin/authentication_service_factory.h" 20 #include "ios/chrome/browser/signin/authentication_service_factory.h"
21 #include "ios/chrome/browser/tabs/tab.h" 21 #include "ios/chrome/browser/tabs/tab.h"
22 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" 22 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h"
23 #import "ios/chrome/browser/ui/commands/show_signin_command.h" 23 #import "ios/chrome/browser/ui/commands/show_signin_command.h"
24 #include "ios/chrome/grit/ios_strings.h" 24 #include "ios/chrome/grit/ios_strings.h"
25 #include "ui/base/l10n/l10n_util.h" 25 #include "ui/base/l10n/l10n_util.h"
26 26
27 #if !defined(__has_feature) || !__has_feature(objc_arc)
28 #error "This file requires ARC support."
29 #endif
30
27 // static 31 // static
28 bool ReSignInInfoBarDelegate::Create(ios::ChromeBrowserState* browser_state, 32 bool ReSignInInfoBarDelegate::Create(ios::ChromeBrowserState* browser_state,
29 Tab* tab) { 33 Tab* tab) {
30 infobars::InfoBarManager* infobar_manager = [tab infoBarManager]; 34 infobars::InfoBarManager* infobar_manager = [tab infoBarManager];
31 DCHECK(infobar_manager); 35 DCHECK(infobar_manager);
32 36
33 std::unique_ptr<infobars::InfoBar> infobar = 37 std::unique_ptr<infobars::InfoBar> infobar =
34 ReSignInInfoBarDelegate::CreateInfoBar(infobar_manager, browser_state); 38 ReSignInInfoBarDelegate::CreateInfoBar(infobar_manager, browser_state);
35 if (!infobar) 39 if (!infobar)
36 return false; 40 return false;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 109
106 gfx::Image ReSignInInfoBarDelegate::GetIcon() const { 110 gfx::Image ReSignInInfoBarDelegate::GetIcon() const {
107 return icon_; 111 return icon_;
108 } 112 }
109 113
110 bool ReSignInInfoBarDelegate::Accept() { 114 bool ReSignInInfoBarDelegate::Accept() {
111 base::RecordAction( 115 base::RecordAction(
112 base::UserMetricsAction("Signin_Signin_FromReSigninInfobar")); 116 base::UserMetricsAction("Signin_Signin_FromReSigninInfobar"));
113 UIView* infobarView = static_cast<InfoBarIOS*>(infobar())->view(); 117 UIView* infobarView = static_cast<InfoBarIOS*>(infobar())->view();
114 DCHECK(infobarView); 118 DCHECK(infobarView);
115 base::scoped_nsobject<ShowSigninCommand> command([[ShowSigninCommand alloc] 119 ShowSigninCommand* command = [[ShowSigninCommand alloc]
116 initWithOperation:AUTHENTICATION_OPERATION_REAUTHENTICATE 120 initWithOperation:AUTHENTICATION_OPERATION_REAUTHENTICATE
117 accessPoint:signin_metrics::AccessPoint:: 121 accessPoint:signin_metrics::AccessPoint::
118 ACCESS_POINT_RESIGNIN_INFOBAR]); 122 ACCESS_POINT_RESIGNIN_INFOBAR];
119 [infobarView chromeExecuteCommand:command]; 123 [infobarView chromeExecuteCommand:command];
120 124
121 // Stop displaying the infobar once user interacted with it. 125 // Stop displaying the infobar once user interacted with it.
122 AuthenticationServiceFactory::GetForBrowserState(browser_state_) 126 AuthenticationServiceFactory::GetForBrowserState(browser_state_)
123 ->SetPromptForSignIn(false); 127 ->SetPromptForSignIn(false);
124 return true; 128 return true;
125 } 129 }
126 130
127 void ReSignInInfoBarDelegate::InfoBarDismissed() { 131 void ReSignInInfoBarDelegate::InfoBarDismissed() {
128 // Stop displaying the infobar once user interacted with it. 132 // Stop displaying the infobar once user interacted with it.
129 AuthenticationServiceFactory::GetForBrowserState(browser_state_) 133 AuthenticationServiceFactory::GetForBrowserState(browser_state_)
130 ->SetPromptForSignIn(false); 134 ->SetPromptForSignIn(false);
131 } 135 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698