OLD | NEW |
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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 157 |
158 // TODO(gbillock): Would be nice to just use stock LabelButton stuff here. | 158 // TODO(gbillock): Would be nice to just use stock LabelButton stuff here. |
159 location_icon_view_ = new LocationIconView(location_bar_view_); | 159 location_icon_view_ = new LocationIconView(location_bar_view_); |
160 // Make location icon hover events count as hovering the origin chip. | 160 // Make location icon hover events count as hovering the origin chip. |
161 location_icon_view_->set_interactive(false); | 161 location_icon_view_->set_interactive(false); |
162 location_icon_view_->ShowTooltip(true); | 162 location_icon_view_->ShowTooltip(true); |
163 AddChildView(location_icon_view_); | 163 AddChildView(location_icon_view_); |
164 | 164 |
165 ev_label_ = new views::Label(base::string16(), GetFontList()); | 165 ev_label_ = new views::Label(base::string16(), GetFontList()); |
166 ev_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 166 ev_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
167 ev_label_->SetElideBehavior(views::Label::NO_ELIDE); | 167 ev_label_->SetElideBehavior(gfx::TRUNCATE); |
168 AddChildView(ev_label_); | 168 AddChildView(ev_label_); |
169 | 169 |
170 host_label_ = new views::Label(base::string16(), GetFontList()); | 170 host_label_ = new views::Label(base::string16(), GetFontList()); |
171 host_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 171 host_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
172 host_label_->SetElideBehavior(views::Label::NO_ELIDE); | 172 host_label_->SetElideBehavior(gfx::TRUNCATE); |
173 AddChildView(host_label_); | 173 AddChildView(host_label_); |
174 | 174 |
175 fade_in_animation_.SetTweenType(gfx::Tween::LINEAR_OUT_SLOW_IN); | 175 fade_in_animation_.SetTweenType(gfx::Tween::LINEAR_OUT_SLOW_IN); |
176 fade_in_animation_.SetSlideDuration(175); | 176 fade_in_animation_.SetSlideDuration(175); |
177 } | 177 } |
178 | 178 |
179 OriginChipView::~OriginChipView() { | 179 OriginChipView::~OriginChipView() { |
180 scoped_refptr<SafeBrowsingService> sb_service = | 180 scoped_refptr<SafeBrowsingService> sb_service = |
181 g_browser_process->safe_browsing_service(); | 181 g_browser_process->safe_browsing_service(); |
182 if (sb_service.get() && sb_service->ui_manager()) | 182 if (sb_service.get() && sb_service->ui_manager()) |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 | 401 |
402 // Note: When OnSafeBrowsingHit would be called, OnSafeBrowsingMatch will | 402 // Note: When OnSafeBrowsingHit would be called, OnSafeBrowsingMatch will |
403 // have already been called. | 403 // have already been called. |
404 void OriginChipView::OnSafeBrowsingHit( | 404 void OriginChipView::OnSafeBrowsingHit( |
405 const SafeBrowsingUIManager::UnsafeResource& resource) {} | 405 const SafeBrowsingUIManager::UnsafeResource& resource) {} |
406 | 406 |
407 void OriginChipView::OnSafeBrowsingMatch( | 407 void OriginChipView::OnSafeBrowsingMatch( |
408 const SafeBrowsingUIManager::UnsafeResource& resource) { | 408 const SafeBrowsingUIManager::UnsafeResource& resource) { |
409 OnChanged(); | 409 OnChanged(); |
410 } | 410 } |
OLD | NEW |