summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-26 06:00:42 +0000
committeroshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-26 06:00:42 +0000
commit5fc549f0469b301169a17a28b725c8ea20d80673 (patch)
treefea512f022e5be806e587aea4a8905fcd73c2331
parent7de2cf6dea088d93b88e997605e229888fadfceb (diff)
downloadchromium_src-5fc549f0469b301169a17a28b725c8ea20d80673.zip
chromium_src-5fc549f0469b301169a17a28b725c8ea20d80673.tar.gz
chromium_src-5fc549f0469b301169a17a28b725c8ea20d80673.tar.bz2
Use widget to specify the parent of views menu.
BUG=none TEST=none. no functional change and all tests should pass. Review URL: http://codereview.chromium.org/7489035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94046 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/frame/browser_view.cc2
-rw-r--r--chrome/browser/chromeos/login/language_switch_menu.cc2
-rw-r--r--chrome/browser/chromeos/notifications/balloon_view.cc4
-rw-r--r--chrome/browser/chromeos/status/clock_menu_button.cc11
-rw-r--r--chrome/browser/chromeos/status/input_method_menu.cc12
-rw-r--r--chrome/browser/chromeos/status/network_menu.cc12
-rw-r--r--chrome/browser/chromeos/status/power_menu_button.cc11
-rw-r--r--chrome/browser/ui/panels/panel_browser_frame_view.cc2
-rw-r--r--chrome/browser/ui/views/avatar_menu.cc4
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc8
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_context_menu.cc9
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_context_menu.h8
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views.cc25
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views.h11
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.cc3
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.h4
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc7
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.h8
-rw-r--r--chrome/browser/ui/views/browser_actions_container.cc8
-rw-r--r--chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc4
-rw-r--r--chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.h6
-rw-r--r--chrome/browser/ui/views/infobars/after_translate_infobar.cc4
-rw-r--r--chrome/browser/ui/views/infobars/before_translate_infobar.cc4
-rw-r--r--chrome/browser/ui/views/infobars/extension_infobar.cc2
-rw-r--r--chrome/browser/ui/views/location_bar/page_action_image_view.cc4
-rw-r--r--chrome/browser/ui/views/menu_item_view_test.cc2
-rw-r--r--chrome/browser/ui/views/tab_contents/render_view_context_menu_views.cc23
-rw-r--r--chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc4
-rw-r--r--chrome/browser/ui/views/wrench_menu.cc8
-rw-r--r--views/controls/button/button_dropdown.cc4
-rw-r--r--views/controls/menu/menu_controller.cc7
-rw-r--r--views/controls/menu/menu_controller.h4
-rw-r--r--views/controls/menu/menu_host.cc8
-rw-r--r--views/controls/menu/menu_host.h6
-rw-r--r--views/controls/menu/menu_item_view.cc4
-rw-r--r--views/controls/menu/menu_item_view.h4
-rw-r--r--views/controls/menu/menu_runner.cc6
-rw-r--r--views/controls/menu/menu_runner.h3
-rw-r--r--views/controls/menu/submenu_view.cc2
-rw-r--r--views/controls/menu/submenu_view.h2
-rw-r--r--views/controls/textfield/native_textfield_views.cc2
41 files changed, 129 insertions, 135 deletions
diff --git a/chrome/browser/chromeos/frame/browser_view.cc b/chrome/browser/chromeos/frame/browser_view.cc
index ec1f5b9..ddc112f 100644
--- a/chrome/browser/chromeos/frame/browser_view.cc
+++ b/chrome/browser/chromeos/frame/browser_view.cc
@@ -511,7 +511,7 @@ void BrowserView::ShowContextMenuForView(views::View* source,
if (hit_test == HTCAPTION || hit_test == HTNOWHERE) {
// rebuild menu so it reflects current application state
InitSystemMenu();
- system_menu_->RunMenuAt(source->GetWidget()->GetNativeWindow(), NULL,
+ system_menu_->RunMenuAt(source->GetWidget(), NULL,
gfx::Rect(p, gfx::Size(0,0)),
views::MenuItemView::TOPLEFT,
true);
diff --git a/chrome/browser/chromeos/login/language_switch_menu.cc b/chrome/browser/chromeos/login/language_switch_menu.cc
index 67f2bb8..1461dba 100644
--- a/chrome/browser/chromeos/login/language_switch_menu.cc
+++ b/chrome/browser/chromeos/login/language_switch_menu.cc
@@ -170,7 +170,7 @@ void LanguageSwitchMenu::RunMenu(views::View* source, const gfx::Point& pt) {
else
new_pt.set_x(pt.x() - reverse_offset);
- menu_->RunMenuAt(button->GetWidget()->GetNativeWindow(), button,
+ menu_->RunMenuAt(button->GetWidget(), button,
gfx::Rect(new_pt, gfx::Size()), views::MenuItemView::TOPLEFT, true);
}
diff --git a/chrome/browser/chromeos/notifications/balloon_view.cc b/chrome/browser/chromeos/notifications/balloon_view.cc
index 659a900..73a6906 100644
--- a/chrome/browser/chromeos/notifications/balloon_view.cc
+++ b/chrome/browser/chromeos/notifications/balloon_view.cc
@@ -126,9 +126,7 @@ class NotificationControlView : public views::View,
gfx::Point screen_location;
views::View::ConvertPointToScreen(options_menu_button_,
&screen_location);
- gfx::NativeWindow window =
- source->GetWidget()->GetTopLevelWidget()->GetNativeWindow();
- menu.RunMenuAt(window,
+ menu.RunMenuAt(source->GetWidget()->GetTopLevelWidget(),
options_menu_button_,
gfx::Rect(screen_location, options_menu_button_->size()),
views::MenuItemView::TOPRIGHT,
diff --git a/chrome/browser/chromeos/status/clock_menu_button.cc b/chrome/browser/chromeos/status/clock_menu_button.cc
index 5361bbd..b95b365 100644
--- a/chrome/browser/chromeos/status/clock_menu_button.cc
+++ b/chrome/browser/chromeos/status/clock_menu_button.cc
@@ -151,20 +151,11 @@ void ClockMenuButton::RunMenu(views::View* source, const gfx::Point& pt) {
EnsureMenu();
- // TODO(rhashimoto): Remove this workaround when WebUI provides a
- // top-level widget on the ChromeOS login screen that is a window.
- // The current BackgroundView class for the ChromeOS login screen
- // creates a owning Widget that has a native GtkWindow but is not a
- // Window. This makes it impossible to get the NativeWindow via
- // the views API. This workaround casts the top-level NativeWidget
- // to a NativeWindow that we can pass to MenuItemView::RunMenuAt().
- gfx::NativeWindow window = GTK_WINDOW(source->GetWidget()->GetNativeView());
-
gfx::Point screen_location;
views::View::ConvertPointToScreen(source, &screen_location);
gfx::Rect bounds(screen_location, source->size());
menu_->RunMenuAt(
- window,
+ source->GetWidget()->GetTopLevelWidget(),
this,
bounds,
views::MenuItemView::TOPRIGHT,
diff --git a/chrome/browser/chromeos/status/input_method_menu.cc b/chrome/browser/chromeos/status/input_method_menu.cc
index 2335fbd..81a99b1 100644
--- a/chrome/browser/chromeos/status/input_method_menu.cc
+++ b/chrome/browser/chromeos/status/input_method_menu.cc
@@ -387,19 +387,11 @@ void InputMethodMenu::RunMenu(views::View* source, const gfx::Point& pt) {
submenu->set_minimum_preferred_width(minimum_input_method_menu_width_);
}
- // TODO(rhashimoto): Remove this workaround when WebUI provides a
- // top-level widget on the ChromeOS login screen that is a window.
- // The current BackgroundView class for the ChromeOS login screen
- // creates a owning Widget that has a native GtkWindow but is not a
- // Window. This makes it impossible to get the NativeWindow via
- // the views API. This workaround casts the top-level NativeWidget
- // to a NativeWindow that we can pass to MenuItemView::RunMenuAt().
- gfx::NativeWindow window = GTK_WINDOW(source->GetWidget()->GetNativeView());
-
gfx::Point screen_location;
views::View::ConvertPointToScreen(source, &screen_location);
gfx::Rect bounds(screen_location, source->size());
- input_method_menu_->RunMenuAt(window, NULL, bounds, menu_alignment_, true);
+ input_method_menu_->RunMenuAt(source->GetWidget()->GetTopLevelWidget(),
+ NULL, bounds, menu_alignment_, true);
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/chromeos/status/network_menu.cc b/chrome/browser/chromeos/status/network_menu.cc
index 2795911..5f3b974 100644
--- a/chrome/browser/chromeos/status/network_menu.cc
+++ b/chrome/browser/chromeos/status/network_menu.cc
@@ -1104,20 +1104,12 @@ void NetworkMenu::RunMenu(views::View* source) {
UpdateMenu();
- // TODO(rhashimoto): Remove this workaround when WebUI provides a
- // top-level widget on the ChromeOS login screen that is a window.
- // The current BackgroundView class for the ChromeOS login screen
- // creates a owning Widget that has a native GtkWindow but is not a
- // Window. This makes it impossible to get the NativeWindow via
- // the views API. This workaround casts the top-level NativeWidget
- // to a NativeWindow that we can pass to MenuItemView::RunMenuAt().
- gfx::NativeWindow window = GTK_WINDOW(source->GetWidget()->GetNativeView());
-
gfx::Point screen_location;
views::View::ConvertPointToScreen(source, &screen_location);
gfx::Rect bounds(screen_location, source->size());
menu_item_view_->GetSubmenu()->set_minimum_preferred_width(min_width_);
- menu_item_view_->RunMenuAt(window, delegate_->GetMenuButton(), bounds,
+ menu_item_view_->RunMenuAt(source->GetWidget()->GetTopLevelWidget(),
+ delegate_->GetMenuButton(), bounds,
views::MenuItemView::TOPRIGHT, true);
}
diff --git a/chrome/browser/chromeos/status/power_menu_button.cc b/chrome/browser/chromeos/status/power_menu_button.cc
index f8577bd..eb1fcf4 100644
--- a/chrome/browser/chromeos/status/power_menu_button.cc
+++ b/chrome/browser/chromeos/status/power_menu_button.cc
@@ -132,20 +132,11 @@ void PowerMenuButton::OnLocaleChanged() {
void PowerMenuButton::RunMenu(views::View* source, const gfx::Point& pt) {
UpdateMenu();
- // TODO(rhashimoto): Remove this workaround when WebUI provides a
- // top-level widget on the ChromeOS login screen that is a window.
- // The current BackgroundView class for the ChromeOS login screen
- // creates a owning Widget that has a native GtkWindow but is not a
- // Window. This makes it impossible to get the NativeWindow via
- // the views API. This workaround casts the top-level NativeWidget
- // to a NativeWindow that we can pass to MenuItemView::RunMenuAt().
- gfx::NativeWindow window = GTK_WINDOW(source->GetWidget()->GetNativeView());
-
gfx::Point screen_location;
views::View::ConvertPointToScreen(source, &screen_location);
gfx::Rect bounds(screen_location, source->size());
menu_->RunMenuAt(
- window,
+ source->GetWidget()->GetTopLevelWidget(),
this,
bounds,
views::MenuItemView::TOPRIGHT,
diff --git a/chrome/browser/ui/panels/panel_browser_frame_view.cc b/chrome/browser/ui/panels/panel_browser_frame_view.cc
index 0041557..d12c67f 100644
--- a/chrome/browser/ui/panels/panel_browser_frame_view.cc
+++ b/chrome/browser/ui/panels/panel_browser_frame_view.cc
@@ -448,7 +448,7 @@ void PanelBrowserFrameView::RunMenu(View* source, const gfx::Point& pt) {
DCHECK_EQ(settings_button_, source);
gfx::Point screen_point;
views::View::ConvertPointToScreen(source, &screen_point);
- settings_menu_.RunMenuAt(source->GetWidget()->GetNativeWindow(),
+ settings_menu_.RunMenuAt(source->GetWidget(),
settings_button_, gfx::Rect(screen_point, source->size()),
views::MenuItemView::TOPRIGHT, true);
}
diff --git a/chrome/browser/ui/views/avatar_menu.cc b/chrome/browser/ui/views/avatar_menu.cc
index 656be6c..346f521 100644
--- a/chrome/browser/ui/views/avatar_menu.cc
+++ b/chrome/browser/ui/views/avatar_menu.cc
@@ -194,6 +194,6 @@ void AvatarMenu::RunMenu(views::MenuButton* host) {
gfx::Point screen_loc;
views::View::ConvertPointToScreen(host, &screen_loc);
gfx::Rect bounds(screen_loc, host->size());
- root_->RunMenuAt(host->GetWidget()->GetNativeWindow(), host, bounds,
- views::MenuItemView::TOPLEFT, true);
+ root_->RunMenuAt(host->GetWidget(), host, bounds,
+ views::MenuItemView::TOPLEFT, true);
}
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
index f489a8a..5f5d238 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
@@ -1066,8 +1066,7 @@ void BookmarkBarView::RunMenu(views::View* view, const gfx::Point& pt) {
}
bookmark_menu_ = new BookmarkMenuController(
- profile_, page_navigator_, GetWidget()->GetNativeWindow(), node,
- start_index);
+ profile_, page_navigator_, GetWidget(), node, start_index);
bookmark_menu_->set_observer(this);
bookmark_menu_->RunMenuAt(this, false);
}
@@ -1141,7 +1140,7 @@ void BookmarkBarView::ShowContextMenuForView(View* source,
bool close_on_remove =
(parent == profile_->GetBookmarkModel()->other_node() &&
parent->child_count() == 1);
- BookmarkContextMenu controller(GetWidget()->GetNativeWindow(), profile_,
+ BookmarkContextMenu controller(GetWidget(), profile_,
navigator, parent, nodes, close_on_remove);
controller.RunMenuAt(p);
}
@@ -1395,8 +1394,7 @@ void BookmarkBarView::ShowDropFolderForNode(const BookmarkNode* node) {
drop_info_->is_menu_showing = true;
bookmark_drop_menu_ = new BookmarkMenuController(
- profile_, page_navigator_, GetWidget()->GetNativeWindow(), node,
- start_index);
+ profile_, page_navigator_, GetWidget(), node, start_index);
bookmark_drop_menu_->set_observer(this);
bookmark_drop_menu_->RunMenuAt(this, true);
}
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_context_menu.cc b/chrome/browser/ui/views/bookmarks/bookmark_context_menu.cc
index 4504833..0a4633f 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_context_menu.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_context_menu.cc
@@ -14,21 +14,22 @@
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "views/controls/menu/menu_item_view.h"
+#include "views/widget/widget.h"
////////////////////////////////////////////////////////////////////////////////
// BookmarkContextMenu, public:
BookmarkContextMenu::BookmarkContextMenu(
- gfx::NativeWindow parent_window,
+ views::Widget* parent_widget,
Profile* profile,
PageNavigator* page_navigator,
const BookmarkNode* parent,
const std::vector<const BookmarkNode*>& selection,
bool close_on_remove)
: ALLOW_THIS_IN_INITIALIZER_LIST(
- controller_(new BookmarkContextMenuControllerViews(parent_window,
+ controller_(new BookmarkContextMenuControllerViews(parent_widget,
this, profile, page_navigator, parent, selection))),
- parent_window_(parent_window),
+ parent_widget_(parent_widget),
ALLOW_THIS_IN_INITIALIZER_LIST(menu_(new views::MenuItemView(this))),
parent_node_(parent),
observer_(NULL),
@@ -47,7 +48,7 @@ void BookmarkContextMenu::RunMenuAt(const gfx::Point& point) {
// width/height don't matter here.
views::MenuItemView::AnchorPosition anchor = base::i18n::IsRTL() ?
views::MenuItemView::TOPRIGHT : views::MenuItemView::TOPLEFT;
- menu_->RunMenuAt(parent_window_, NULL, gfx::Rect(point.x(), point.y(), 0, 0),
+ menu_->RunMenuAt(parent_widget_, NULL, gfx::Rect(point.x(), point.y(), 0, 0),
anchor, true);
}
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_context_menu.h b/chrome/browser/ui/views/bookmarks/bookmark_context_menu.h
index 5fb95c5..de732d1 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_context_menu.h
+++ b/chrome/browser/ui/views/bookmarks/bookmark_context_menu.h
@@ -9,6 +9,10 @@
#include "chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views.h"
#include "views/controls/menu/menu_delegate.h"
+namespace views {
+class Widget;
+}
+
// Observer for the BookmarkContextMenu.
class BookmarkContextMenuObserver {
public:
@@ -27,7 +31,7 @@ class BookmarkContextMenu : public BookmarkContextMenuControllerViewsDelegate,
public views::MenuDelegate {
public:
BookmarkContextMenu(
- gfx::NativeWindow parent_window,
+ views::Widget* parent_widget,
Profile* profile,
PageNavigator* page_navigator,
const BookmarkNode* parent,
@@ -63,7 +67,7 @@ class BookmarkContextMenu : public BookmarkContextMenuControllerViewsDelegate,
scoped_ptr<BookmarkContextMenuControllerViews> controller_;
// The parent of dialog boxes opened from the context menu.
- gfx::NativeWindow parent_window_;
+ views::Widget* parent_widget_;
// The menu itself.
scoped_ptr<views::MenuItemView> menu_;
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views.cc b/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views.cc
index be87e71..fe6ff6b 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views.cc
@@ -18,15 +18,16 @@
#include "chrome/common/pref_names.h"
#include "content/browser/tab_contents/page_navigator.h"
#include "grit/generated_resources.h"
+#include "views/widget/widget.h"
BookmarkContextMenuControllerViews::BookmarkContextMenuControllerViews(
- gfx::NativeWindow parent_window,
+ views::Widget* parent_widget,
BookmarkContextMenuControllerViewsDelegate* delegate,
Profile* profile,
PageNavigator* navigator,
const BookmarkNode* parent,
const std::vector<const BookmarkNode*>& selection)
- : parent_window_(parent_window),
+ : parent_widget_(parent_widget),
delegate_(delegate),
profile_(profile),
navigator_(navigator),
@@ -111,7 +112,8 @@ void BookmarkContextMenuControllerViews::ExecuteCommand(int id) {
UserMetrics::RecordAction(
UserMetricsAction("BookmarkBar_ContextMenu_OpenAllIncognito"));
}
- bookmark_utils::OpenAll(parent_window_, profile_, navigator_, selection_,
+ bookmark_utils::OpenAll(parent_widget_->GetNativeWindow(),
+ profile_, navigator_, selection_,
initial_disposition);
break;
}
@@ -127,12 +129,12 @@ void BookmarkContextMenuControllerViews::ExecuteCommand(int id) {
}
if (selection_[0]->is_url()) {
- BookmarkEditor::Show(parent_window_, profile_, parent_,
- BookmarkEditor::EditDetails(selection_[0]),
- BookmarkEditor::SHOW_TREE);
+ BookmarkEditor::Show(parent_widget_->GetNativeWindow(), profile_,
+ parent_, BookmarkEditor::EditDetails(selection_[0]),
+ BookmarkEditor::SHOW_TREE);
} else {
- BookmarkFolderEditorController::Show(profile_, parent_window_,
- selection_[0], -1,
+ BookmarkFolderEditorController::Show(profile_,
+ parent_widget_->GetNativeWindow(), selection_[0], -1,
BookmarkFolderEditorController::EXISTING_BOOKMARK);
}
break;
@@ -157,7 +159,7 @@ void BookmarkContextMenuControllerViews::ExecuteCommand(int id) {
// TODO: this should honor the index from GetParentForNewNodes.
BookmarkEditor::Show(
- parent_window_, profile_,
+ parent_widget_->GetNativeWindow(), profile_,
bookmark_utils::GetParentForNewNodes(parent_, selection_, NULL),
BookmarkEditor::EditDetails(), BookmarkEditor::SHOW_TREE);
break;
@@ -169,8 +171,9 @@ void BookmarkContextMenuControllerViews::ExecuteCommand(int id) {
int index;
const BookmarkNode* parent =
bookmark_utils::GetParentForNewNodes(parent_, selection_, &index);
- BookmarkFolderEditorController::Show(profile_, parent_window_, parent,
- index, BookmarkFolderEditorController::NEW_BOOKMARK);
+ BookmarkFolderEditorController::Show(profile_,
+ parent_widget_->GetNativeWindow(), parent, index,
+ BookmarkFolderEditorController::NEW_BOOKMARK);
break;
}
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views.h b/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views.h
index 7870d21..3166194 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views.h
+++ b/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views.h
@@ -10,11 +10,14 @@
#include "base/basictypes.h"
#include "chrome/browser/bookmarks/base_bookmark_model_observer.h"
-#include "ui/gfx/native_widget_types.h"
class PageNavigator;
class Profile;
+namespace views {
+class Widget;
+}
+
// An interface implemented by an object that performs actions on the actual
// menu for the controller.
class BookmarkContextMenuControllerViewsDelegate {
@@ -42,14 +45,14 @@ class BookmarkContextMenuControllerViewsDelegate {
class BookmarkContextMenuControllerViews : public BaseBookmarkModelObserver {
public:
// Creates the bookmark context menu.
- // |parent_window| is the window that this menu should be added to.
+ // |parent_widget| is the window that this menu should be added to.
// |delegate| is described above.
// |profile| is used for opening urls as well as enabling 'open incognito'.
// |navigator| is used if |browser| is null, and is provided for testing.
// |parent| is the parent for newly created nodes if |selection| is empty.
// |selection| is the nodes the context menu operates on and may be empty.
BookmarkContextMenuControllerViews(
- gfx::NativeWindow parent_window,
+ views::Widget* parent_widget,
BookmarkContextMenuControllerViewsDelegate* delegate,
Profile* profile,
PageNavigator* navigator,
@@ -78,7 +81,7 @@ class BookmarkContextMenuControllerViews : public BaseBookmarkModelObserver {
// Returns true if selection_ has at least one bookmark of type url.
bool HasURLs() const;
- gfx::NativeWindow parent_window_;
+ views::Widget* parent_widget_;
BookmarkContextMenuControllerViewsDelegate* delegate_;
Profile* profile_;
PageNavigator* navigator_;
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.cc b/chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.cc
index 3307ea3..d6f5e81 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.cc
@@ -24,12 +24,13 @@
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/base/resource/resource_bundle.h"
#include "views/controls/button/menu_button.h"
+#include "views/widget/widget.h"
using views::MenuItemView;
BookmarkMenuController::BookmarkMenuController(Profile* profile,
PageNavigator* navigator,
- gfx::NativeWindow parent,
+ views::Widget* parent,
const BookmarkNode* node,
int start_child_index)
: menu_delegate_(new BookmarkMenuDelegate(profile, navigator, parent, 1)),
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.h b/chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.h
index ae9adee..770d2b8 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.h
+++ b/chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.h
@@ -10,7 +10,6 @@
#include "chrome/browser/bookmarks/base_bookmark_model_observer.h"
#include "chrome/browser/bookmarks/bookmark_node_data.h"
-#include "ui/gfx/native_widget_types.h"
#include "views/controls/menu/menu_delegate.h"
#include "views/controls/menu/menu_item_view.h"
@@ -30,6 +29,7 @@ class OSExchangeData;
namespace views {
class MenuButton;
+class Widget;
} // namespace views
// BookmarkMenuController is responsible for showing a menu of bookmarks,
@@ -52,7 +52,7 @@ class BookmarkMenuController : public BaseBookmarkModelObserver,
// at |start_child_index|.
BookmarkMenuController(Profile* profile,
PageNavigator* page_navigator,
- gfx::NativeWindow parent,
+ views::Widget* parent,
const BookmarkNode* node,
int start_child_index);
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc b/chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc
index 83188af..2f5d002 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc
@@ -26,6 +26,7 @@
#include "views/controls/button/menu_button.h"
#include "views/controls/menu/menu_item_view.h"
#include "views/controls/menu/submenu_view.h"
+#include "views/widget/widget.h"
using views::MenuItemView;
@@ -35,7 +36,7 @@ static const int kMaxMenuWidth = 400;
BookmarkMenuDelegate::BookmarkMenuDelegate(Profile* profile,
PageNavigator* navigator,
- gfx::NativeWindow parent,
+ views::Widget* parent,
int first_menu_id)
: profile_(profile),
page_navigator_(navigator),
@@ -117,8 +118,8 @@ void BookmarkMenuDelegate::ExecuteCommand(int id, int mouse_event_flags) {
WindowOpenDisposition initial_disposition =
event_utils::DispositionFromEventFlags(mouse_event_flags);
- bookmark_utils::OpenAll(parent_, profile_, page_navigator_, selection,
- initial_disposition);
+ bookmark_utils::OpenAll(parent_->GetNativeWindow(), profile_, page_navigator_,
+ selection, initial_disposition);
}
bool BookmarkMenuDelegate::GetDropFormats(
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.h b/chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.h
index 105c8d6..9ad6ca6 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.h
+++ b/chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.h
@@ -12,7 +12,6 @@
#include "chrome/browser/bookmarks/base_bookmark_model_observer.h"
#include "chrome/browser/bookmarks/bookmark_node_data.h"
#include "chrome/browser/ui/views/bookmarks/bookmark_context_menu.h"
-#include "ui/gfx/native_widget_types.h"
#include "views/controls/menu/menu_delegate.h"
class BookmarkNode;
@@ -25,6 +24,7 @@ class OSExchangeData;
namespace views {
class MenuItemView;
+class Widget;
}
// BookmarkMenuDelegate acts as the (informal) views::MenuDelegate for showing
@@ -47,7 +47,7 @@ class BookmarkMenuDelegate : public BaseBookmarkModelObserver,
BookmarkMenuDelegate(Profile* profile,
PageNavigator* navigator,
- gfx::NativeWindow parent,
+ views::Widget* parent,
int first_menu_id);
virtual ~BookmarkMenuDelegate();
@@ -75,7 +75,7 @@ class BookmarkMenuDelegate : public BaseBookmarkModelObserver,
Profile* profile() { return profile_; }
- gfx::NativeWindow parent() { return parent_; }
+ views::Widget* parent() { return parent_; }
// Returns true if we're in the process of mutating the model. This happens
// when the user deletes menu items using the context menu.
@@ -153,7 +153,7 @@ class BookmarkMenuDelegate : public BaseBookmarkModelObserver,
PageNavigator* page_navigator_;
// Parent of menus.
- gfx::NativeWindow parent_;
+ views::Widget* parent_;
// Maps from menu id to BookmarkNode.
std::map<int, const BookmarkNode*> menu_id_to_node_map_;
diff --git a/chrome/browser/ui/views/browser_actions_container.cc b/chrome/browser/ui/views/browser_actions_container.cc
index cc124c8..a8a369e 100644
--- a/chrome/browser/ui/views/browser_actions_container.cc
+++ b/chrome/browser/ui/views/browser_actions_container.cc
@@ -261,8 +261,8 @@ void BrowserActionButton::ShowContextMenu(const gfx::Point& p,
context_menu_ = &menu;
gfx::Point screen_loc;
views::View::ConvertPointToScreen(this, &screen_loc);
- context_menu_->RunMenuAt(GetWidget()->GetNativeWindow(), NULL,
- gfx::Rect(screen_loc, size()), views::MenuItemView::TOPLEFT, true);
+ context_menu_->RunMenuAt(GetWidget(), NULL, gfx::Rect(screen_loc, size()),
+ views::MenuItemView::TOPLEFT, true);
SetButtonNotPushed();
context_menu_ = NULL;
@@ -712,7 +712,7 @@ void BrowserActionsContainer::RunMenu(View* source, const gfx::Point& pt) {
overflow_menu_ = new BrowserActionOverflowMenuController(
this, chevron_, browser_action_views_, VisibleBrowserActions());
overflow_menu_->set_observer(this);
- overflow_menu_->RunMenu(GetWidget()->GetNativeWindow(), false);
+ overflow_menu_->RunMenu(GetWidget(), false);
}
}
@@ -1025,7 +1025,7 @@ void BrowserActionsContainer::ShowDropFolder() {
overflow_menu_ = new BrowserActionOverflowMenuController(
this, chevron_, browser_action_views_, VisibleBrowserActions());
overflow_menu_->set_observer(this);
- overflow_menu_->RunMenu(GetWidget()->GetNativeWindow(), true);
+ overflow_menu_->RunMenu(GetWidget(), true);
}
void BrowserActionsContainer::SetDropIndicator(int x_pos) {
diff --git a/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc b/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc
index 0ed6a2f..621886d 100644
--- a/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc
+++ b/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc
@@ -56,7 +56,7 @@ BrowserActionOverflowMenuController::~BrowserActionOverflowMenuController() {
observer_->NotifyMenuDeleted(this);
}
-bool BrowserActionOverflowMenuController::RunMenu(gfx::NativeWindow window,
+bool BrowserActionOverflowMenuController::RunMenu(views::Widget* window,
bool for_drop) {
for_drop_ = for_drop;
@@ -106,7 +106,7 @@ bool BrowserActionOverflowMenuController::ShowContextMenu(
context_menu_model_adapter.BuildMenu(&context_menu);
// This blocks until the user choses something or dismisses the menu.
- context_menu.RunMenuAt(menu_button_->GetWidget()->GetNativeWindow(),
+ context_menu.RunMenuAt(menu_button_->GetWidget(),
NULL, gfx::Rect(p, gfx::Size()), views::MenuItemView::TOPLEFT, true);
// The user is done with the context menu, so we can close the underlying
diff --git a/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.h b/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.h
index 79d69f9..d9c4e75 100644
--- a/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.h
+++ b/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.h
@@ -16,6 +16,10 @@
class BrowserActionsContainer;
class BrowserActionView;
+namespace views {
+class Widget;
+}
+
// This class handles the overflow menu for browser actions (showing the menu,
// drag and drop, etc). This class manages its own lifetime.
class BrowserActionOverflowMenuController : public views::MenuDelegate {
@@ -36,7 +40,7 @@ class BrowserActionOverflowMenuController : public views::MenuDelegate {
void set_observer(Observer* observer) { observer_ = observer; }
// Shows the overflow menu.
- bool RunMenu(gfx::NativeWindow window, bool for_drop);
+ bool RunMenu(views::Widget* widget, bool for_drop);
// Closes the overflow menu (and its context menu if open as well).
void CancelMenu();
diff --git a/chrome/browser/ui/views/infobars/after_translate_infobar.cc b/chrome/browser/ui/views/infobars/after_translate_infobar.cc
index e08fffc..3ce1c3f 100644
--- a/chrome/browser/ui/views/infobars/after_translate_infobar.cc
+++ b/chrome/browser/ui/views/infobars/after_translate_infobar.cc
@@ -178,6 +178,6 @@ void AfterTranslateInfoBar::RunMenu(View* source, const gfx::Point& pt) {
views::MenuModelAdapter menu_model_adapter(menu_model);
views::MenuItemView menu(&menu_model_adapter);
menu_model_adapter.BuildMenu(&menu);
- menu.RunMenuAt(source->GetWidget()->GetNativeWindow(), NULL,
- gfx::Rect(pt, gfx::Size()), views::MenuItemView::TOPRIGHT, true);
+ menu.RunMenuAt(source->GetWidget(), NULL, gfx::Rect(pt, gfx::Size()),
+ views::MenuItemView::TOPRIGHT, true);
}
diff --git a/chrome/browser/ui/views/infobars/before_translate_infobar.cc b/chrome/browser/ui/views/infobars/before_translate_infobar.cc
index 1637922..b1f2909 100644
--- a/chrome/browser/ui/views/infobars/before_translate_infobar.cc
+++ b/chrome/browser/ui/views/infobars/before_translate_infobar.cc
@@ -199,6 +199,6 @@ void BeforeTranslateInfoBar::RunMenu(View* source, const gfx::Point& pt) {
views::MenuModelAdapter menu_model_adapter(menu_model);
views::MenuItemView menu(&menu_model_adapter);
menu_model_adapter.BuildMenu(&menu);
- menu.RunMenuAt(source->GetWidget()->GetNativeWindow(), NULL,
- gfx::Rect(pt, gfx::Size()), views::MenuItemView::TOPRIGHT, true);
+ menu.RunMenuAt(source->GetWidget(), NULL, gfx::Rect(pt, gfx::Size()),
+ views::MenuItemView::TOPRIGHT, true);
}
diff --git a/chrome/browser/ui/views/infobars/extension_infobar.cc b/chrome/browser/ui/views/infobars/extension_infobar.cc
index fcbb48e..4da0f4c 100644
--- a/chrome/browser/ui/views/infobars/extension_infobar.cc
+++ b/chrome/browser/ui/views/infobars/extension_infobar.cc
@@ -189,7 +189,7 @@ void ExtensionInfoBar::RunMenu(View* source, const gfx::Point& pt) {
gfx::Point screen_point;
views::View::ConvertPointToScreen(menu_, &screen_point);
- options_menu.RunMenuAt(GetWidget()->GetNativeWindow(), menu_,
+ options_menu.RunMenuAt(GetWidget(), menu_,
gfx::Rect(screen_point, menu_->size()), views::MenuItemView::TOPLEFT,
true);
}
diff --git a/chrome/browser/ui/views/location_bar/page_action_image_view.cc b/chrome/browser/ui/views/location_bar/page_action_image_view.cc
index 3cbad31..f8168f4 100644
--- a/chrome/browser/ui/views/location_bar/page_action_image_view.cc
+++ b/chrome/browser/ui/views/location_bar/page_action_image_view.cc
@@ -159,8 +159,8 @@ void PageActionImageView::ShowContextMenu(const gfx::Point& p,
gfx::Point screen_loc;
views::View::ConvertPointToScreen(this, &screen_loc);
- menu.RunMenuAt(GetWidget()->GetNativeWindow(), NULL,
- gfx::Rect(screen_loc ,size()), views::MenuItemView::TOPLEFT, true);
+ menu.RunMenuAt(GetWidget(), NULL, gfx::Rect(screen_loc ,size()),
+ views::MenuItemView::TOPLEFT, true);
}
void PageActionImageView::OnImageLoaded(
diff --git a/chrome/browser/ui/views/menu_item_view_test.cc b/chrome/browser/ui/views/menu_item_view_test.cc
index 05bf1ea..d4c9a90 100644
--- a/chrome/browser/ui/views/menu_item_view_test.cc
+++ b/chrome/browser/ui/views/menu_item_view_test.cc
@@ -68,7 +68,7 @@ class MenuItemViewTestBase : public ViewEventTestBase,
views::View::ConvertPointToScreen(source, &screen_location);
gfx::Rect bounds(screen_location, source->size());
menu_->RunMenuAt(
- source->GetWidget()->GetNativeWindow(),
+ source->GetWidget(),
button_,
bounds,
views::MenuItemView::TOPLEFT,
diff --git a/chrome/browser/ui/views/tab_contents/render_view_context_menu_views.cc b/chrome/browser/ui/views/tab_contents/render_view_context_menu_views.cc
index 9070005..41194b4 100644
--- a/chrome/browser/ui/views/tab_contents/render_view_context_menu_views.cc
+++ b/chrome/browser/ui/views/tab_contents/render_view_context_menu_views.cc
@@ -16,6 +16,13 @@
#include "views/controls/menu/menu_model_adapter.h"
#include "views/controls/menu/menu_runner.h"
+#if defined(TOUCH_UI)
+#include "chrome/browser/ui/views/tab_contents/tab_contents_view_touch.h"
+#include "views/widget/widget.h"
+#else
+#include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h"
+#endif
+
////////////////////////////////////////////////////////////////////////////////
// RenderViewContextMenuViews, public:
@@ -30,9 +37,19 @@ RenderViewContextMenuViews::~RenderViewContextMenuViews() {
}
void RenderViewContextMenuViews::RunMenuAt(int x, int y) {
- menu_runner_->RunMenuAt(
- source_tab_contents_->view()->GetTopLevelNativeWindow(),
- NULL, gfx::Rect(gfx::Point(x, y), gfx::Size()),
+#if defined(TOUCH_UI)
+ // TODO(oshima): Eliminate this once TabContentsViewTouch is replaced
+ // with TabContentsViewViews.
+ TabContentsViewTouch* touch =
+ static_cast<TabContentsViewTouch*>(source_tab_contents_->view());
+ views::Widget* parent = touch->GetWidget()->GetTopLevelWidget();
+#else
+ TabContentsViewViews* tab =
+ static_cast<TabContentsViewViews*>(source_tab_contents_->view());
+ views::Widget* parent = tab->GetTopLevelWidget();
+#endif
+ menu_runner_->RunMenuAt(parent, NULL,
+ gfx::Rect(gfx::Point(x, y), gfx::Size()),
views::MenuItemView::TOPLEFT, true);
}
diff --git a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
index d6179f2..92b8414 100644
--- a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
+++ b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
@@ -64,8 +64,8 @@ class BrowserTabStripController::TabContextMenuContents
}
void RunMenuAt(const gfx::Point& point) {
- menu_.RunMenuAt(tab_->GetWidget()->GetNativeWindow(), NULL,
- gfx::Rect(point, gfx::Size()), views::MenuItemView::TOPLEFT, true);
+ menu_.RunMenuAt(tab_->GetWidget(), NULL, gfx::Rect(point, gfx::Size()),
+ views::MenuItemView::TOPLEFT, true);
// We could be gone now. Assume |this| is junk!
}
diff --git a/chrome/browser/ui/views/wrench_menu.cc b/chrome/browser/ui/views/wrench_menu.cc
index 0da990d..386e8d5 100644
--- a/chrome/browser/ui/views/wrench_menu.cc
+++ b/chrome/browser/ui/views/wrench_menu.cc
@@ -592,7 +592,7 @@ void WrenchMenu::RunMenu(views::MenuButton* host) {
views::View::ConvertPointToScreen(host, &screen_loc);
gfx::Rect bounds(screen_loc, host->size());
UserMetrics::RecordAction(UserMetricsAction("ShowAppMenu"));
- root_->RunMenuAt(host->GetWidget()->GetNativeWindow(), host, bounds,
+ root_->RunMenuAt(host->GetWidget(), host, bounds,
MenuItemView::TOPRIGHT, true);
if (bookmark_menu_delegate_.get()) {
BookmarkModel* model = browser_->profile()->GetBookmarkModel();
@@ -853,10 +853,14 @@ void WrenchMenu::CreateBookmarkMenu() {
return;
model->AddObserver(this);
+
+ // TODO(oshima): Replace with views only API.
+ views::Widget* parent = views::Widget::GetWidgetForNativeWindow(
+ browser_->window()->GetNativeHandle());
bookmark_menu_delegate_.reset(
new BookmarkMenuDelegate(browser_->profile(),
NULL,
- browser_->window()->GetNativeHandle(),
+ parent,
first_bookmark_command_id_));
bookmark_menu_delegate_->Init(
this, bookmark_menu_, model->bookmark_bar_node(), 0,
diff --git a/views/controls/button/button_dropdown.cc b/views/controls/button/button_dropdown.cc
index 01f13ca..16c0313 100644
--- a/views/controls/button/button_dropdown.cc
+++ b/views/controls/button/button_dropdown.cc
@@ -158,14 +158,14 @@ void ButtonDropDown::ShowDropDownMenu(gfx::NativeView window) {
MenuItemView menu(&menu_delegate);
menu_delegate.BuildMenu(&menu);
- menu.RunMenuAt(GetWidget()->GetNativeWindow(), NULL,
+ menu.RunMenuAt(GetWidget(), NULL,
gfx::Rect(menu_position, gfx::Size(0, 0)),
views::MenuItemView::TOPLEFT,
true);
} else {
MenuDelegate menu_delegate;
MenuItemView menu(&menu_delegate);
- menu.RunMenuAt(GetWidget()->GetNativeWindow(), NULL,
+ menu.RunMenuAt(GetWidget(), NULL,
gfx::Rect(menu_position, gfx::Size(0, 0)),
views::MenuItemView::TOPLEFT,
true);
diff --git a/views/controls/menu/menu_controller.cc b/views/controls/menu/menu_controller.cc
index 3fae8bc..64b2193 100644
--- a/views/controls/menu/menu_controller.cc
+++ b/views/controls/menu/menu_controller.cc
@@ -257,7 +257,7 @@ MenuController* MenuController::GetActiveInstance() {
return active_instance_;
}
-MenuItemView* MenuController::Run(gfx::NativeWindow parent,
+MenuItemView* MenuController::Run(Widget* parent,
MenuButton* button,
MenuItemView* root,
const gfx::Rect& bounds,
@@ -277,7 +277,7 @@ MenuItemView* MenuController::Run(gfx::NativeWindow parent,
menu_stack_.push_back(state_);
// The context menu should be owned by the same parent.
- DCHECK(owner_ == parent);
+ DCHECK_EQ(owner_, parent);
} else {
showing_ = true;
}
@@ -1066,7 +1066,8 @@ bool MenuController::ShowSiblingMenu(SubmenuView* source,
gfx::NativeWindow window_under_mouse =
gfx::Screen::GetWindowAtCursorScreenPoint();
- if (window_under_mouse != owner_)
+ // TODO(oshima): Replace with views only API.
+ if (window_under_mouse != owner_->GetNativeWindow())
return false;
// The user moved the mouse outside the menu and over the owning window. See
diff --git a/views/controls/menu/menu_controller.h b/views/controls/menu/menu_controller.h
index 7721a6e..83beb17 100644
--- a/views/controls/menu/menu_controller.h
+++ b/views/controls/menu/menu_controller.h
@@ -64,7 +64,7 @@ class MenuController : public MessageLoopForUI::Dispatcher {
// Runs the menu at the specified location. If the menu was configured to
// block, the selected item is returned. If the menu does not block this
// returns NULL immediately.
- MenuItemView* Run(gfx::NativeWindow parent,
+ MenuItemView* Run(Widget* parent,
MenuButton* button,
MenuItemView* root,
const gfx::Rect& bounds,
@@ -455,7 +455,7 @@ class MenuController : public MessageLoopForUI::Dispatcher {
MenuDelegate::DropPosition drop_position_;
// Owner of child windows.
- gfx::NativeWindow owner_;
+ Widget* owner_;
// Indicates a possible drag operation.
bool possible_drag_;
diff --git a/views/controls/menu/menu_host.cc b/views/controls/menu/menu_host.cc
index f43800d..cd6a8ae 100644
--- a/views/controls/menu/menu_host.cc
+++ b/views/controls/menu/menu_host.cc
@@ -26,17 +26,13 @@ MenuHost::MenuHost(SubmenuView* submenu)
MenuHost::~MenuHost() {
}
-void MenuHost::InitMenuHost(gfx::NativeWindow parent,
+void MenuHost::InitMenuHost(Widget* parent,
const gfx::Rect& bounds,
View* contents_view,
bool do_capture) {
Widget::InitParams params(Widget::InitParams::TYPE_MENU);
params.has_dropshadow = true;
-#if defined(OS_WIN)
- params.parent = parent;
-#elif defined(TOOLKIT_USES_GTK)
- params.parent = GTK_WIDGET(parent);
-#endif
+ params.parent_widget = parent;
params.bounds = bounds;
Init(params);
SetContentsView(contents_view);
diff --git a/views/controls/menu/menu_host.h b/views/controls/menu/menu_host.h
index 3edffb2..7fd76a6 100644
--- a/views/controls/menu/menu_host.h
+++ b/views/controls/menu/menu_host.h
@@ -7,7 +7,6 @@
#pragma once
#include "base/compiler_specific.h"
-#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/rect.h"
#include "views/controls/menu/native_menu_host_delegate.h"
#include "views/widget/widget.h"
@@ -33,7 +32,7 @@ class MenuHost : public Widget {
virtual ~MenuHost();
// Initializes and shows the MenuHost.
- void InitMenuHost(gfx::NativeWindow parent,
+ void InitMenuHost(Widget* parent,
const gfx::Rect& bounds,
View* contents_view,
bool do_capture);
@@ -57,9 +56,6 @@ class MenuHost : public Widget {
// Releases a mouse grab installed by |ShowMenuHost|.
void ReleaseMenuHostCapture();
- // Returns the native window of the MenuHost.
- gfx::NativeWindow GetMenuHostWindow();
-
private:
// Overridden from Widget:
virtual internal::RootView* CreateRootView() OVERRIDE;
diff --git a/views/controls/menu/menu_item_view.cc b/views/controls/menu/menu_item_view.cc
index e8f0026..eff0e39 100644
--- a/views/controls/menu/menu_item_view.cc
+++ b/views/controls/menu/menu_item_view.cc
@@ -171,7 +171,7 @@ string16 MenuItemView::GetAccessibleNameForMenuItem(
return accessible_name;
}
-void MenuItemView::RunMenuAt(gfx::NativeWindow parent,
+void MenuItemView::RunMenuAt(Widget* parent,
MenuButton* button,
const gfx::Rect& bounds,
AnchorPosition anchor,
@@ -231,7 +231,7 @@ void MenuItemView::RunMenuAt(gfx::NativeWindow parent,
delegate_->ExecuteCommand(result->GetCommand(), mouse_event_flags);
}
-void MenuItemView::RunMenuForDropAt(gfx::NativeWindow parent,
+void MenuItemView::RunMenuForDropAt(Widget* parent,
const gfx::Rect& bounds,
AnchorPosition anchor) {
PrepareForRun(false, false);
diff --git a/views/controls/menu/menu_item_view.h b/views/controls/menu/menu_item_view.h
index ba2a365..1403729e 100644
--- a/views/controls/menu/menu_item_view.h
+++ b/views/controls/menu/menu_item_view.h
@@ -135,12 +135,12 @@ class MenuItemView : public View {
// whether the items have mnemonics. Mnemonics are identified by way of the
// character following the '&'. The anchor position is specified for non-RTL
// languages; the opposite value will be used for RTL.
- void RunMenuAt(gfx::NativeWindow parent,
+ void RunMenuAt(Widget* parent,
MenuButton* button,
const gfx::Rect& bounds,
AnchorPosition anchor,
bool has_mnemonics);
- void RunMenuForDropAt(gfx::NativeWindow parent,
+ void RunMenuForDropAt(Widget* parent,
const gfx::Rect& bounds,
AnchorPosition anchor);
diff --git a/views/controls/menu/menu_runner.cc b/views/controls/menu/menu_runner.cc
index 78cb005..f210cc3 100644
--- a/views/controls/menu/menu_runner.cc
+++ b/views/controls/menu/menu_runner.cc
@@ -18,7 +18,7 @@ class MenuRunner::Holder {
void Release();
// Runs the menu.
- void RunMenuAt(gfx::NativeWindow parent,
+ void RunMenuAt(Widget* parent,
MenuButton* button,
const gfx::Rect& bounds,
MenuItemView::AnchorPosition anchor,
@@ -57,7 +57,7 @@ void MenuRunner::Holder::Release() {
}
}
-void MenuRunner::Holder::RunMenuAt(gfx::NativeWindow parent,
+void MenuRunner::Holder::RunMenuAt(Widget* parent,
MenuButton* button,
const gfx::Rect& bounds,
MenuItemView::AnchorPosition anchor,
@@ -81,7 +81,7 @@ MenuRunner::~MenuRunner() {
holder_->Release();
}
-void MenuRunner::RunMenuAt(gfx::NativeWindow parent,
+void MenuRunner::RunMenuAt(Widget* parent,
MenuButton* button,
const gfx::Rect& bounds,
MenuItemView::AnchorPosition anchor,
diff --git a/views/controls/menu/menu_runner.h b/views/controls/menu/menu_runner.h
index 4892b1e..3dfece5 100644
--- a/views/controls/menu/menu_runner.h
+++ b/views/controls/menu/menu_runner.h
@@ -13,6 +13,7 @@
namespace views {
class MenuButton;
+class Widget;
// MenuRunner handles the lifetime of the root MenuItemView. MenuItemView runs a
// nested message loop, which means care must be taken when the MenuItemView
@@ -30,7 +31,7 @@ class MenuRunner {
~MenuRunner();
// Runs the menu.
- void RunMenuAt(gfx::NativeWindow parent,
+ void RunMenuAt(Widget* parent,
MenuButton* button,
const gfx::Rect& bounds,
MenuItemView::AnchorPosition anchor,
diff --git a/views/controls/menu/submenu_view.cc b/views/controls/menu/submenu_view.cc
index 987cf15..5664a8d 100644
--- a/views/controls/menu/submenu_view.cc
+++ b/views/controls/menu/submenu_view.cc
@@ -231,7 +231,7 @@ bool SubmenuView::IsShowing() {
return host_ && host_->IsMenuHostVisible();
}
-void SubmenuView::ShowAt(gfx::NativeWindow parent,
+void SubmenuView::ShowAt(Widget* parent,
const gfx::Rect& bounds,
bool do_capture) {
if (host_) {
diff --git a/views/controls/menu/submenu_view.h b/views/controls/menu/submenu_view.h
index 0caeffc..1ec627b 100644
--- a/views/controls/menu/submenu_view.h
+++ b/views/controls/menu/submenu_view.h
@@ -78,7 +78,7 @@ class SubmenuView : public View {
// Shows the menu at the specified location. Coordinates are in screen
// coordinates. max_width gives the max width the view should be.
- void ShowAt(gfx::NativeWindow parent,
+ void ShowAt(Widget* parent,
const gfx::Rect& bounds,
bool do_capture);
diff --git a/views/controls/textfield/native_textfield_views.cc b/views/controls/textfield/native_textfield_views.cc
index b3f005d..c8ec99f 100644
--- a/views/controls/textfield/native_textfield_views.cc
+++ b/views/controls/textfield/native_textfield_views.cc
@@ -265,7 +265,7 @@ void NativeTextfieldViews::ShowContextMenuForView(View* source,
const gfx::Point& p,
bool is_mouse_gesture) {
UpdateContextMenu();
- context_menu_menu_->RunMenuAt(GetWidget()->GetNativeWindow(),
+ context_menu_menu_->RunMenuAt(GetWidget(),
NULL,
gfx::Rect(p, gfx::Size()),
views::MenuItemView::TOPLEFT,