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

Side by Side Diff: ios/chrome/browser/infobars/confirm_infobar_controller.mm

Issue 2574463002: [ObjC ARC] Converts ios/chrome/browser/infobars:infobars to ARC.\n\nAutomatically generated ARCMigr… (Closed)
Patch Set: retain-autorelease Created 4 years 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
« no previous file with comments | « ios/chrome/browser/infobars/BUILD.gn ('k') | ios/chrome/browser/infobars/infobar.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/infobars/confirm_infobar_controller.h" 5 #import "ios/chrome/browser/infobars/confirm_infobar_controller.h"
6 6
7 #include "base/mac/foundation_util.h" 7 #include "base/mac/foundation_util.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "components/infobars/core/confirm_infobar_delegate.h" 10 #include "components/infobars/core/confirm_infobar_delegate.h"
11 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" 11 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
12 #import "ios/public/provider/chrome/browser/ui/infobar_view_delegate.h" 12 #import "ios/public/provider/chrome/browser/ui/infobar_view_delegate.h"
13 #import "ios/public/provider/chrome/browser/ui/infobar_view_protocol.h" 13 #import "ios/public/provider/chrome/browser/ui/infobar_view_protocol.h"
14 #include "ui/base/l10n/l10n_util.h" 14 #include "ui/base/l10n/l10n_util.h"
15 #include "ui/base/window_open_disposition.h" 15 #include "ui/base/window_open_disposition.h"
16 #include "ui/gfx/image/image.h" 16 #include "ui/gfx/image/image.h"
17 17
18 #if !defined(__has_feature) || !__has_feature(objc_arc)
19 #error "This file requires ARC support."
20 #endif
21
18 namespace { 22 namespace {
19 23
20 // UI Tags for the infobar elements. 24 // UI Tags for the infobar elements.
21 typedef NS_ENUM(NSInteger, ConfirmInfoBarUITags) { 25 typedef NS_ENUM(NSInteger, ConfirmInfoBarUITags) {
22 OK = 1, 26 OK = 1,
23 CANCEL, 27 CANCEL,
24 CLOSE, 28 CLOSE,
25 TITLE_LINK 29 TITLE_LINK
26 }; 30 };
27 31
(...skipping 18 matching lines...) Expand all
46 @interface ConfirmInfoBarController () { 50 @interface ConfirmInfoBarController () {
47 ConfirmInfoBarDelegate* _confirmInfobarDelegate; 51 ConfirmInfoBarDelegate* _confirmInfobarDelegate;
48 } 52 }
49 @end 53 @end
50 54
51 @implementation ConfirmInfoBarController 55 @implementation ConfirmInfoBarController
52 56
53 #pragma mark - 57 #pragma mark -
54 #pragma mark InfoBarController 58 #pragma mark InfoBarController
55 59
56 - (base::scoped_nsobject<UIView<InfoBarViewProtocol>>) 60 - (UIView<InfoBarViewProtocol>*)viewForDelegate:
57 viewForDelegate:(infobars::InfoBarDelegate*)delegate 61 (infobars::InfoBarDelegate*)delegate
58 frame:(CGRect)frame { 62 frame:(CGRect)frame {
59 base::scoped_nsobject<UIView<InfoBarViewProtocol>> infoBarView; 63 UIView<InfoBarViewProtocol>* infoBarView;
60 _confirmInfobarDelegate = delegate->AsConfirmInfoBarDelegate(); 64 _confirmInfobarDelegate = delegate->AsConfirmInfoBarDelegate();
61 infoBarView.reset( 65 infoBarView =
62 ios::GetChromeBrowserProvider()->CreateInfoBarView(frame, self.delegate)); 66 ios::GetChromeBrowserProvider()->CreateInfoBarView(frame, self.delegate);
63 // Model data. 67 // Model data.
64 gfx::Image modelIcon = _confirmInfobarDelegate->GetIcon(); 68 gfx::Image modelIcon = _confirmInfobarDelegate->GetIcon();
65 int buttons = _confirmInfobarDelegate->GetButtons(); 69 int buttons = _confirmInfobarDelegate->GetButtons();
66 NSString* buttonOK = nil; 70 NSString* buttonOK = nil;
67 if (buttons & ConfirmInfoBarDelegate::BUTTON_OK) { 71 if (buttons & ConfirmInfoBarDelegate::BUTTON_OK) {
68 buttonOK = base::SysUTF16ToNSString(_confirmInfobarDelegate->GetButtonLabel( 72 buttonOK = base::SysUTF16ToNSString(_confirmInfobarDelegate->GetButtonLabel(
69 ConfirmInfoBarDelegate::BUTTON_OK)); 73 ConfirmInfoBarDelegate::BUTTON_OK));
70 } 74 }
71 NSString* buttonCancel = nil; 75 NSString* buttonCancel = nil;
72 if (buttons & ConfirmInfoBarDelegate::BUTTON_CANCEL) { 76 if (buttons & ConfirmInfoBarDelegate::BUTTON_CANCEL) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 if (!self.delegate) { 155 if (!self.delegate) {
152 return; 156 return;
153 } 157 }
154 if ([tag unsignedIntegerValue] == ConfirmInfoBarUITags::TITLE_LINK) { 158 if ([tag unsignedIntegerValue] == ConfirmInfoBarUITags::TITLE_LINK) {
155 _confirmInfobarDelegate->LinkClicked( 159 _confirmInfobarDelegate->LinkClicked(
156 WindowOpenDisposition::NEW_FOREGROUND_TAB); 160 WindowOpenDisposition::NEW_FOREGROUND_TAB);
157 } 161 }
158 } 162 }
159 163
160 @end 164 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/infobars/BUILD.gn ('k') | ios/chrome/browser/infobars/infobar.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698