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

Side by Side Diff: chrome/browser/ui/cocoa/global_error_bubble_controller.mm

Issue 14262009: Add support for multi-line GlobalError messages to Views. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
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/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/search_engines/util.h" 10 #include "chrome/browser/search_engines/util.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 - (void)awakeFromNib { 77 - (void)awakeFromNib {
78 [super awakeFromNib]; 78 [super awakeFromNib];
79 79
80 DCHECK(error_); 80 DCHECK(error_);
81 81
82 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 82 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
83 [iconView_ setImage:rb.GetNativeImageNamed( 83 [iconView_ setImage:rb.GetNativeImageNamed(
84 error_->GetBubbleViewIconResourceID()).ToNSImage()]; 84 error_->GetBubbleViewIconResourceID()).ToNSImage()];
85 85
86 [title_ setStringValue:SysUTF16ToNSString(error_->GetBubbleViewTitle())]; 86 [title_ setStringValue:SysUTF16ToNSString(error_->GetBubbleViewTitle())];
87 [message_ setStringValue:SysUTF16ToNSString(error_->GetBubbleViewMessage())]; 87 // TODO(yoz): Support multi-line messages.
88 string16 message;
89 if (!error_->GetBubbleViewMessages().empty())
90 message = error_->GetBubbleViewMessages()[0];
91 [message_ setStringValue:SysUTF16ToNSString(message)];
88 [acceptButton_ setTitle: 92 [acceptButton_ setTitle:
89 SysUTF16ToNSString(error_->GetBubbleViewAcceptButtonLabel())]; 93 SysUTF16ToNSString(error_->GetBubbleViewAcceptButtonLabel())];
90 string16 cancelLabel = error_->GetBubbleViewCancelButtonLabel(); 94 string16 cancelLabel = error_->GetBubbleViewCancelButtonLabel();
91 if (cancelLabel.empty()) 95 if (cancelLabel.empty())
92 [cancelButton_ setHidden:YES]; 96 [cancelButton_ setHidden:YES];
93 else 97 else
94 [cancelButton_ setTitle:SysUTF16ToNSString(cancelLabel)]; 98 [cancelButton_ setTitle:SysUTF16ToNSString(cancelLabel)];
95 99
96 // First make sure that the window is wide enough to accomidate the buttons. 100 // First make sure that the window is wide enough to accomidate the buttons.
97 NSRect frame = [[self window] frame]; 101 NSRect frame = [[self window] frame];
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 [self close]; 146 [self close];
143 } 147 }
144 148
145 @end 149 @end
146 150
147 GlobalErrorBubbleViewBase* GlobalErrorBubbleViewBase::ShowBubbleView( 151 GlobalErrorBubbleViewBase* GlobalErrorBubbleViewBase::ShowBubbleView(
148 Browser* browser, 152 Browser* browser,
149 const base::WeakPtr<GlobalError>& error) { 153 const base::WeakPtr<GlobalError>& error) {
150 return [GlobalErrorBubbleController showForBrowser:browser error:error]; 154 return [GlobalErrorBubbleController showForBrowser:browser error:error];
151 } 155 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698