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

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

Issue 15745022: Add custom icon support to GlobalError. Show extension icon in permissions increase bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: safety third Created 7 years, 7 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/memory/scoped_nsobject.h" 8 #include "base/memory/scoped_nsobject.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 [bubble showWindow:nil]; 76 [bubble showWindow:nil];
77 77
78 return bubble->bridge_.get(); 78 return bubble->bridge_.get();
79 } 79 }
80 80
81 - (void)awakeFromNib { 81 - (void)awakeFromNib {
82 [super awakeFromNib]; 82 [super awakeFromNib];
83 83
84 DCHECK(error_); 84 DCHECK(error_);
85 85
86 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 86 gfx::Image* image = error_->GetBubbleViewCustomIcon();
87 [iconView_ setImage:rb.GetNativeImageNamed( 87 if (!image) {
88 error_->GetBubbleViewIconResourceID()).ToNSImage()]; 88 int resource_id = error_->GetBubbleViewIconResourceID();
89 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
90 image = &rb.GetNativeImageNamed(resource_id);
91 }
92 [iconView_ setImage:image->ToNSImage()];
89 93
90 [title_ setStringValue:SysUTF16ToNSString(error_->GetBubbleViewTitle())]; 94 [title_ setStringValue:SysUTF16ToNSString(error_->GetBubbleViewTitle())];
91 std::vector<string16> messages = error_->GetBubbleViewMessages(); 95 std::vector<string16> messages = error_->GetBubbleViewMessages();
92 string16 message = JoinString(messages, '\n'); 96 string16 message = JoinString(messages, '\n');
93 97
94 scoped_nsobject<NSMutableAttributedString> messageValue( 98 scoped_nsobject<NSMutableAttributedString> messageValue(
95 [[NSMutableAttributedString alloc] 99 [[NSMutableAttributedString alloc]
96 initWithString:SysUTF16ToNSString(message)]); 100 initWithString:SysUTF16ToNSString(message)]);
97 scoped_nsobject<NSMutableParagraphStyle> style( 101 scoped_nsobject<NSMutableParagraphStyle> style(
98 [[NSMutableParagraphStyle alloc] init]); 102 [[NSMutableParagraphStyle alloc] init]);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 [self close]; 164 [self close];
161 } 165 }
162 166
163 @end 167 @end
164 168
165 GlobalErrorBubbleViewBase* GlobalErrorBubbleViewBase::ShowBubbleView( 169 GlobalErrorBubbleViewBase* GlobalErrorBubbleViewBase::ShowBubbleView(
166 Browser* browser, 170 Browser* browser,
167 const base::WeakPtr<GlobalError>& error) { 171 const base::WeakPtr<GlobalError>& error) {
168 return [GlobalErrorBubbleController showForBrowser:browser error:error]; 172 return [GlobalErrorBubbleController showForBrowser:browser error:error];
169 } 173 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698