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

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

Issue 10382144: Change SetImage, SetBackground, and SetToggledImage to take in a gfx::ImageSkia (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 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 #include "chrome/browser/ui/views/confirm_bubble_view.h" 5 #include "chrome/browser/ui/views/confirm_bubble_view.h"
6 6
7 #include "chrome/browser/ui/confirm_bubble_model.h" 7 #include "chrome/browser/ui/confirm_bubble_model.h"
8 #include "grit/theme_resources.h" 8 #include "grit/theme_resources.h"
9 #include "ui/base/resource/resource_bundle.h" 9 #include "ui/base/resource/resource_bundle.h"
10 #include "ui/gfx/image/image.h" 10 #include "ui/gfx/image/image.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 cs->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER, 0, 73 cs->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER, 0,
74 views::GridLayout::USE_PREF, 0, 0); 74 views::GridLayout::USE_PREF, 0, 0);
75 cs->AddPaddingColumn(1, views::kRelatedControlHorizontalSpacing); 75 cs->AddPaddingColumn(1, views::kRelatedControlHorizontalSpacing);
76 cs->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER, 0, 76 cs->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER, 0,
77 views::GridLayout::USE_PREF, 0, 0); 77 views::GridLayout::USE_PREF, 0, 0);
78 78
79 layout->StartRow(0, 0); 79 layout->StartRow(0, 0);
80 gfx::Image* icon_image = model_->GetIcon(); 80 gfx::Image* icon_image = model_->GetIcon();
81 DCHECK(icon_image); 81 DCHECK(icon_image);
82 views::ImageView* icon_view = new views::ImageView; 82 views::ImageView* icon_view = new views::ImageView;
83 icon_view->SetImage(icon_image->ToSkBitmap()); 83 icon_view->SetImage(icon_image->ToImageSkia());
84 layout->AddView(icon_view); 84 layout->AddView(icon_view);
85 85
86 const string16 title_text = model_->GetTitle(); 86 const string16 title_text = model_->GetTitle();
87 DCHECK(!title_text.empty()); 87 DCHECK(!title_text.empty());
88 views::Label* title_label = new views::Label(title_text); 88 views::Label* title_label = new views::Label(title_text);
89 title_label->SetFont(bundle.GetFont(ui::ResourceBundle::MediumFont)); 89 title_label->SetFont(bundle.GetFont(ui::ResourceBundle::MediumFont));
90 layout->AddView(title_label); 90 layout->AddView(title_label);
91 91
92 views::ImageButton* close_button = new views::ImageButton(this); 92 views::ImageButton* close_button = new views::ImageButton(this);
93 const SkBitmap* close_image = 93 const gfx::ImageSkia* close_image =
94 bundle.GetImageNamed(IDR_INFO_BUBBLE_CLOSE).ToSkBitmap(); 94 bundle.GetImageNamed(IDR_INFO_BUBBLE_CLOSE).ToImageSkia();
95 close_button->SetImage(views::CustomButton::BS_NORMAL, close_image); 95 close_button->SetImage(views::CustomButton::BS_NORMAL, close_image);
96 close_button->set_tag(ConfirmBubbleModel::BUTTON_NONE); 96 close_button->set_tag(ConfirmBubbleModel::BUTTON_NONE);
97 layout->AddView(close_button); 97 layout->AddView(close_button);
98 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 98 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
99 99
100 // Add the message label to the second row. 100 // Add the message label to the second row.
101 cs = layout->AddColumnSet(1); 101 cs = layout->AddColumnSet(1);
102 const string16 message_text = model_->GetMessageText(); 102 const string16 message_text = model_->GetMessageText();
103 DCHECK(!message_text.empty()); 103 DCHECK(!message_text.empty());
104 views::Label* message_label = new views::Label(message_text); 104 views::Label* message_label = new views::Label(message_text);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 layout->AddView(ok_button); 149 layout->AddView(ok_button);
150 } 150 }
151 if (has_cancel_button) { 151 if (has_cancel_button) {
152 views::TextButton* cancel_button = new views::NativeTextButton( 152 views::TextButton* cancel_button = new views::NativeTextButton(
153 this, model_->GetButtonLabel(ConfirmBubbleModel::BUTTON_CANCEL)); 153 this, model_->GetButtonLabel(ConfirmBubbleModel::BUTTON_CANCEL));
154 cancel_button->set_tag(ConfirmBubbleModel::BUTTON_CANCEL); 154 cancel_button->set_tag(ConfirmBubbleModel::BUTTON_CANCEL);
155 layout->AddView(cancel_button); 155 layout->AddView(cancel_button);
156 } 156 }
157 } 157 }
158 } 158 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/collected_cookies_views.cc ('k') | chrome/browser/ui/views/constrained_window_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698