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

Unified Diff: chrome/browser/views/page_info_window_view.cc

Issue 3560004: Refactor the code for loading icons into the PageInfoModel. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: cleanup Created 10 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/views/page_info_bubble_view.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/page_info_window_view.cc
diff --git a/chrome/browser/views/page_info_window_view.cc b/chrome/browser/views/page_info_window_view.cc
index aa833abeea688b67b14331adfd0f8ab7d0f33aa1..4e6057bce42cdd3892b1bb5d250b46501b98611e 100644
--- a/chrome/browser/views/page_info_window_view.cc
+++ b/chrome/browser/views/page_info_window_view.cc
@@ -4,7 +4,6 @@
#include "build/build_config.h"
-#include "app/resource_bundle.h"
#include "app/l10n_util.h"
#include "base/compiler_specific.h"
#include "base/utf_string_conversions.h"
@@ -15,7 +14,6 @@
#include "chrome/common/pref_names.h"
#include "grit/locale_settings.h"
#include "grit/generated_resources.h"
-#include "grit/theme_resources.h"
#include "net/base/x509_certificate.h"
#include "views/background.h"
#include "views/grid_layout.h"
@@ -108,9 +106,9 @@ class PageInfoWindowView : public views::View,
class Section : public views::View {
public:
Section(const string16& title,
- bool state,
const string16& head_line,
- const string16& description);
+ const string16& description,
+ const SkBitmap* icon);
virtual ~Section();
virtual int GetHeightForWidth(int w);
@@ -120,18 +118,12 @@ class Section : public views::View {
// The text placed on top of the section (on the left of the separator bar).
string16 title_;
- // Whether to show the good/bad icon.
- bool state_;
-
// The first line of the description, show in bold.
string16 head_line_;
// The description, displayed below the head line.
string16 description_;
- static SkBitmap* good_state_icon_;
- static SkBitmap* bad_state_icon_;
-
views::Label* title_label_;
views::Separator* separator_;
views::ImageView* status_image_;
@@ -142,8 +134,6 @@ class Section : public views::View {
};
// static
-SkBitmap* Section::good_state_icon_ = NULL;
-SkBitmap* Section::bad_state_icon_ = NULL;
int PageInfoWindowView::opened_window_count_ = 0;
} // namespace
@@ -217,9 +207,8 @@ void PageInfoWindowView::LayoutSections() {
for (int i = 0; i < model_.GetSectionCount(); ++i) {
PageInfoModel::SectionInfo info = model_.GetSectionInfo(i);
layout->StartRow(0, 0);
- layout->AddView(new Section(
- info.title, info.state == PageInfoModel::SECTION_STATE_OK,
- info.headline, info.description));
+ layout->AddView(new Section(info.title, info.headline, info.description,
+ model_.GetIconImage(info.icon_id)));
layout->AddPaddingRow(0, kVerticalPadding);
}
layout->AddPaddingRow(1, kVerticalPadding);
@@ -334,20 +323,12 @@ void PageInfoWindowView::ShowCertDialog(int cert_id) {
// Section
Section::Section(const string16& title,
- bool state,
const string16& head_line,
- const string16& description)
+ const string16& description,
+ const SkBitmap* icon)
: title_(title),
- state_(state),
head_line_(head_line),
description_(description) {
- if (!good_state_icon_) {
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- good_state_icon_ = rb.GetBitmapNamed(IDR_PAGEINFO_GOOD);
- // The exclamation point has been re-purposed as a warning
- // signal in the new code.
- bad_state_icon_ = rb.GetBitmapNamed(IDR_PAGEINFO_WARNING_MAJOR);
- }
title_label_ = new views::Label(UTF16ToWideHack(title));
title_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
AddChildView(title_label_);
@@ -360,7 +341,7 @@ Section::Section(const string16& title,
#endif
status_image_ = new views::ImageView();
- status_image_->SetImage(state ? good_state_icon_ : bad_state_icon_);
+ status_image_->SetImage(*icon);
AddChildView(status_image_);
head_line_label_ = new views::Label(UTF16ToWideHack(head_line));
« no previous file with comments | « chrome/browser/views/page_info_bubble_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698