diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-04 01:04:18 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-04 01:04:18 +0000 |
commit | c3fac080f2f42ab386f0a6e834351ab220be8d4a (patch) | |
tree | 7e56c8c6bd1aa1c576f90c2335322f743a6e1d79 | |
parent | 8ef4d59eff51761c3d2243fb813d088eb2511989 (diff) | |
download | chromium_src-c3fac080f2f42ab386f0a6e834351ab220be8d4a.zip chromium_src-c3fac080f2f42ab386f0a6e834351ab220be8d4a.tar.gz chromium_src-c3fac080f2f42ab386f0a6e834351ab220be8d4a.tar.bz2 |
Rename the methods in DragController.
They used to have the same name as methods in View. Some views would
derive from both View and DragController, which was confusing. For
example for clang's -Woverride-virtual.
No functionality change.
BUG=70465,72205
TEST=none
Review URL: http://codereview.chromium.org/6609033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76847 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc | 15 | ||||
-rw-r--r-- | chrome/browser/ui/views/bookmarks/bookmark_bar_view.h | 16 | ||||
-rw-r--r-- | chrome/browser/ui/views/browser_actions_container.cc | 16 | ||||
-rw-r--r-- | chrome/browser/ui/views/browser_actions_container.h | 16 | ||||
-rw-r--r-- | chrome/browser/ui/views/location_bar/location_bar_view.cc | 19 | ||||
-rw-r--r-- | chrome/browser/ui/views/location_bar/location_bar_view.h | 16 | ||||
-rw-r--r-- | ui/views/events/drag_controller.h | 14 | ||||
-rw-r--r-- | views/view.cc | 7 | ||||
-rw-r--r-- | views/view.h | 15 |
9 files changed, 72 insertions, 62 deletions
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc index c1cb88d89..863801c 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc @@ -1078,9 +1078,9 @@ void BookmarkBarView::BookmarkNodeFavIconLoaded(BookmarkModel* model, BookmarkNodeChangedImpl(model, node); } -void BookmarkBarView::WriteDragData(View* sender, - const gfx::Point& press_pt, - ui::OSExchangeData* data) { +void BookmarkBarView::WriteDragDataForView(View* sender, + const gfx::Point& press_pt, + ui::OSExchangeData* data) { UserMetrics::RecordAction(UserMetricsAction("BookmarkBar_DragButton"), profile_); @@ -1098,7 +1098,8 @@ void BookmarkBarView::WriteDragData(View* sender, NOTREACHED(); } -int BookmarkBarView::GetDragOperations(View* sender, const gfx::Point& p) { +int BookmarkBarView::GetDragOperationsForView(View* sender, + const gfx::Point& p) { if (size_animation_->is_animating() || (size_animation_->GetCurrentValue() == 0 && !OnNewTabPage())) { // Don't let the user drag while animating open or we're closed (and not on @@ -1118,9 +1119,9 @@ int BookmarkBarView::GetDragOperations(View* sender, const gfx::Point& p) { return ui::DragDropTypes::DRAG_NONE; } -bool BookmarkBarView::CanStartDrag(views::View* sender, - const gfx::Point& press_pt, - const gfx::Point& p) { +bool BookmarkBarView::CanStartDragForView(views::View* sender, + const gfx::Point& press_pt, + const gfx::Point& p) { // Check if we have not moved enough horizontally but we have moved downward // vertically - downward drag. if (!View::ExceededDragThreshold(press_pt.x() - p.x(), 0) && diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.h b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.h index 5737e7c..c66e247 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.h +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.h @@ -8,6 +8,7 @@ #include <set> +#include "base/compiler_specific.h" #include "chrome/browser/bookmarks/bookmark_model_observer.h" #include "chrome/browser/bookmarks/bookmark_node_data.h" #include "chrome/browser/sync/profile_sync_service.h" @@ -354,15 +355,16 @@ class BookmarkBarView : public DetachableToolbarView, // DragController method. Determines the node representing sender and invokes // WriteDragData to write the actual data. - virtual void WriteDragData(views::View* sender, - const gfx::Point& press_pt, - ui::OSExchangeData* data); + virtual void WriteDragDataForView(views::View* sender, + const gfx::Point& press_pt, + ui::OSExchangeData* data) OVERRIDE; - virtual int GetDragOperations(views::View* sender, const gfx::Point& p); + virtual int GetDragOperationsForView(views::View* sender, + const gfx::Point& p) OVERRIDE; - virtual bool CanStartDrag(views::View* sender, - const gfx::Point& press_pt, - const gfx::Point& p); + virtual bool CanStartDragForView(views::View* sender, + const gfx::Point& press_pt, + const gfx::Point& p) OVERRIDE; // Writes a BookmarkNodeData for node to data. void WriteDragData(const BookmarkNode* node, ui::OSExchangeData* data); diff --git a/chrome/browser/ui/views/browser_actions_container.cc b/chrome/browser/ui/views/browser_actions_container.cc index 6870f65..276bc10 100644 --- a/chrome/browser/ui/views/browser_actions_container.cc +++ b/chrome/browser/ui/views/browser_actions_container.cc @@ -754,9 +754,9 @@ void BrowserActionsContainer::RunMenu(View* source, const gfx::Point& pt) { } } -void BrowserActionsContainer::WriteDragData(View* sender, - const gfx::Point& press_pt, - OSExchangeData* data) { +void BrowserActionsContainer::WriteDragDataForView(View* sender, + const gfx::Point& press_pt, + OSExchangeData* data) { DCHECK(data); for (size_t i = 0; i < browser_action_views_.size(); ++i) { @@ -777,14 +777,14 @@ void BrowserActionsContainer::WriteDragData(View* sender, } } -int BrowserActionsContainer::GetDragOperations(View* sender, - const gfx::Point& p) { +int BrowserActionsContainer::GetDragOperationsForView(View* sender, + const gfx::Point& p) { return ui::DragDropTypes::DRAG_MOVE; } -bool BrowserActionsContainer::CanStartDrag(View* sender, - const gfx::Point& press_pt, - const gfx::Point& p) { +bool BrowserActionsContainer::CanStartDragForView(View* sender, + const gfx::Point& press_pt, + const gfx::Point& p) { return true; } diff --git a/chrome/browser/ui/views/browser_actions_container.h b/chrome/browser/ui/views/browser_actions_container.h index 94c13139e..3400885 100644 --- a/chrome/browser/ui/views/browser_actions_container.h +++ b/chrome/browser/ui/views/browser_actions_container.h @@ -10,6 +10,7 @@ #include <string> #include <vector> +#include "base/compiler_specific.h" #include "base/task.h" #include "chrome/browser/extensions/extension_context_menu_model.h" #include "chrome/browser/extensions/extension_toolbar_model.h" @@ -337,13 +338,14 @@ class BrowserActionsContainer virtual void RunMenu(View* source, const gfx::Point& pt); // Overridden from views::DragController: - virtual void WriteDragData(View* sender, - const gfx::Point& press_pt, - ui::OSExchangeData* data); - virtual int GetDragOperations(View* sender, const gfx::Point& p); - virtual bool CanStartDrag(View* sender, - const gfx::Point& press_pt, - const gfx::Point& p); + virtual void WriteDragDataForView(View* sender, + const gfx::Point& press_pt, + ui::OSExchangeData* data) OVERRIDE; + virtual int GetDragOperationsForView(View* sender, + const gfx::Point& p) OVERRIDE; + virtual bool CanStartDragForView(View* sender, + const gfx::Point& press_pt, + const gfx::Point& p) OVERRIDE; // Overridden from ResizeArea::ResizeAreaDelegate: virtual void OnResize(int resize_amount, bool done_resizing); diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc index 686c6f7..ad5f83c 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -1059,10 +1059,11 @@ AccessibilityTypes::Role LocationBarView::GetAccessibleRole() { return AccessibilityTypes::ROLE_GROUPING; } -void LocationBarView::WriteDragData(views::View* sender, - const gfx::Point& press_pt, - OSExchangeData* data) { - DCHECK(GetDragOperations(sender, press_pt) != ui::DragDropTypes::DRAG_NONE); +void LocationBarView::WriteDragDataForView(views::View* sender, + const gfx::Point& press_pt, + OSExchangeData* data) { + DCHECK_NE(GetDragOperationsForView(sender, press_pt), + ui::DragDropTypes::DRAG_NONE); TabContents* tab_contents = GetTabContentsFromDelegate(delegate_); DCHECK(tab_contents); @@ -1071,8 +1072,8 @@ void LocationBarView::WriteDragData(views::View* sender, tab_contents->GetFavIcon(), data); } -int LocationBarView::GetDragOperations(views::View* sender, - const gfx::Point& p) { +int LocationBarView::GetDragOperationsForView(views::View* sender, + const gfx::Point& p) { DCHECK((sender == location_icon_view_) || (sender == ev_bubble_view_)); TabContents* tab_contents = GetTabContentsFromDelegate(delegate_); return (tab_contents && tab_contents->GetURL().is_valid() && @@ -1081,9 +1082,9 @@ int LocationBarView::GetDragOperations(views::View* sender, ui::DragDropTypes::DRAG_NONE; } -bool LocationBarView::CanStartDrag(View* sender, - const gfx::Point& press_pt, - const gfx::Point& p) { +bool LocationBarView::CanStartDragForView(View* sender, + const gfx::Point& press_pt, + const gfx::Point& p) { return true; } diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.h b/chrome/browser/ui/views/location_bar/location_bar_view.h index 90607c8..2d53468 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.h +++ b/chrome/browser/ui/views/location_bar/location_bar_view.h @@ -9,6 +9,7 @@ #include <string> #include <vector> +#include "base/compiler_specific.h" #include "base/task.h" #include "chrome/browser/autocomplete/autocomplete_edit.h" #include "chrome/browser/extensions/extension_context_menu_model.h" @@ -211,13 +212,14 @@ class LocationBarView : public LocationBar, virtual AccessibilityTypes::Role GetAccessibleRole() OVERRIDE; // Overridden from views::DragController: - virtual void WriteDragData(View* sender, - const gfx::Point& press_pt, - OSExchangeData* data) OVERRIDE; - virtual int GetDragOperations(View* sender, const gfx::Point& p) OVERRIDE; - virtual bool CanStartDrag(View* sender, - const gfx::Point& press_pt, - const gfx::Point& p) OVERRIDE; + virtual void WriteDragDataForView(View* sender, + const gfx::Point& press_pt, + OSExchangeData* data) OVERRIDE; + virtual int GetDragOperationsForView(View* sender, + const gfx::Point& p) OVERRIDE; + virtual bool CanStartDragForView(View* sender, + const gfx::Point& press_pt, + const gfx::Point& p) OVERRIDE; // Overridden from LocationBar: virtual void ShowFirstRunBubble(FirstRun::BubbleType bubble_type) OVERRIDE; diff --git a/ui/views/events/drag_controller.h b/ui/views/events/drag_controller.h index 4352195..6344f83 100644 --- a/ui/views/events/drag_controller.h +++ b/ui/views/events/drag_controller.h @@ -13,20 +13,20 @@ namespace ui { class DragController { public: // Writes the data for the drag. - virtual void WriteDragData(View* sender, - const gfx::Point& press_pt, - OSExchangeData* data) = 0; + virtual void WriteDragDataForView(View* sender, + const gfx::Point& press_pt, + OSExchangeData* data) = 0; // Returns the supported drag operations (see DragDropTypes for possible // values). A drag is only started if this returns a non-zero value. - virtual int GetDragOperations(View* sender, const gfx::Point& p) = 0; + virtual int GetDragOperationsForView(View* sender, const gfx::Point& p) = 0; // Returns true if a drag operation can be started. // |press_pt| represents the coordinates where the mouse was initially // pressed down. |p| is the current mouse coordinates. - virtual bool CanStartDrag(View* sender, - const gfx::Point& press_pt, - const gfx::Point& p) = 0; + virtual bool CanStartDragForView(View* sender, + const gfx::Point& press_pt, + const gfx::Point& p) = 0; protected: virtual ~DragController() {} diff --git a/views/view.cc b/views/view.cc index bd778c645..d1510d5 100644 --- a/views/view.cc +++ b/views/view.cc @@ -1174,13 +1174,13 @@ gfx::Point View::GetKeyboardContextMenuLocation() { int View::GetDragOperations(const gfx::Point& press_pt) { return drag_controller_ ? - drag_controller_->GetDragOperations(this, press_pt) : + drag_controller_->GetDragOperationsForView(this, press_pt) : ui::DragDropTypes::DRAG_NONE; } void View::WriteDragData(const gfx::Point& press_pt, OSExchangeData* data) { DCHECK(drag_controller_); - drag_controller_->WriteDragData(this, press_pt, data); + drag_controller_->WriteDragDataForView(this, press_pt, data); } bool View::InDrag() { @@ -1448,7 +1448,8 @@ bool View::ProcessMouseDragged(const MouseEvent& e, DragInfo* drag_info) { if (possible_drag && ExceededDragThreshold(drag_info->start_pt.x() - e.x(), drag_info->start_pt.y() - e.y())) { if (!drag_controller_ || - drag_controller_->CanStartDrag(this, drag_info->start_pt, e.location())) + drag_controller_->CanStartDragForView( + this, drag_info->start_pt, e.location())) DoDrag(e, drag_info->start_pt); } else { if (OnMouseDragged(e)) diff --git a/views/view.h b/views/view.h index 83af008..ff46862 100644 --- a/views/view.h +++ b/views/view.h @@ -87,20 +87,21 @@ class ContextMenuController { class DragController { public: // Writes the data for the drag. - virtual void WriteDragData(View* sender, - const gfx::Point& press_pt, - OSExchangeData* data) = 0; + virtual void WriteDragDataForView(View* sender, + const gfx::Point& press_pt, + OSExchangeData* data) = 0; // Returns the supported drag operations (see DragDropTypes for possible // values). A drag is only started if this returns a non-zero value. - virtual int GetDragOperations(View* sender, const gfx::Point& p) = 0; + virtual int GetDragOperationsForView(View* sender, + const gfx::Point& p) = 0; // Returns true if a drag operation can be started. // |press_pt| represents the coordinates where the mouse was initially // pressed down. |p| is the current mouse coordinates. - virtual bool CanStartDrag(View* sender, - const gfx::Point& press_pt, - const gfx::Point& p) = 0; + virtual bool CanStartDragForView(View* sender, + const gfx::Point& press_pt, + const gfx::Point& p) = 0; protected: virtual ~DragController() {} |