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

Side by Side Diff: chrome/browser/ui/views/toolbar/browser_actions_container.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/browser_actions_container.h" 5 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 if (source == chevron_) { 400 if (source == chevron_) {
401 overflow_menu_ = new BrowserActionOverflowMenuController( 401 overflow_menu_ = new BrowserActionOverflowMenuController(
402 this, browser_, chevron_, browser_action_views_, 402 this, browser_, chevron_, browser_action_views_,
403 VisibleBrowserActions()); 403 VisibleBrowserActions());
404 overflow_menu_->set_observer(this); 404 overflow_menu_->set_observer(this);
405 overflow_menu_->RunMenu(GetWidget(), false); 405 overflow_menu_->RunMenu(GetWidget(), false);
406 } 406 }
407 } 407 }
408 408
409 void BrowserActionsContainer::WriteDragDataForView(View* sender, 409 void BrowserActionsContainer::WriteDragDataForView(View* sender,
410 const gfx::Point& press_pt, 410 const gfx::PointF& press_pt,
411 OSExchangeData* data) { 411 OSExchangeData* data) {
412 DCHECK(data); 412 DCHECK(data);
413 413
414 for (size_t i = 0; i < browser_action_views_.size(); ++i) { 414 for (size_t i = 0; i < browser_action_views_.size(); ++i) {
415 BrowserActionButton* button = browser_action_views_[i]->button(); 415 BrowserActionButton* button = browser_action_views_[i]->button();
416 if (button == sender) { 416 if (button == sender) {
417 // Set the dragging image for the icon. 417 // Set the dragging image for the icon.
418 gfx::ImageSkia badge(browser_action_views_[i]->GetIconWithBadge()); 418 gfx::ImageSkia badge(browser_action_views_[i]->GetIconWithBadge());
419 drag_utils::SetDragImageOnDataObject(badge, button->size(), 419 drag_utils::SetDragImageOnDataObject(
420 press_pt.OffsetFromOrigin(), 420 badge,
421 data); 421 button->size(),
422 gfx::ToFlooredPoint(press_pt).OffsetFromOrigin(),
423 data);
422 424
423 // Fill in the remaining info. 425 // Fill in the remaining info.
424 BrowserActionDragData drag_data( 426 BrowserActionDragData drag_data(
425 browser_action_views_[i]->button()->extension()->id(), i); 427 browser_action_views_[i]->button()->extension()->id(), i);
426 drag_data.Write(profile_, data); 428 drag_data.Write(profile_, data);
427 break; 429 break;
428 } 430 }
429 } 431 }
430 } 432 }
431 433
432 int BrowserActionsContainer::GetDragOperationsForView(View* sender, 434 int BrowserActionsContainer::GetDragOperationsForView(View* sender,
433 const gfx::Point& p) { 435 const gfx::PointF& p) {
434 return ui::DragDropTypes::DRAG_MOVE; 436 return ui::DragDropTypes::DRAG_MOVE;
435 } 437 }
436 438
437 bool BrowserActionsContainer::CanStartDragForView(View* sender, 439 bool BrowserActionsContainer::CanStartDragForView(View* sender,
438 const gfx::Point& press_pt, 440 const gfx::PointF& press_pt,
439 const gfx::Point& p) { 441 const gfx::PointF& p) {
440 // We don't allow dragging while we're highlighting. 442 // We don't allow dragging while we're highlighting.
441 return !model_->is_highlighting(); 443 return !model_->is_highlighting();
442 } 444 }
443 445
444 void BrowserActionsContainer::OnResize(int resize_amount, bool done_resizing) { 446 void BrowserActionsContainer::OnResize(int resize_amount, bool done_resizing) {
445 if (!done_resizing) { 447 if (!done_resizing) {
446 resize_amount_ = resize_amount; 448 resize_amount_ = resize_amount;
447 OnBrowserActionVisibilityChanged(); 449 OnBrowserActionVisibilityChanged();
448 return; 450 return;
449 } 451 }
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 views::BubbleBorder::TOP_RIGHT, 924 views::BubbleBorder::TOP_RIGHT,
923 show_action); 925 show_action);
924 popup_->GetWidget()->AddObserver(this); 926 popup_->GetWidget()->AddObserver(this);
925 popup_button_ = button; 927 popup_button_ = button;
926 928
927 // Only set button as pushed if it was triggered by a user click. 929 // Only set button as pushed if it was triggered by a user click.
928 if (should_grant) 930 if (should_grant)
929 popup_button_->SetButtonPushed(); 931 popup_button_->SetButtonPushed();
930 return true; 932 return true;
931 } 933 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698