| 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 | 363 |
| 364 // TODO(gbillock): Make the LocationBarView or OmniboxView the listener for | 364 // TODO(gbillock): Make the LocationBarView or OmniboxView the listener for |
| 365 // this button. | 365 // this button. |
| 366 void OriginChipView::ButtonPressed(views::Button* sender, | 366 void OriginChipView::ButtonPressed(views::Button* sender, |
| 367 const ui::Event& event) { | 367 const ui::Event& event) { |
| 368 // See if the event needs to be passed to the LocationIconView. | 368 // See if the event needs to be passed to the LocationIconView. |
| 369 if (event.IsMouseEvent() || (event.type() == ui::ET_GESTURE_TAP)) { | 369 if (event.IsMouseEvent() || (event.type() == ui::ET_GESTURE_TAP)) { |
| 370 location_icon_view_->set_interactive(true); | 370 location_icon_view_->set_interactive(true); |
| 371 const ui::LocatedEvent& located_event = | 371 const ui::LocatedEvent& located_event = |
| 372 static_cast<const ui::LocatedEvent&>(event); | 372 static_cast<const ui::LocatedEvent&>(event); |
| 373 if (GetEventHandlerForPoint(located_event.location()) == | 373 if (GetEventHandlerForPoint(gfx::ToFlooredPoint( |
| 374 location_icon_view_) { | 374 located_event.location())) == location_icon_view_) { |
| 375 location_icon_view_->page_info_helper()->ProcessEvent(located_event); | 375 location_icon_view_->page_info_helper()->ProcessEvent(located_event); |
| 376 location_icon_view_->set_interactive(false); | 376 location_icon_view_->set_interactive(false); |
| 377 return; | 377 return; |
| 378 } | 378 } |
| 379 location_icon_view_->set_interactive(false); | 379 location_icon_view_->set_interactive(false); |
| 380 } | 380 } |
| 381 | 381 |
| 382 UMA_HISTOGRAM_COUNTS("OriginChip.Pressed", 1); | 382 UMA_HISTOGRAM_COUNTS("OriginChip.Pressed", 1); |
| 383 content::RecordAction(base::UserMetricsAction("OriginChipPress")); | 383 content::RecordAction(base::UserMetricsAction("OriginChipPress")); |
| 384 | 384 |
| 385 location_bar_view_->ShowURL(); | 385 location_bar_view_->ShowURL(); |
| 386 } | 386 } |
| 387 | 387 |
| 388 // Note: When OnSafeBrowsingHit would be called, OnSafeBrowsingMatch will | 388 // Note: When OnSafeBrowsingHit would be called, OnSafeBrowsingMatch will |
| 389 // have already been called. | 389 // have already been called. |
| 390 void OriginChipView::OnSafeBrowsingHit( | 390 void OriginChipView::OnSafeBrowsingHit( |
| 391 const SafeBrowsingUIManager::UnsafeResource& resource) {} | 391 const SafeBrowsingUIManager::UnsafeResource& resource) {} |
| 392 | 392 |
| 393 void OriginChipView::OnSafeBrowsingMatch( | 393 void OriginChipView::OnSafeBrowsingMatch( |
| 394 const SafeBrowsingUIManager::UnsafeResource& resource) { | 394 const SafeBrowsingUIManager::UnsafeResource& resource) { |
| 395 OnChanged(); | 395 OnChanged(); |
| 396 } | 396 } |
| OLD | NEW |