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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 host_label_->SetText(ElideHost( | 265 host_label_->SetText(ElideHost( |
266 location_bar_view_->GetToolbarModel()->GetURL(), | 266 location_bar_view_->GetToolbarModel()->GetURL(), |
267 host_label_->font_list(), target_max_width - padding_width)); | 267 host_label_->font_list(), target_max_width - padding_width)); |
268 return GetPreferredSize().width(); | 268 return GetPreferredSize().width(); |
269 } | 269 } |
270 | 270 |
271 void OriginChipView::FadeIn() { | 271 void OriginChipView::FadeIn() { |
272 fade_in_animation_->Show(); | 272 fade_in_animation_->Show(); |
273 } | 273 } |
274 | 274 |
275 gfx::Size OriginChipView::GetPreferredSize() { | 275 gfx::Size OriginChipView::GetPreferredSize() const { |
276 gfx::Size label_size = host_label_->GetPreferredSize(); | 276 gfx::Size label_size = host_label_->GetPreferredSize(); |
277 gfx::Size icon_size = location_icon_view_->GetPreferredSize(); | 277 gfx::Size icon_size = location_icon_view_->GetPreferredSize(); |
278 int icon_spacing = showing_16x16_icon_ ? | 278 int icon_spacing = showing_16x16_icon_ ? |
279 (k16x16IconLeadingSpacing + k16x16IconTrailingSpacing) : 0; | 279 (k16x16IconLeadingSpacing + k16x16IconTrailingSpacing) : 0; |
280 return gfx::Size(kEdgeThickness + icon_size.width() + icon_spacing + | 280 return gfx::Size(kEdgeThickness + icon_size.width() + icon_spacing + |
281 kIconTextSpacing + label_size.width() + | 281 kIconTextSpacing + label_size.width() + |
282 kTrailingLabelMargin + kEdgeThickness, | 282 kTrailingLabelMargin + kEdgeThickness, |
283 icon_size.height()); | 283 icon_size.height()); |
284 } | 284 } |
285 | 285 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 | 381 |
382 // Note: When OnSafeBrowsingHit would be called, OnSafeBrowsingMatch will | 382 // Note: When OnSafeBrowsingHit would be called, OnSafeBrowsingMatch will |
383 // have already been called. | 383 // have already been called. |
384 void OriginChipView::OnSafeBrowsingHit( | 384 void OriginChipView::OnSafeBrowsingHit( |
385 const SafeBrowsingUIManager::UnsafeResource& resource) {} | 385 const SafeBrowsingUIManager::UnsafeResource& resource) {} |
386 | 386 |
387 void OriginChipView::OnSafeBrowsingMatch( | 387 void OriginChipView::OnSafeBrowsingMatch( |
388 const SafeBrowsingUIManager::UnsafeResource& resource) { | 388 const SafeBrowsingUIManager::UnsafeResource& resource) { |
389 OnChanged(); | 389 OnChanged(); |
390 } | 390 } |
OLD | NEW |