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

Side by Side Diff: chrome/browser/ui/views/global_error_bubble_view.cc

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: no defaults Created 7 years, 6 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 #include "chrome/browser/ui/views/global_error_bubble_view.h" 5 #include "chrome/browser/ui/views/global_error_bubble_view.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/ui/global_error/global_error.h" 8 #include "chrome/browser/ui/global_error/global_error.h"
9 #include "chrome/browser/ui/global_error/global_error_service.h" 9 #include "chrome/browser/ui/global_error/global_error_service.h"
10 #include "chrome/browser/ui/global_error/global_error_service_factory.h" 10 #include "chrome/browser/ui/global_error/global_error_service_factory.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 Browser* browser, 63 Browser* browser,
64 const base::WeakPtr<GlobalError>& error) 64 const base::WeakPtr<GlobalError>& error)
65 : BubbleDelegateView(anchor_view, arrow), 65 : BubbleDelegateView(anchor_view, arrow),
66 browser_(browser), 66 browser_(browser),
67 error_(error) { 67 error_(error) {
68 // Compensate for built-in vertical padding in the anchor view's image. 68 // Compensate for built-in vertical padding in the anchor view's image.
69 set_anchor_view_insets( 69 set_anchor_view_insets(
70 gfx::Insets(kAnchorVerticalInset, 0, kAnchorVerticalInset, 0)); 70 gfx::Insets(kAnchorVerticalInset, 0, kAnchorVerticalInset, 0));
71 71
72 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 72 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
73 int resource_id = error_->GetBubbleViewIconResourceID(); 73 gfx::Image image = error_->GetBubbleViewIcon();
74 CHECK(!image.IsEmpty());
74 scoped_ptr<views::ImageView> image_view(new views::ImageView()); 75 scoped_ptr<views::ImageView> image_view(new views::ImageView());
75 image_view->SetImage(rb.GetImageNamed(resource_id).ToImageSkia()); 76 image_view->SetImage(image.ToImageSkia());
76 77
77 string16 title_string(error_->GetBubbleViewTitle()); 78 string16 title_string(error_->GetBubbleViewTitle());
78 scoped_ptr<views::Label> title_label(new views::Label(title_string)); 79 scoped_ptr<views::Label> title_label(new views::Label(title_string));
79 title_label->SetMultiLine(true); 80 title_label->SetMultiLine(true);
80 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 81 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
81 title_label->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont)); 82 title_label->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont));
82 83
83 std::vector<string16> message_strings(error_->GetBubbleViewMessages()); 84 std::vector<string16> message_strings(error_->GetBubbleViewMessages());
84 std::vector<views::Label*> message_labels; 85 std::vector<views::Label*> message_labels;
85 for (size_t i = 0; i < message_strings.size(); ++i) { 86 for (size_t i = 0; i < message_strings.size(); ++i) {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 } 175 }
175 176
176 void GlobalErrorBubbleView::WindowClosing() { 177 void GlobalErrorBubbleView::WindowClosing() {
177 if (error_) 178 if (error_)
178 error_->BubbleViewDidClose(browser_); 179 error_->BubbleViewDidClose(browser_);
179 } 180 }
180 181
181 void GlobalErrorBubbleView::CloseBubbleView() { 182 void GlobalErrorBubbleView::CloseBubbleView() {
182 GetWidget()->Close(); 183 GetWidget()->Close();
183 } 184 }
OLDNEW
« chrome/browser/ui/global_error/global_error.h ('K') | « chrome/browser/ui/gtk/global_error_bubble.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698