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/toolbar/toolbar_origin_chip_view.h" | 5 #include "chrome/browser/ui/views/toolbar/toolbar_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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 } | 256 } |
257 | 257 |
258 void ToolbarOriginChipView::OnChanged() { | 258 void ToolbarOriginChipView::OnChanged() { |
259 Update(toolbar_view_->GetWebContents()); | 259 Update(toolbar_view_->GetWebContents()); |
260 toolbar_view_->Layout(); | 260 toolbar_view_->Layout(); |
261 toolbar_view_->SchedulePaint(); | 261 toolbar_view_->SchedulePaint(); |
262 // TODO(gbillock): Also need to potentially repaint infobars to make sure the | 262 // TODO(gbillock): Also need to potentially repaint infobars to make sure the |
263 // arrows are pointing to the right spot. Only needed for some edge cases. | 263 // arrows are pointing to the right spot. Only needed for some edge cases. |
264 } | 264 } |
265 | 265 |
266 gfx::Size ToolbarOriginChipView::GetPreferredSize() { | 266 gfx::Size ToolbarOriginChipView::GetPreferredSize() const { |
267 gfx::Size label_size = host_label_->GetPreferredSize(); | 267 gfx::Size label_size = host_label_->GetPreferredSize(); |
268 gfx::Size icon_size = location_icon_view_->GetPreferredSize(); | 268 gfx::Size icon_size = location_icon_view_->GetPreferredSize(); |
269 int icon_spacing = showing_16x16_icon_ ? | 269 int icon_spacing = showing_16x16_icon_ ? |
270 (k16x16IconLeadingSpacing + k16x16IconTrailingSpacing) : 0; | 270 (k16x16IconLeadingSpacing + k16x16IconTrailingSpacing) : 0; |
271 return gfx::Size(kEdgeThickness + icon_size.width() + icon_spacing + | 271 return gfx::Size(kEdgeThickness + icon_size.width() + icon_spacing + |
272 kIconTextSpacing + label_size.width() + | 272 kIconTextSpacing + label_size.width() + |
273 kTrailingLabelMargin + kEdgeThickness, | 273 kTrailingLabelMargin + kEdgeThickness, |
274 icon_size.height()); | 274 icon_size.height()); |
275 } | 275 } |
276 | 276 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 | 374 |
375 // Note: When OnSafeBrowsingHit would be called, OnSafeBrowsingMatch will | 375 // Note: When OnSafeBrowsingHit would be called, OnSafeBrowsingMatch will |
376 // have already been called. | 376 // have already been called. |
377 void ToolbarOriginChipView::OnSafeBrowsingHit( | 377 void ToolbarOriginChipView::OnSafeBrowsingHit( |
378 const SafeBrowsingUIManager::UnsafeResource& resource) {} | 378 const SafeBrowsingUIManager::UnsafeResource& resource) {} |
379 | 379 |
380 void ToolbarOriginChipView::OnSafeBrowsingMatch( | 380 void ToolbarOriginChipView::OnSafeBrowsingMatch( |
381 const SafeBrowsingUIManager::UnsafeResource& resource) { | 381 const SafeBrowsingUIManager::UnsafeResource& resource) { |
382 OnChanged(); | 382 OnChanged(); |
383 } | 383 } |
OLD | NEW |