| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/ui/cocoa/global_error_bubble_controller.h" | 5 #import "chrome/browser/ui/cocoa/global_error_bubble_controller.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 [super awakeFromNib]; | 75 [super awakeFromNib]; |
| 76 | 76 |
| 77 DCHECK(error_); | 77 DCHECK(error_); |
| 78 | 78 |
| 79 gfx::Image image = error_->GetBubbleViewIcon(); | 79 gfx::Image image = error_->GetBubbleViewIcon(); |
| 80 DCHECK(!image.IsEmpty()); | 80 DCHECK(!image.IsEmpty()); |
| 81 [iconView_ setImage:image.ToNSImage()]; | 81 [iconView_ setImage:image.ToNSImage()]; |
| 82 | 82 |
| 83 [title_ setStringValue:SysUTF16ToNSString(error_->GetBubbleViewTitle())]; | 83 [title_ setStringValue:SysUTF16ToNSString(error_->GetBubbleViewTitle())]; |
| 84 std::vector<base::string16> messages = error_->GetBubbleViewMessages(); | 84 std::vector<base::string16> messages = error_->GetBubbleViewMessages(); |
| 85 base::string16 message = base::JoinString(messages, base::ASCIIToUTF16("\n")); | 85 base::string16 message = JoinString(messages, '\n'); |
| 86 | 86 |
| 87 base::scoped_nsobject<NSMutableAttributedString> messageValue( | 87 base::scoped_nsobject<NSMutableAttributedString> messageValue( |
| 88 [[NSMutableAttributedString alloc] | 88 [[NSMutableAttributedString alloc] |
| 89 initWithString:SysUTF16ToNSString(message)]); | 89 initWithString:SysUTF16ToNSString(message)]); |
| 90 base::scoped_nsobject<NSMutableParagraphStyle> style( | 90 base::scoped_nsobject<NSMutableParagraphStyle> style( |
| 91 [[NSMutableParagraphStyle alloc] init]); | 91 [[NSMutableParagraphStyle alloc] init]); |
| 92 [style setParagraphSpacing:kParagraphSpacing]; | 92 [style setParagraphSpacing:kParagraphSpacing]; |
| 93 [messageValue addAttribute:NSParagraphStyleAttributeName | 93 [messageValue addAttribute:NSParagraphStyleAttributeName |
| 94 value:style | 94 value:style |
| 95 range:NSMakeRange(0, [messageValue length])]; | 95 range:NSMakeRange(0, [messageValue length])]; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 [self close]; | 153 [self close]; |
| 154 } | 154 } |
| 155 | 155 |
| 156 @end | 156 @end |
| 157 | 157 |
| 158 GlobalErrorBubbleViewBase* GlobalErrorBubbleViewBase::ShowStandardBubbleView( | 158 GlobalErrorBubbleViewBase* GlobalErrorBubbleViewBase::ShowStandardBubbleView( |
| 159 Browser* browser, | 159 Browser* browser, |
| 160 const base::WeakPtr<GlobalErrorWithStandardBubble>& error) { | 160 const base::WeakPtr<GlobalErrorWithStandardBubble>& error) { |
| 161 return [GlobalErrorBubbleController showForBrowser:browser error:error]; | 161 return [GlobalErrorBubbleController showForBrowser:browser error:error]; |
| 162 } | 162 } |
| OLD | NEW |