summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chromeos/compact_location_bar_view.cc9
-rw-r--r--chrome/browser/chromeos/compact_location_bar_view.h13
-rw-r--r--chrome/browser/chromeos/frame/browser_view.cc7
-rw-r--r--chrome/browser/chromeos/frame/browser_view.h3
-rw-r--r--chrome/browser/extensions/browser_action_test_util_views.cc2
-rw-r--r--chrome/browser/views/accessible_toolbar_view.cc6
-rw-r--r--chrome/browser/views/accessible_toolbar_view.h4
-rw-r--r--chrome/browser/views/autofill_profiles_view_win.cc5
-rw-r--r--chrome/browser/views/bookmark_bar_view.cc84
-rw-r--r--chrome/browser/views/bookmark_bar_view.h21
-rw-r--r--chrome/browser/views/bookmark_editor_view.cc7
-rw-r--r--chrome/browser/views/bookmark_editor_view.h5
-rw-r--r--chrome/browser/views/bookmark_manager_view.cc71
-rw-r--r--chrome/browser/views/bookmark_manager_view.h9
-rw-r--r--chrome/browser/views/bookmark_menu_controller_views.cc7
-rw-r--r--chrome/browser/views/bookmark_menu_controller_views.h5
-rw-r--r--chrome/browser/views/browser_actions_container.cc17
-rw-r--r--chrome/browser/views/browser_actions_container.h11
-rw-r--r--chrome/browser/views/content_blocked_bubble_contents.cc6
-rw-r--r--chrome/browser/views/extensions/browser_action_overflow_menu_controller.cc8
-rw-r--r--chrome/browser/views/extensions/browser_action_overflow_menu_controller.h3
-rw-r--r--chrome/browser/views/go_button.cc4
-rw-r--r--chrome/browser/views/go_button.h4
-rw-r--r--chrome/browser/views/tabs/tab.cc11
-rw-r--r--chrome/browser/views/tabs/tab.h9
-rw-r--r--chrome/browser/views/tabs/tab_strip.cc4
-rw-r--r--chrome/browser/views/task_manager_view.cc10
-rw-r--r--chrome/browser/views/toolbar_view.cc8
-rw-r--r--chrome/browser/views/toolbar_view.h13
29 files changed, 162 insertions, 204 deletions
diff --git a/chrome/browser/chromeos/compact_location_bar_view.cc b/chrome/browser/chromeos/compact_location_bar_view.cc
index 2083664..0907689 100644
--- a/chrome/browser/chromeos/compact_location_bar_view.cc
+++ b/chrome/browser/chromeos/compact_location_bar_view.cc
@@ -277,11 +277,9 @@ gfx::Rect CompactLocationBarView::GetLocationStackBounds() const {
////////////////////////////////////////////////////////////////////////////////
// views::DragController overrides:
void CompactLocationBarView::WriteDragData(views::View* sender,
- int press_x,
- int press_y,
+ const gfx::Point& press_pt,
OSExchangeData* data) {
- DCHECK(
- GetDragOperations(sender, press_x, press_y) != DragDropTypes::DRAG_NONE);
+ DCHECK(GetDragOperations(sender, press_pt) != DragDropTypes::DRAG_NONE);
UserMetrics::RecordAction("CompactLocationBar_DragStar",
browser()->profile());
@@ -309,8 +307,7 @@ void CompactLocationBarView::WriteDragData(views::View* sender,
}
int CompactLocationBarView::GetDragOperations(views::View* sender,
- int x,
- int y) {
+ const gfx::Point& p) {
DCHECK(sender == star_);
TabContents* tab = browser()->GetSelectedTabContents();
if (!tab || !tab->ShouldDisplayURL() || !tab->GetURL().is_valid()) {
diff --git a/chrome/browser/chromeos/compact_location_bar_view.h b/chrome/browser/chromeos/compact_location_bar_view.h
index 3364158..e4f8d73 100644
--- a/chrome/browser/chromeos/compact_location_bar_view.h
+++ b/chrome/browser/chromeos/compact_location_bar_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -86,15 +86,12 @@ class CompactLocationBarView : public DropdownBarView,
// views::DragController implementation.
virtual void WriteDragData(View* sender,
- int press_x,
- int press_y,
+ const gfx::Point& press_pt,
OSExchangeData* data);
- virtual int GetDragOperations(View* sender, int x, int y);
+ virtual int GetDragOperations(View* sender, const gfx::Point& p);
virtual bool CanStartDrag(View* sender,
- int press_x,
- int press_y,
- int x,
- int y) {
+ const gfx::Point& press_pt,
+ const gfx::Point& p) {
return true;
}
diff --git a/chrome/browser/chromeos/frame/browser_view.cc b/chrome/browser/chromeos/frame/browser_view.cc
index ca90857..ff3836a 100644
--- a/chrome/browser/chromeos/frame/browser_view.cc
+++ b/chrome/browser/chromeos/frame/browser_view.cc
@@ -465,17 +465,18 @@ void BrowserView::ButtonPressed(views::Button* sender,
}
// views::ContextMenuController overrides.
-void BrowserView::ShowContextMenu(views::View* source, int x, int y,
+void BrowserView::ShowContextMenu(views::View* source,
+ const gfx::Point& p,
bool is_mouse_gesture) {
// Only show context menu if point is in unobscured parts of browser, i.e.
// if NonClientHitTest returns :
// - HTCAPTION: in title bar or unobscured part of tabstrip
// - HTNOWHERE: as the name implies.
- gfx::Point point_in_parent_coords(x, y);
+ gfx::Point point_in_parent_coords(p);
views::View::ConvertPointToView(NULL, GetParent(), &point_in_parent_coords);
int hit_test = NonClientHitTest(point_in_parent_coords);
if (hit_test == HTCAPTION || hit_test == HTNOWHERE)
- system_menu_menu_->RunMenuAt(gfx::Point(x, y), views::Menu2::ALIGN_TOPLEFT);
+ system_menu_menu_->RunMenuAt(p, views::Menu2::ALIGN_TOPLEFT);
}
// StatusAreaHost overrides.
diff --git a/chrome/browser/chromeos/frame/browser_view.h b/chrome/browser/chromeos/frame/browser_view.h
index 223c190..a848172 100644
--- a/chrome/browser/chromeos/frame/browser_view.h
+++ b/chrome/browser/chromeos/frame/browser_view.h
@@ -72,8 +72,7 @@ class BrowserView : public ::BrowserView,
// views::ContextMenuController overrides.
virtual void ShowContextMenu(views::View* source,
- int x,
- int y,
+ const gfx::Point& p,
bool is_mouse_gesture);
// StatusAreaHost overrides.
diff --git a/chrome/browser/extensions/browser_action_test_util_views.cc b/chrome/browser/extensions/browser_action_test_util_views.cc
index 3e6b2972..69b034c 100644
--- a/chrome/browser/extensions/browser_action_test_util_views.cc
+++ b/chrome/browser/extensions/browser_action_test_util_views.cc
@@ -52,7 +52,7 @@ std::string BrowserActionTestUtil::GetExtensionId(int index) {
std::string BrowserActionTestUtil::GetTooltip(int index) {
std::wstring text;
GetContainer(browser_)->GetBrowserActionViewAt(index)->button()->
- GetTooltipText(0, 0, &text);
+ GetTooltipText(gfx::Point(), &text);
return WideToUTF8(text);
}
diff --git a/chrome/browser/views/accessible_toolbar_view.cc b/chrome/browser/views/accessible_toolbar_view.cc
index 3556fe7..d85648d0 100644
--- a/chrome/browser/views/accessible_toolbar_view.cc
+++ b/chrome/browser/views/accessible_toolbar_view.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -90,10 +90,10 @@ void AccessibleToolbarView::WillLoseFocus() {
}
}
-void AccessibleToolbarView::ShowContextMenu(int x, int y,
+void AccessibleToolbarView::ShowContextMenu(const gfx::Point& p,
bool is_mouse_gesture) {
if (selected_focused_view_)
- selected_focused_view_->ShowContextMenu(x, y, is_mouse_gesture);
+ selected_focused_view_->ShowContextMenu(p, is_mouse_gesture);
}
void AccessibleToolbarView::RequestFocus() {
diff --git a/chrome/browser/views/accessible_toolbar_view.h b/chrome/browser/views/accessible_toolbar_view.h
index f892a74..f2ef13f 100644
--- a/chrome/browser/views/accessible_toolbar_view.h
+++ b/chrome/browser/views/accessible_toolbar_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -27,7 +27,7 @@ class AccessibleToolbarView : public views::View {
virtual bool OnKeyPressed(const views::KeyEvent& e);
virtual bool OnKeyReleased(const views::KeyEvent& e);
virtual bool SkipDefaultKeyEventProcessing(const views::KeyEvent& e);
- virtual void ShowContextMenu(int x, int y, bool is_mouse_gesture);
+ virtual void ShowContextMenu(const gfx::Point& p, bool is_mouse_gesture);
virtual void RequestFocus();
virtual bool GetAccessibleName(std::wstring* name);
virtual bool GetAccessibleRole(AccessibilityTypes::Role* role);
diff --git a/chrome/browser/views/autofill_profiles_view_win.cc b/chrome/browser/views/autofill_profiles_view_win.cc
index b18b365..723d786 100644
--- a/chrome/browser/views/autofill_profiles_view_win.cc
+++ b/chrome/browser/views/autofill_profiles_view_win.cc
@@ -1101,10 +1101,7 @@ void AutoFillProfilesView::AutoFillScrollView::RebuildView() {
// Deletes the old contents view and takes ownership of
// |scroll_contents_view_|.
scroll_view_->SetContents(scroll_contents_view_);
- scroll_contents_view_->ScrollRectToVisible(visible_rectangle.x(),
- visible_rectangle.y(),
- visible_rectangle.width(),
- visible_rectangle.height());
+ scroll_contents_view_->ScrollRectToVisible(visible_rectangle);
}
diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc
index c175881..65c1a3f 100644
--- a/chrome/browser/views/bookmark_bar_view.cc
+++ b/chrome/browser/views/bookmark_bar_view.cc
@@ -188,11 +188,10 @@ class BookmarkButton : public views::TextButton {
}
}
- bool GetTooltipText(int x, int y, std::wstring* tooltip) {
- gfx::Point location(x, y);
+ bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip) {
+ gfx::Point location(p);
ConvertPointToScreen(this, &location);
- *tooltip = CreateToolTipForURLAndTitle(
- gfx::Point(location.x(), location.y()), url_, text(),
+ *tooltip = CreateToolTipForURLAndTitle(location, url_, text(),
profile_->GetPrefs()->GetString(prefs::kAcceptLanguages));
return !tooltip->empty();
}
@@ -716,8 +715,9 @@ int BookmarkBarView::OnPerformDrop(const DropTargetEvent& event) {
index);
}
-void BookmarkBarView::ShowContextMenu(int x, int y, bool is_mouse_gesture) {
- ShowContextMenu(this, x, y, is_mouse_gesture);
+void BookmarkBarView::ShowContextMenu(const gfx::Point& p,
+ bool is_mouse_gesture) {
+ ShowContextMenu(this, p, is_mouse_gesture);
}
bool BookmarkBarView::IsAccessibleViewTraversable(views::View* view) {
@@ -1094,8 +1094,7 @@ void BookmarkBarView::BookmarkNodeFavIconLoaded(BookmarkModel* model,
}
void BookmarkBarView::WriteDragData(View* sender,
- int press_x,
- int press_y,
+ const gfx::Point& press_pt,
OSExchangeData* data) {
UserMetrics::RecordAction("BookmarkBar_DragButton", profile_);
@@ -1104,9 +1103,8 @@ void BookmarkBarView::WriteDragData(View* sender,
views::TextButton* button = GetBookmarkButton(i);
gfx::Canvas canvas(button->width(), button->height(), false);
button->Paint(&canvas, true);
- drag_utils::SetDragImageOnDataObject(canvas, button->width(),
- button->height(), press_x,
- press_y, data);
+ drag_utils::SetDragImageOnDataObject(canvas, button->size(), press_pt,
+ data);
WriteDragData(model_->GetBookmarkBarNode()->GetChild(i), data);
return;
}
@@ -1114,21 +1112,33 @@ void BookmarkBarView::WriteDragData(View* sender,
NOTREACHED();
}
-void BookmarkBarView::WriteDragData(const BookmarkNode* node,
- OSExchangeData* data) {
- DCHECK(node && data);
- BookmarkDragData drag_data(node);
- drag_data.Write(profile_, data);
+int BookmarkBarView::GetDragOperations(View* sender, const gfx::Point& p) {
+ if (size_animation_->IsAnimating() ||
+ (size_animation_->GetCurrentValue() == 0 && !OnNewTabPage())) {
+ // Don't let the user drag while animating open or we're closed (and not on
+ // the new tab page, on the new tab page size_animation_ is always 0). This
+ // typically is only hit if the user does something to inadvertanty trigger
+ // dnd, such as pressing the mouse and hitting control-b.
+ return DragDropTypes::DRAG_NONE;
+ }
+
+ for (int i = 0; i < GetBookmarkButtonCount(); ++i) {
+ if (sender == GetBookmarkButton(i)) {
+ return bookmark_utils::BookmarkDragOperation(
+ model_->GetBookmarkBarNode()->GetChild(i));
+ }
+ }
+ NOTREACHED();
+ return DragDropTypes::DRAG_NONE;
}
bool BookmarkBarView::CanStartDrag(views::View* sender,
- int press_x,
- int press_y,
- int x,
- int y) {
+ 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_x - x, 0) && press_y < y) {
+ if (!View::ExceededDragThreshold(press_pt.x() - p.x(), 0) &&
+ press_pt.y() < p.y()) {
for (int i = 0; i < GetBookmarkButtonCount(); ++i) {
if (sender == GetBookmarkButton(i)) {
const BookmarkNode* node = model_->GetBookmarkBarNode()->GetChild(i);
@@ -1146,24 +1156,11 @@ bool BookmarkBarView::CanStartDrag(views::View* sender,
return true;
}
-int BookmarkBarView::GetDragOperations(View* sender, int x, int y) {
- if (size_animation_->IsAnimating() ||
- (size_animation_->GetCurrentValue() == 0 && !OnNewTabPage())) {
- // Don't let the user drag while animating open or we're closed (and not on
- // the new tab page, on the new tab page size_animation_ is always 0). This
- // typically is only hit if the user does something to inadvertanty trigger
- // dnd, such as pressing the mouse and hitting control-b.
- return DragDropTypes::DRAG_NONE;
- }
-
- for (int i = 0; i < GetBookmarkButtonCount(); ++i) {
- if (sender == GetBookmarkButton(i)) {
- return bookmark_utils::BookmarkDragOperation(
- model_->GetBookmarkBarNode()->GetChild(i));
- }
- }
- NOTREACHED();
- return DragDropTypes::DRAG_NONE;
+void BookmarkBarView::WriteDragData(const BookmarkNode* node,
+ OSExchangeData* data) {
+ DCHECK(node && data);
+ BookmarkDragData drag_data(node);
+ drag_data.Write(profile_, data);
}
void BookmarkBarView::RunMenu(views::View* view, const gfx::Point& pt) {
@@ -1222,8 +1219,7 @@ void BookmarkBarView::ButtonPressed(views::Button* sender,
}
void BookmarkBarView::ShowContextMenu(View* source,
- int x,
- int y,
+ const gfx::Point& p,
bool is_mouse_gesture) {
if (!model_->IsLoaded()) {
// Don't do anything if the model isn't loaded.
@@ -1255,9 +1251,9 @@ void BookmarkBarView::ShowContextMenu(View* source,
PageNavigator* navigator =
browser() ? browser()->GetSelectedTabContents() : NULL;
BookmarkContextMenu controller(GetWindow()->GetNativeWindow(), GetProfile(),
- navigator, parent, nodes,
- BookmarkContextMenuControllerViews::BOOKMARK_BAR);
- controller.RunMenuAt(gfx::Point(x, y));
+ navigator, parent, nodes,
+ BookmarkContextMenuControllerViews::BOOKMARK_BAR);
+ controller.RunMenuAt(p);
}
views::View* BookmarkBarView::CreateBookmarkButton(const BookmarkNode* node) {
diff --git a/chrome/browser/views/bookmark_bar_view.h b/chrome/browser/views/bookmark_bar_view.h
index c4df926..6eb975c 100644
--- a/chrome/browser/views/bookmark_bar_view.h
+++ b/chrome/browser/views/bookmark_bar_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -112,7 +112,7 @@ class BookmarkBarView : public DetachableToolbarView,
virtual int OnDragUpdated(const views::DropTargetEvent& event);
virtual void OnDragExited();
virtual int OnPerformDrop(const views::DropTargetEvent& event);
- virtual void ShowContextMenu(int x, int y, bool is_mouse_gesture);
+ virtual void ShowContextMenu(const gfx::Point& p, bool is_mouse_gesture);
// AccessibleToolbarView methods:
virtual bool IsAccessibleViewTraversable(views::View* view);
@@ -331,22 +331,18 @@ 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,
- int press_x,
- int press_y,
+ const gfx::Point& press_pt,
OSExchangeData* data);
+ virtual int GetDragOperations(views::View* sender, const gfx::Point& p);
+
virtual bool CanStartDrag(views::View* sender,
- int press_x,
- int press_y,
- int x,
- int y);
+ const gfx::Point& press_pt,
+ const gfx::Point& p);
// Writes a BookmarkDragData for node to data.
void WriteDragData(const BookmarkNode* node, OSExchangeData* data);
- // Returns the drag operations for the specified button.
- virtual int GetDragOperations(views::View* sender, int x, int y);
-
// ViewMenuDelegate method. Ends up creating a BookmarkMenuController to
// show the menu.
virtual void RunMenu(views::View* view, const gfx::Point& pt);
@@ -358,8 +354,7 @@ class BookmarkBarView : public DetachableToolbarView,
// Invoked for this View, one of the buttons or the 'other' button. Shows the
// appropriate context menu.
virtual void ShowContextMenu(views::View* source,
- int x,
- int y,
+ const gfx::Point& p,
bool is_mouse_gesture);
// Creates the button for rendering the specified bookmark node.
diff --git a/chrome/browser/views/bookmark_editor_view.cc b/chrome/browser/views/bookmark_editor_view.cc
index b993775..fb2d072 100644
--- a/chrome/browser/views/bookmark_editor_view.cc
+++ b/chrome/browser/views/bookmark_editor_view.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -236,8 +236,7 @@ void BookmarkEditorView::Close() {
}
void BookmarkEditorView::ShowContextMenu(View* source,
- int x,
- int y,
+ const gfx::Point& p,
bool is_mouse_gesture) {
DCHECK(source == tree_view_);
if (!tree_view_->GetSelectedNode())
@@ -253,7 +252,7 @@ void BookmarkEditorView::ShowContextMenu(View* source,
IDS_BOOMARK_EDITOR_NEW_FOLDER_MENU_ITEM);
context_menu_.reset(new views::Menu2(context_menu_contents_.get()));
}
- context_menu_->RunContextMenuAt(gfx::Point(x, y));
+ context_menu_->RunContextMenuAt(p);
}
void BookmarkEditorView::Init() {
diff --git a/chrome/browser/views/bookmark_editor_view.h b/chrome/browser/views/bookmark_editor_view.h
index 3c358f7..575b726 100644
--- a/chrome/browser/views/bookmark_editor_view.h
+++ b/chrome/browser/views/bookmark_editor_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -122,8 +122,7 @@ class BookmarkEditorView : public BookmarkEditor,
// Shows the context menu.
virtual void ShowContextMenu(View* source,
- int x,
- int y,
+ const gfx::Point& p,
bool is_mouse_gesture);
private:
diff --git a/chrome/browser/views/bookmark_manager_view.cc b/chrome/browser/views/bookmark_manager_view.cc
index 84b059c..289a9cc 100644
--- a/chrome/browser/views/bookmark_manager_view.cc
+++ b/chrome/browser/views/bookmark_manager_view.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -550,15 +550,13 @@ bool BookmarkManagerView::HandleKeystroke(
}
void BookmarkManagerView::ShowContextMenu(views::View* source,
- int x,
- int y,
+ const gfx::Point& p,
bool is_mouse_gesture) {
DCHECK(source == table_view_ || source == tree_view_);
bool is_table = (source == table_view_);
- ShowMenu(x, y,
- is_table ?
- BookmarkContextMenuControllerViews::BOOKMARK_MANAGER_TABLE :
- BookmarkContextMenuControllerViews::BOOKMARK_MANAGER_TREE);
+ ShowMenu(p, is_table ?
+ BookmarkContextMenuControllerViews::BOOKMARK_MANAGER_TABLE :
+ BookmarkContextMenuControllerViews::BOOKMARK_MANAGER_TREE);
}
void BookmarkManagerView::RunMenu(views::View* source, const gfx::Point& pt) {
@@ -568,14 +566,14 @@ void BookmarkManagerView::RunMenu(views::View* source, const gfx::Point& pt) {
if (!GetBookmarkModel()->IsLoaded())
return;
- int menu_x = pt.x();
- menu_x += UILayoutIsRightToLeft() ? (source->width() - 5) :
- (-source->width() + 5);
+ gfx::Point menu_pt(pt);
+ menu_pt.Offset(UILayoutIsRightToLeft() ?
+ (source->width() - 5) : (-source->width() + 5), 2);
if (source->GetID() == kOrganizeMenuButtonID) {
- ShowMenu(menu_x, pt.y() + 2,
+ ShowMenu(menu_pt,
BookmarkContextMenuControllerViews::BOOKMARK_MANAGER_ORGANIZE_MENU);
} else if (source->GetID() == kToolsMenuButtonID) {
- ShowToolsMenu(menu_x, pt.y() + 2);
+ ShowToolsMenu(menu_pt);
} else {
NOTREACHED();
}
@@ -718,40 +716,30 @@ BookmarkModel* BookmarkManagerView::GetBookmarkModel() const {
}
void BookmarkManagerView::ShowMenu(
- int x, int y,
+ const gfx::Point& p,
BookmarkContextMenuControllerViews::ConfigurationType config) {
if (!GetBookmarkModel()->IsLoaded())
return;
- if (config == BookmarkContextMenuControllerViews::BOOKMARK_MANAGER_TABLE ||
- (config ==
- BookmarkContextMenuControllerViews::BOOKMARK_MANAGER_ORGANIZE_MENU &&
+ const BookmarkNode* parent = GetSelectedFolder();
+ std::vector<const BookmarkNode*> nodes;
+ typedef BookmarkContextMenuControllerViews BCMCV; // Such a long name!
+ if (config == BCMCV::BOOKMARK_MANAGER_TABLE ||
+ (config == BCMCV::BOOKMARK_MANAGER_ORGANIZE_MENU &&
table_view_->HasFocus())) {
- std::vector<const BookmarkNode*> nodes = GetSelectedTableNodes();
- const BookmarkNode* parent = GetSelectedFolder();
+ nodes = GetSelectedTableNodes();
if (!parent) {
- if (config ==
- BookmarkContextMenuControllerViews::BOOKMARK_MANAGER_TABLE) {
- config =
- BookmarkContextMenuControllerViews::BOOKMARK_MANAGER_TABLE_OTHER;
- } else {
- config =
- BookmarkContextMenuControllerViews::
- BOOKMARK_MANAGER_ORGANIZE_MENU_OTHER;
- }
+ config = (config == BCMCV::BOOKMARK_MANAGER_TABLE) ?
+ BCMCV::BOOKMARK_MANAGER_TABLE_OTHER :
+ BCMCV::BOOKMARK_MANAGER_ORGANIZE_MENU_OTHER;
}
- BookmarkContextMenu menu(GetWindow()->GetNativeWindow(), profile_, NULL,
- parent, nodes, config);
- menu.RunMenuAt(gfx::Point(x, y));
} else {
- const BookmarkNode* node = GetSelectedFolder();
- std::vector<const BookmarkNode*> nodes;
- if (node)
- nodes.push_back(node);
- BookmarkContextMenu menu(GetWidget()->GetNativeView(), profile_, NULL,
- node, nodes, config);
- menu.RunMenuAt(gfx::Point(x, y));
+ if (parent)
+ nodes.push_back(parent);
}
+ BookmarkContextMenu menu(GetWidget()->GetNativeView(), profile_, NULL, parent,
+ nodes, config);
+ menu.RunMenuAt(p);
}
void BookmarkManagerView::OnCutCopyPaste(CutCopyPasteType type,
@@ -779,7 +767,7 @@ void BookmarkManagerView::OnCutCopyPaste(CutCopyPasteType type,
}
}
-void BookmarkManagerView::ShowToolsMenu(int x, int y) {
+void BookmarkManagerView::ShowToolsMenu(const gfx::Point& p) {
views::MenuItemView menu(this);
menu.AppendMenuItemWithLabel(
IDS_BOOKMARK_MANAGER_IMPORT_MENU,
@@ -787,10 +775,9 @@ void BookmarkManagerView::ShowToolsMenu(int x, int y) {
menu.AppendMenuItemWithLabel(
IDS_BOOKMARK_MANAGER_EXPORT_MENU,
l10n_util::GetString(IDS_BOOKMARK_MANAGER_EXPORT_MENU));
- views::MenuItemView::AnchorPosition anchor =
- UILayoutIsRightToLeft() ? views::MenuItemView::TOPRIGHT :
- views::MenuItemView::TOPLEFT;
- menu.RunMenuAt(GetWidget()->GetNativeView(), NULL, gfx::Rect(x, y, 0, 0),
+ views::MenuItemView::AnchorPosition anchor = UILayoutIsRightToLeft() ?
+ views::MenuItemView::TOPRIGHT : views::MenuItemView::TOPLEFT;
+ menu.RunMenuAt(GetWidget()->GetNativeView(), NULL, gfx::Rect(p, gfx::Size()),
anchor, true);
}
diff --git a/chrome/browser/views/bookmark_manager_view.h b/chrome/browser/views/bookmark_manager_view.h
index 74aee84..470152f 100644
--- a/chrome/browser/views/bookmark_manager_view.h
+++ b/chrome/browser/views/bookmark_manager_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -151,8 +151,7 @@ class BookmarkManagerView : public views::View,
// ContextMenuController.
virtual void ShowContextMenu(views::View* source,
- int x,
- int y,
+ const gfx::Point& p,
bool is_mouse_gesture);
// ViewMenuDelegate.
@@ -193,7 +192,7 @@ class BookmarkManagerView : public views::View,
// Shows the menu. This is invoked to show the context menu for table/tree
// as well as to show the menu from the organize button.
- void ShowMenu(int x, int y,
+ void ShowMenu(const gfx::Point& p,
BookmarkContextMenuControllerViews::ConfigurationType config);
// Invoked to handle cut/copy/paste from the table or tree. If |from_table|
@@ -201,7 +200,7 @@ class BookmarkManagerView : public views::View,
void OnCutCopyPaste(CutCopyPasteType type, bool from_table);
// Shows the tools menu.
- void ShowToolsMenu(int x, int y);
+ void ShowToolsMenu(const gfx::Point& p);
// Shows the import/export file chooser. These invoke
// FileSelected/FileSelectionCanceled when done.
diff --git a/chrome/browser/views/bookmark_menu_controller_views.cc b/chrome/browser/views/bookmark_menu_controller_views.cc
index 66e41f8..2437d7f 100644
--- a/chrome/browser/views/bookmark_menu_controller_views.cc
+++ b/chrome/browser/views/bookmark_menu_controller_views.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -194,8 +194,7 @@ int BookmarkMenuController::OnPerformDrop(MenuItemView* menu,
bool BookmarkMenuController::ShowContextMenu(MenuItemView* source,
int id,
- int x,
- int y,
+ const gfx::Point& p,
bool is_mouse_gesture) {
DCHECK(menu_id_to_node_map_.find(id) != menu_id_to_node_map_.end());
std::vector<const BookmarkNode*> nodes;
@@ -209,7 +208,7 @@ bool BookmarkMenuController::ShowContextMenu(MenuItemView* source,
nodes,
BookmarkContextMenuControllerViews::BOOKMARK_BAR));
context_menu_->set_observer(this);
- context_menu_->RunMenuAt(gfx::Point(x, y));
+ context_menu_->RunMenuAt(p);
context_menu_.reset(NULL);
return true;
}
diff --git a/chrome/browser/views/bookmark_menu_controller_views.h b/chrome/browser/views/bookmark_menu_controller_views.h
index 13e1295..693c83c 100644
--- a/chrome/browser/views/bookmark_menu_controller_views.h
+++ b/chrome/browser/views/bookmark_menu_controller_views.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -95,8 +95,7 @@ class BookmarkMenuController : public BaseBookmarkModelObserver,
const views::DropTargetEvent& event);
virtual bool ShowContextMenu(views::MenuItemView* source,
int id,
- int x,
- int y,
+ const gfx::Point& p,
bool is_mouse_gesture);
virtual void DropMenuClosed(views::MenuItemView* menu);
virtual bool CanDrag(views::MenuItemView* menu);
diff --git a/chrome/browser/views/browser_actions_container.cc b/chrome/browser/views/browser_actions_container.cc
index f3289fa..7d14eae 100644
--- a/chrome/browser/views/browser_actions_container.cc
+++ b/chrome/browser/views/browser_actions_container.cc
@@ -882,8 +882,9 @@ void BrowserActionsContainer::RunMenu(View* source, const gfx::Point& pt) {
}
}
-void BrowserActionsContainer::WriteDragData(
- View* sender, int press_x, int press_y, OSExchangeData* data) {
+void BrowserActionsContainer::WriteDragData(View* sender,
+ const gfx::Point& press_pt,
+ OSExchangeData* data) {
DCHECK(data);
for (size_t i = 0; i < browser_action_views_.size(); ++i) {
@@ -892,8 +893,8 @@ void BrowserActionsContainer::WriteDragData(
// Set the dragging image for the icon.
scoped_ptr<gfx::Canvas> canvas(
browser_action_views_[i]->GetIconWithBadge());
- drag_utils::SetDragImageOnDataObject(*canvas, button->width(),
- button->height(), press_x, press_y, data);
+ drag_utils::SetDragImageOnDataObject(*canvas, button->size(), press_pt,
+ data);
// Fill in the remaining info.
BrowserActionDragData drag_data(
@@ -904,12 +905,14 @@ void BrowserActionsContainer::WriteDragData(
}
}
-int BrowserActionsContainer::GetDragOperations(View* sender, int x, int y) {
+int BrowserActionsContainer::GetDragOperations(View* sender,
+ const gfx::Point& p) {
return DragDropTypes::DRAG_MOVE;
}
-bool BrowserActionsContainer::CanStartDrag(
- View* sender, int press_x, int press_y, int x, int y) {
+bool BrowserActionsContainer::CanStartDrag(View* sender,
+ const gfx::Point& press_pt,
+ const gfx::Point& p) {
return true;
}
diff --git a/chrome/browser/views/browser_actions_container.h b/chrome/browser/views/browser_actions_container.h
index 89b0842..2a55ed6 100644
--- a/chrome/browser/views/browser_actions_container.h
+++ b/chrome/browser/views/browser_actions_container.h
@@ -319,15 +319,12 @@ class BrowserActionsContainer
// Overridden from views::DragController:
virtual void WriteDragData(View* sender,
- int press_x,
- int press_y,
+ const gfx::Point& press_pt,
OSExchangeData* data);
- virtual int GetDragOperations(View* sender, int x, int y);
+ virtual int GetDragOperations(View* sender, const gfx::Point& p);
virtual bool CanStartDrag(View* sender,
- int press_x,
- int press_y,
- int x,
- int y);
+ const gfx::Point& press_pt,
+ const gfx::Point& p);
// Overridden from ResizeGripper::ResizeGripperDelegate:
virtual void OnResize(int resize_amount, bool done_resizing);
diff --git a/chrome/browser/views/content_blocked_bubble_contents.cc b/chrome/browser/views/content_blocked_bubble_contents.cc
index edbb22d..a44311c 100644
--- a/chrome/browser/views/content_blocked_bubble_contents.cc
+++ b/chrome/browser/views/content_blocked_bubble_contents.cc
@@ -43,8 +43,7 @@ class ContentBlockedBubbleContents::Favicon : public views::ImageView {
virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled);
virtual gfx::NativeCursor GetCursorForPoint(
views::Event::EventType event_type,
- int x,
- int y);
+ const gfx::Point& p);
ContentBlockedBubbleContents* parent_;
views::Link* link_;
@@ -82,8 +81,7 @@ void ContentBlockedBubbleContents::Favicon::OnMouseReleased(
gfx::NativeCursor ContentBlockedBubbleContents::Favicon::GetCursorForPoint(
views::Event::EventType event_type,
- int x,
- int y) {
+ const gfx::Point& p) {
#if defined(OS_WIN)
if (!g_hand_cursor)
g_hand_cursor = LoadCursor(NULL, IDC_HAND);
diff --git a/chrome/browser/views/extensions/browser_action_overflow_menu_controller.cc b/chrome/browser/views/extensions/browser_action_overflow_menu_controller.cc
index 85a233a..f0bb80d 100644
--- a/chrome/browser/views/extensions/browser_action_overflow_menu_controller.cc
+++ b/chrome/browser/views/extensions/browser_action_overflow_menu_controller.cc
@@ -84,11 +84,13 @@ void BrowserActionOverflowMenuController::ExecuteCommand(int id) {
}
bool BrowserActionOverflowMenuController::ShowContextMenu(
- views::MenuItemView* source, int id, int x, int y, bool is_mouse_gesture) {
+ views::MenuItemView* source,
+ int id,
+ const gfx::Point& p,
+ bool is_mouse_gesture) {
// This blocks until the user choses something or dismisses the menu.
owner_->GetContextMenu()->Run(
- (*views_)[start_index_ + id - 1]->button()->extension(),
- gfx::Point(x, y));
+ (*views_)[start_index_ + id - 1]->button()->extension(), p);
// The user is done with the context menu, so we can close the underlying
// menu.
diff --git a/chrome/browser/views/extensions/browser_action_overflow_menu_controller.h b/chrome/browser/views/extensions/browser_action_overflow_menu_controller.h
index 9f9e2a1..e30db53 100644
--- a/chrome/browser/views/extensions/browser_action_overflow_menu_controller.h
+++ b/chrome/browser/views/extensions/browser_action_overflow_menu_controller.h
@@ -43,8 +43,7 @@ class BrowserActionOverflowMenuController : public views::MenuDelegate {
virtual void ExecuteCommand(int id);
virtual bool ShowContextMenu(views::MenuItemView* source,
int id,
- int x,
- int y,
+ const gfx::Point& p,
bool is_mouse_gesture);
virtual void DropMenuClosed(views::MenuItemView* menu);
// These drag functions offer support for dragging icons into the overflow
diff --git a/chrome/browser/views/go_button.cc b/chrome/browser/views/go_button.cc
index 4f55244..29451c3 100644
--- a/chrome/browser/views/go_button.cc
+++ b/chrome/browser/views/go_button.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -85,7 +85,7 @@ void GoButton::OnMouseExited(const views::MouseEvent& e) {
SetState(BS_NORMAL);
}
-bool GoButton::GetTooltipText(int x, int y, std::wstring* tooltip) {
+bool GoButton::GetTooltipText(const gfx::Point& p, std::wstring* tooltip) {
if (visible_mode_ == MODE_STOP) {
tooltip->assign(l10n_util::GetString(IDS_TOOLTIP_STOP));
return true;
diff --git a/chrome/browser/views/go_button.h b/chrome/browser/views/go_button.h
index 735ca54..8855b5a 100644
--- a/chrome/browser/views/go_button.h
+++ b/chrome/browser/views/go_button.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -41,7 +41,7 @@ class GoButton : public views::ToggleImageButton,
// Overridden from views::View:
virtual void OnMouseExited(const views::MouseEvent& e);
- virtual bool GetTooltipText(int x, int y, std::wstring* tooltip);
+ virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip);
private:
void OnButtonTimer();
diff --git a/chrome/browser/views/tabs/tab.cc b/chrome/browser/views/tabs/tab.cc
index e65fb16..7d99ebd 100644
--- a/chrome/browser/views/tabs/tab.cc
+++ b/chrome/browser/views/tabs/tab.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -168,7 +168,7 @@ void Tab::OnMouseReleased(const views::MouseEvent& event, bool canceled) {
delegate_->CloseTab(this);
}
-bool Tab::GetTooltipText(int x, int y, std::wstring* tooltip) {
+bool Tab::GetTooltipText(const gfx::Point& p, std::wstring* tooltip) {
std::wstring title = GetTitle();
if (!title.empty()) {
// Only show the tooltip if the title is truncated.
@@ -181,7 +181,7 @@ bool Tab::GetTooltipText(int x, int y, std::wstring* tooltip) {
return false;
}
-bool Tab::GetTooltipTextOrigin(int x, int y, gfx::Point* origin) {
+bool Tab::GetTooltipTextOrigin(const gfx::Point& p, gfx::Point* origin) {
gfx::Font font;
origin->set_x(title_bounds().x() + 10);
origin->set_y(-views::TooltipManager::GetTooltipHeight() - 4);
@@ -203,11 +203,12 @@ bool Tab::GetAccessibleName(std::wstring* name) {
///////////////////////////////////////////////////////////////////////////////
// Tab, views::ContextMenuController implementation:
-void Tab::ShowContextMenu(views::View* source, int x, int y,
+void Tab::ShowContextMenu(views::View* source,
+ const gfx::Point& p,
bool is_mouse_gesture) {
if (!context_menu_contents_.get())
context_menu_contents_.reset(new TabContextMenuContents(this));
- context_menu_contents_->RunMenuAt(gfx::Point(x, y));
+ context_menu_contents_->RunMenuAt(p);
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/views/tabs/tab.h b/chrome/browser/views/tabs/tab.h
index a5638f7..f491291 100644
--- a/chrome/browser/views/tabs/tab.h
+++ b/chrome/browser/views/tabs/tab.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -97,16 +97,15 @@ class Tab : public TabRenderer,
virtual bool OnMouseDragged(const views::MouseEvent& event);
virtual void OnMouseReleased(const views::MouseEvent& event,
bool canceled);
- virtual bool GetTooltipText(int x, int y, std::wstring* tooltip);
- virtual bool GetTooltipTextOrigin(int x, int y, gfx::Point* origin);
+ virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip);
+ virtual bool GetTooltipTextOrigin(const gfx::Point& p, gfx::Point* origin);
virtual std::string GetClassName() const { return kTabClassName; }
virtual bool GetAccessibleRole(AccessibilityTypes::Role* role);
virtual bool GetAccessibleName(std::wstring* name);
// views::ContextMenuController overrides:
virtual void ShowContextMenu(views::View* source,
- int x,
- int y,
+ const gfx::Point& p,
bool is_mouse_gesture);
// views::ButtonListener overrides:
diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc
index a71caf5..0b8cb4b 100644
--- a/chrome/browser/views/tabs/tab_strip.cc
+++ b/chrome/browser/views/tabs/tab_strip.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -1375,7 +1375,7 @@ void TabStrip::MaybeStartDrag(Tab* tab, const views::MouseEvent& event) {
return;
}
drag_controller_.reset(new DraggedTabController(tab, this));
- drag_controller_->CaptureDragInfo(gfx::Point(event.x(), event.y()));
+ drag_controller_->CaptureDragInfo(event.location());
}
void TabStrip::ContinueDrag(const views::MouseEvent& event) {
diff --git a/chrome/browser/views/task_manager_view.cc b/chrome/browser/views/task_manager_view.cc
index 6dbbb87..1b5e148 100644
--- a/chrome/browser/views/task_manager_view.cc
+++ b/chrome/browser/views/task_manager_view.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -231,8 +231,7 @@ class TaskManagerView : public views::View,
// Menu::Delegate
virtual void ShowContextMenu(views::View* source,
- int x,
- int y,
+ const gfx::Point& p,
bool is_mouse_gesture);
virtual bool IsItemChecked(int id) const;
virtual void ExecuteCommand(int id);
@@ -597,7 +596,8 @@ void TaskManagerView::LinkActivated(views::Link* source, int event_flags) {
task_manager_->OpenAboutMemory();
}
-void TaskManagerView::ShowContextMenu(views::View* source, int x, int y,
+void TaskManagerView::ShowContextMenu(views::View* source,
+ const gfx::Point& p,
bool is_mouse_gesture) {
UpdateStatsCounters();
scoped_ptr<views::Menu> menu(views::Menu::Create(
@@ -606,7 +606,7 @@ void TaskManagerView::ShowContextMenu(views::View* source, int x, int y,
columns_.begin(); i != columns_.end(); ++i) {
menu->AppendMenuItem(i->id, i->title, views::Menu::CHECKBOX);
}
- menu->RunMenuAt(x, y);
+ menu->RunMenuAt(p.x(), p.y());
}
bool TaskManagerView::IsItemChecked(int id) const {
diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc
index b2125d4..9670c24 100644
--- a/chrome/browser/views/toolbar_view.cc
+++ b/chrome/browser/views/toolbar_view.cc
@@ -479,11 +479,9 @@ void ToolbarView::ThemeChanged() {
// ToolbarView, views::DragController implementation:
void ToolbarView::WriteDragData(views::View* sender,
- int press_x,
- int press_y,
+ const gfx::Point& press_pt,
OSExchangeData* data) {
- DCHECK(
- GetDragOperations(sender, press_x, press_y) != DragDropTypes::DRAG_NONE);
+ DCHECK(GetDragOperations(sender, press_pt) != DragDropTypes::DRAG_NONE);
UserMetrics::RecordAction("Toolbar_DragStar", profile_);
@@ -508,7 +506,7 @@ void ToolbarView::WriteDragData(views::View* sender,
}
}
-int ToolbarView::GetDragOperations(views::View* sender, int x, int y) {
+int ToolbarView::GetDragOperations(views::View* sender, const gfx::Point& p) {
DCHECK(sender == star_);
TabContents* tab = browser_->GetSelectedTabContents();
if (!tab || !tab->ShouldDisplayURL() || !tab->GetURL().is_valid()) {
diff --git a/chrome/browser/views/toolbar_view.h b/chrome/browser/views/toolbar_view.h
index ffbec68f..23f5232 100644
--- a/chrome/browser/views/toolbar_view.h
+++ b/chrome/browser/views/toolbar_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -114,15 +114,12 @@ class ToolbarView : public AccessibleToolbarView,
private:
// Overridden from views::DragController:
virtual void WriteDragData(View* sender,
- int press_x,
- int press_y,
+ const gfx::Point& press_pt,
OSExchangeData* data);
- virtual int GetDragOperations(View* sender, int x, int y);
+ virtual int GetDragOperations(View* sender, const gfx::Point& p);
virtual bool CanStartDrag(View* sender,
- int press_x,
- int press_y,
- int x,
- int y) {
+ const gfx::Point& press_pt,
+ const gfx::Point& p) {
return true;
}