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

Side by Side Diff: chrome/browser/ui/views/toolbar/toolbar_origin_chip_view.cc

Issue 265713007: views: Update event-related API to use PointF/RectF instead of Point/Rect. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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/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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 location_icon_view_->set_interactive(false); 339 location_icon_view_->set_interactive(false);
340 } 340 }
341 341
342 UMA_HISTOGRAM_COUNTS("OriginChip.Pressed", 1); 342 UMA_HISTOGRAM_COUNTS("OriginChip.Pressed", 1);
343 content::RecordAction(base::UserMetricsAction("OriginChipPress")); 343 content::RecordAction(base::UserMetricsAction("OriginChipPress"));
344 344
345 toolbar_view_->location_bar()->ShowURL(); 345 toolbar_view_->location_bar()->ShowURL();
346 } 346 }
347 347
348 void ToolbarOriginChipView::WriteDragDataForView(View* sender, 348 void ToolbarOriginChipView::WriteDragDataForView(View* sender,
349 const gfx::Point& press_pt, 349 const gfx::PointF& press_pt,
350 OSExchangeData* data) { 350 OSExchangeData* data) {
351 // TODO(gbillock): Consolidate this with the identical logic in 351 // TODO(gbillock): Consolidate this with the identical logic in
352 // LocationBarView. 352 // LocationBarView.
353 content::WebContents* web_contents = toolbar_view_->GetWebContents(); 353 content::WebContents* web_contents = toolbar_view_->GetWebContents();
354 FaviconTabHelper* favicon_tab_helper = 354 FaviconTabHelper* favicon_tab_helper =
355 FaviconTabHelper::FromWebContents(web_contents); 355 FaviconTabHelper::FromWebContents(web_contents);
356 gfx::ImageSkia favicon = favicon_tab_helper->GetFavicon().AsImageSkia(); 356 gfx::ImageSkia favicon = favicon_tab_helper->GetFavicon().AsImageSkia();
357 button_drag_utils::SetURLAndDragImage(web_contents->GetURL(), 357 button_drag_utils::SetURLAndDragImage(web_contents->GetURL(),
358 web_contents->GetTitle(), 358 web_contents->GetTitle(),
359 favicon, 359 favicon,
360 data, 360 data,
361 sender->GetWidget()); 361 sender->GetWidget());
362 } 362 }
363 363
364 int ToolbarOriginChipView::GetDragOperationsForView(View* sender, 364 int ToolbarOriginChipView::GetDragOperationsForView(View* sender,
365 const gfx::Point& p) { 365 const gfx::PointF& p) {
366 return ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK; 366 return ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK;
367 } 367 }
368 368
369 bool ToolbarOriginChipView::CanStartDragForView(View* sender, 369 bool ToolbarOriginChipView::CanStartDragForView(View* sender,
370 const gfx::Point& press_pt, 370 const gfx::PointF& press_pt,
371 const gfx::Point& p) { 371 const gfx::PointF& p) {
372 return true; 372 return true;
373 } 373 }
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698