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

Side by Side Diff: chrome/browser/ui/views/location_bar/origin_chip_view.cc

Issue 345183005: Ensure all members of OriginChipInfo/OriginChipView get initialized. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reupload Created 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/location_bar/origin_chip_view.h" 5 #include "chrome/browser/ui/views/location_bar/origin_chip_view.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 137
138 } // namespace 138 } // namespace
139 139
140 OriginChipView::OriginChipView(LocationBarView* location_bar_view, 140 OriginChipView::OriginChipView(LocationBarView* location_bar_view,
141 Profile* profile, 141 Profile* profile,
142 const gfx::FontList& font_list) 142 const gfx::FontList& font_list)
143 : LabelButton(this, base::string16()), 143 : LabelButton(this, base::string16()),
144 location_bar_view_(location_bar_view), 144 location_bar_view_(location_bar_view),
145 profile_(profile), 145 profile_(profile),
146 showing_16x16_icon_(false), 146 showing_16x16_icon_(false),
147 fade_in_animation_(this) { 147 fade_in_animation_(this),
148 security_level_(ToolbarModel::NONE),
149 url_malware_(false) {
148 EnableCanvasFlippingForRTLUI(true); 150 EnableCanvasFlippingForRTLUI(true);
149 151
150 scoped_refptr<SafeBrowsingService> sb_service = 152 scoped_refptr<SafeBrowsingService> sb_service =
151 g_browser_process->safe_browsing_service(); 153 g_browser_process->safe_browsing_service();
152 // May not be set for unit tests. 154 // May not be set for unit tests.
153 if (sb_service && sb_service->ui_manager()) 155 if (sb_service && sb_service->ui_manager())
154 sb_service->ui_manager()->AddObserver(this); 156 sb_service->ui_manager()->AddObserver(this);
155 157
156 SetFontList(font_list); 158 SetFontList(font_list);
157 159
158 // TODO(gbillock): Would be nice to just use stock LabelButton stuff here. 160 // TODO(gbillock): Would be nice to just use stock LabelButton stuff here.
159 location_icon_view_ = new LocationIconView(location_bar_view_); 161 location_icon_view_ = new LocationIconView(location_bar_view_);
160 // Make location icon hover events count as hovering the origin chip. 162 // Make location icon hover events count as hovering the origin chip.
161 location_icon_view_->set_interactive(false); 163 location_icon_view_->set_interactive(false);
162 location_icon_view_->ShowTooltip(true); 164 location_icon_view_->ShowTooltip(true);
163 AddChildView(location_icon_view_); 165 AddChildView(location_icon_view_);
164 166
165 ev_label_ = new views::Label(base::string16(), GetFontList()); 167 ev_label_ = new views::Label(base::string16(), GetFontList());
166 ev_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 168 ev_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
167 ev_label_->SetElideBehavior(gfx::TRUNCATE); 169 ev_label_->SetElideBehavior(gfx::TRUNCATE);
168 AddChildView(ev_label_); 170 AddChildView(ev_label_);
169 171
170 host_label_ = new views::Label(base::string16(), GetFontList()); 172 host_label_ = new views::Label(base::string16(), GetFontList());
171 host_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 173 host_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
172 host_label_->SetElideBehavior(gfx::TRUNCATE); 174 host_label_->SetElideBehavior(gfx::TRUNCATE);
173 AddChildView(host_label_); 175 AddChildView(host_label_);
174 176
175 fade_in_animation_.SetTweenType(gfx::Tween::LINEAR_OUT_SLOW_IN); 177 fade_in_animation_.SetTweenType(gfx::Tween::LINEAR_OUT_SLOW_IN);
176 fade_in_animation_.SetSlideDuration(175); 178 fade_in_animation_.SetSlideDuration(175);
179
180 // Ensure various other members get initialized.
181 SetBorderImages(kNormalImages);
177 } 182 }
178 183
179 OriginChipView::~OriginChipView() { 184 OriginChipView::~OriginChipView() {
180 scoped_refptr<SafeBrowsingService> sb_service = 185 scoped_refptr<SafeBrowsingService> sb_service =
181 g_browser_process->safe_browsing_service(); 186 g_browser_process->safe_browsing_service();
182 if (sb_service.get() && sb_service->ui_manager()) 187 if (sb_service.get() && sb_service->ui_manager())
183 sb_service->ui_manager()->RemoveObserver(this); 188 sb_service->ui_manager()->RemoveObserver(this);
184 } 189 }
185 190
186 void OriginChipView::OnChanged() { 191 void OriginChipView::OnChanged() {
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 406
402 // Note: When OnSafeBrowsingHit would be called, OnSafeBrowsingMatch will 407 // Note: When OnSafeBrowsingHit would be called, OnSafeBrowsingMatch will
403 // have already been called. 408 // have already been called.
404 void OriginChipView::OnSafeBrowsingHit( 409 void OriginChipView::OnSafeBrowsingHit(
405 const SafeBrowsingUIManager::UnsafeResource& resource) {} 410 const SafeBrowsingUIManager::UnsafeResource& resource) {}
406 411
407 void OriginChipView::OnSafeBrowsingMatch( 412 void OriginChipView::OnSafeBrowsingMatch(
408 const SafeBrowsingUIManager::UnsafeResource& resource) { 413 const SafeBrowsingUIManager::UnsafeResource& resource) {
409 OnChanged(); 414 OnChanged();
410 } 415 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/origin_chip_info.cc ('k') | tools/valgrind/drmemory/suppressions_full.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698