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

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

Issue 975663002: Remove the distinction between informational and warning infobar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | ios/chrome/browser/translate/after_translate_infobar_controller.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 #include "ios/chrome/browser/infobars/confirm_infobar_controller.h" 5 #include "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/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #include "components/infobars/core/confirm_infobar_delegate.h" 9 #include "components/infobars/core/confirm_infobar_delegate.h"
10 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" 10 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 #pragma mark - 48 #pragma mark -
49 #pragma mark InfoBarController 49 #pragma mark InfoBarController
50 50
51 - (void)layoutForDelegate:(infobars::InfoBarDelegate*)delegate 51 - (void)layoutForDelegate:(infobars::InfoBarDelegate*)delegate
52 frame:(CGRect)frame { 52 frame:(CGRect)frame {
53 ConfirmInfoBarDelegate* infoBarModel = delegate->AsConfirmInfoBarDelegate(); 53 ConfirmInfoBarDelegate* infoBarModel = delegate->AsConfirmInfoBarDelegate();
54 DCHECK(!infoBarView_); 54 DCHECK(!infoBarView_);
55 infoBarView_.reset([ios::GetChromeBrowserProvider()->CreateInfoBarView() 55 infoBarView_.reset([ios::GetChromeBrowserProvider()->CreateInfoBarView()
56 initWithFrame:frame 56 initWithFrame:frame
57 delegate:delegate_ 57 delegate:delegate_]);
58 isWarning:infoBarModel->GetInfoBarType() ==
59 infobars::InfoBarDelegate::WARNING_TYPE]);
60 58
61 // Model data. 59 // Model data.
62 NSString* modelMsg = nil; 60 NSString* modelMsg = nil;
63 if (infoBarModel->GetMessageText().length()) 61 if (infoBarModel->GetMessageText().length())
64 modelMsg = base::SysUTF16ToNSString(infoBarModel->GetMessageText()); 62 modelMsg = base::SysUTF16ToNSString(infoBarModel->GetMessageText());
65 gfx::Image modelIcon = infoBarModel->GetIcon(); 63 gfx::Image modelIcon = infoBarModel->GetIcon();
66 int buttons = infoBarModel->GetButtons(); 64 int buttons = infoBarModel->GetButtons();
67 NSString* buttonOK = nil; 65 NSString* buttonOK = nil;
68 if (buttons & ConfirmInfoBarDelegate::BUTTON_OK) { 66 if (buttons & ConfirmInfoBarDelegate::BUTTON_OK) {
69 buttonOK = base::SysUTF16ToNSString( 67 buttonOK = base::SysUTF16ToNSString(
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 if ([sender isKindOfClass:[UIButton class]]) { 115 if ([sender isKindOfClass:[UIButton class]]) {
118 NSUInteger tag = static_cast<UIButton*>(sender).tag; 116 NSUInteger tag = static_cast<UIButton*>(sender).tag;
119 if (tag == ConfirmInfoBarUITags::CLOSE) 117 if (tag == ConfirmInfoBarUITags::CLOSE)
120 delegate_->InfoBarDidCancel(); 118 delegate_->InfoBarDidCancel();
121 else 119 else
122 delegate_->InfoBarButtonDidPress(UITagToButton(tag)); 120 delegate_->InfoBarButtonDidPress(UITagToButton(tag));
123 } 121 }
124 } 122 }
125 123
126 @end 124 @end
OLDNEW
« no previous file with comments | « no previous file | ios/chrome/browser/translate/after_translate_infobar_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698