summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-12 19:29:06 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-12 19:29:06 +0000
commited8b1b805203b6ccdb5517d0c30cc689dde65e98 (patch)
tree88b8d0c2e552f291fbb01e8aa660806597e9d3fc
parent71994cd0877f3528079b1154d46d90801e515292 (diff)
downloadchromium_src-ed8b1b805203b6ccdb5517d0c30cc689dde65e98.zip
chromium_src-ed8b1b805203b6ccdb5517d0c30cc689dde65e98.tar.gz
chromium_src-ed8b1b805203b6ccdb5517d0c30cc689dde65e98.tar.bz2
Make Widget return a gfx::NativeView instead of a HWND.
Review URL: http://codereview.chromium.org/43124 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11562 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/external_tab_container.cc4
-rw-r--r--chrome/browser/external_tab_container.h2
-rw-r--r--chrome/browser/tab_contents/web_contents_view_win.cc28
-rw-r--r--chrome/browser/task_manager.cc2
-rw-r--r--chrome/browser/views/about_chrome_view.cc2
-rw-r--r--chrome/browser/views/about_ipc_dialog.cc4
-rw-r--r--chrome/browser/views/blocked_popup_container.cc3
-rw-r--r--chrome/browser/views/bookmark_bar_view.cc259
-rw-r--r--chrome/browser/views/bookmark_bubble_view.cc6
-rw-r--r--chrome/browser/views/bookmark_editor_view.cc3
-rw-r--r--chrome/browser/views/bookmark_manager_view.cc17
-rw-r--r--chrome/browser/views/constrained_window_impl.cc6
-rw-r--r--chrome/browser/views/download_item_view.cc2
-rw-r--r--chrome/browser/views/find_bar_win.cc6
-rw-r--r--chrome/browser/views/first_run_customize_view.cc3
-rw-r--r--chrome/browser/views/first_run_view.cc4
-rw-r--r--chrome/browser/views/frame/browser_frame.cc16
-rw-r--r--chrome/browser/views/frame/browser_view.cc34
-rw-r--r--chrome/browser/views/frame/glass_browser_frame_view.cc6
-rw-r--r--chrome/browser/views/fullscreen_exit_bubble.cc2
-rw-r--r--chrome/browser/views/hung_renderer_view.cc2
-rw-r--r--chrome/browser/views/hwnd_html_view.cc2
-rw-r--r--chrome/browser/views/info_bubble.cc6
-rw-r--r--chrome/browser/views/infobars/infobars.cc2
-rw-r--r--chrome/browser/views/keyword_editor_view.cc7
-rw-r--r--chrome/browser/views/location_bar_view.cc8
-rw-r--r--chrome/browser/views/options/advanced_contents_view.cc2
-rw-r--r--chrome/browser/views/options/fonts_page_view.cc2
-rw-r--r--chrome/browser/views/options/languages_page_view.cc2
-rw-r--r--chrome/browser/views/options/options_page_view.cc2
-rw-r--r--chrome/browser/views/shelf_item_dialog.cc2
-rw-r--r--chrome/browser/views/status_bubble_views.cc6
-rw-r--r--chrome/browser/views/tab_contents_container_view.cc4
-rw-r--r--chrome/browser/views/tabs/dragged_tab_controller.cc16
-rw-r--r--chrome/browser/views/tabs/dragged_tab_view.cc4
-rw-r--r--chrome/browser/views/tabs/hwnd_photobooth.cc8
-rw-r--r--chrome/browser/views/tabs/tab.cc2
-rw-r--r--chrome/browser/views/tabs/tab_strip.cc7
-rw-r--r--chrome/browser/views/toolbar_view.cc4
-rw-r--r--chrome/browser/views/user_data_dir_dialog.cc2
-rw-r--r--chrome/test/interactive_ui/view_event_test_base.cc4
-rw-r--r--chrome/views/accessibility/view_accessibility.cc4
-rw-r--r--chrome/views/bitmap_scroll_bar.cc2
-rw-r--r--chrome/views/button_dropdown.cc8
-rw-r--r--chrome/views/chrome_menu.cc6
-rw-r--r--chrome/views/focus_manager.cc2
-rw-r--r--chrome/views/focus_manager_unittest.cc6
-rw-r--r--chrome/views/hwnd_view.cc4
-rw-r--r--chrome/views/menu_button.cc4
-rw-r--r--chrome/views/native_control.cc2
-rw-r--r--chrome/views/native_frame_view.cc2
-rw-r--r--chrome/views/native_scroll_bar.cc4
-rw-r--r--chrome/views/non_client_view.cc6
-rw-r--r--chrome/views/root_view.cc6
-rw-r--r--chrome/views/root_view_drop_target.cc2
-rw-r--r--chrome/views/text_field.cc2
-rw-r--r--chrome/views/tree_view.cc2
-rw-r--r--chrome/views/view_win.cc4
-rw-r--r--chrome/views/widget.h11
-rw-r--r--chrome/views/widget_win.cc26
-rw-r--r--chrome/views/widget_win.h40
-rw-r--r--chrome/views/window.cc93
62 files changed, 499 insertions, 240 deletions
diff --git a/chrome/browser/external_tab_container.cc b/chrome/browser/external_tab_container.cc
index 9fc97ce..03be06c 100644
--- a/chrome/browser/external_tab_container.cc
+++ b/chrome/browser/external_tab_container.cc
@@ -172,7 +172,7 @@ LRESULT ExternalTabContainer::OnSetFocus(UINT msg, WPARAM wp, LPARAM lp,
BOOL& handled) {
if (automation_) {
views::FocusManager* focus_manager =
- views::FocusManager::GetFocusManager(GetHWND());
+ views::FocusManager::GetFocusManager(GetNativeView());
DCHECK(focus_manager);
if (focus_manager) {
focus_manager->ClearFocus();
@@ -330,7 +330,7 @@ void ExternalTabContainer::GetBounds(gfx::Rect* out,
void ExternalTabContainer::MoveToFront(bool should_activate) {
}
-HWND ExternalTabContainer::GetHWND() const {
+gfx::NativeView ExternalTabContainer::GetNativeView() const {
return m_hWnd;
}
diff --git a/chrome/browser/external_tab_container.h b/chrome/browser/external_tab_container.h
index d1825d0..30c00ec 100644
--- a/chrome/browser/external_tab_container.h
+++ b/chrome/browser/external_tab_container.h
@@ -100,7 +100,7 @@ class ExternalTabContainer : public TabContentsDelegate,
/////////////////////////////////////////////////////////////////////////////
virtual void GetBounds(gfx::Rect* out, bool including_frame) const;
virtual void MoveToFront(bool should_activate);
- virtual HWND GetHWND() const;
+ virtual gfx::NativeView GetNativeView() const;
virtual void PaintNow(const gfx::Rect& update_rect);
virtual views::RootView* GetRootView();
virtual bool IsVisible();
diff --git a/chrome/browser/tab_contents/web_contents_view_win.cc b/chrome/browser/tab_contents/web_contents_view_win.cc
index c1842cd..2a2ffdd 100644
--- a/chrome/browser/tab_contents/web_contents_view_win.cc
+++ b/chrome/browser/tab_contents/web_contents_view_win.cc
@@ -80,8 +80,8 @@ void WebContentsViewWin::CreateView() {
WidgetWin::Init(GetDesktopWindow(), gfx::Rect(), false);
// Remove the root view drop target so we can register our own.
- RevokeDragDrop(GetHWND());
- drop_target_ = new WebDropTarget(GetHWND(), web_contents_);
+ RevokeDragDrop(GetNativeView());
+ drop_target_ = new WebDropTarget(GetNativeView(), web_contents_);
}
RenderWidgetHostView* WebContentsViewWin::CreateViewForWidget(
@@ -89,13 +89,13 @@ RenderWidgetHostView* WebContentsViewWin::CreateViewForWidget(
DCHECK(!render_widget_host->view());
RenderWidgetHostViewWin* view =
new RenderWidgetHostViewWin(render_widget_host);
- view->Create(GetHWND());
+ view->Create(GetNativeView());
view->ShowWindow(SW_SHOW);
return view;
}
gfx::NativeView WebContentsViewWin::GetNativeView() const {
- return GetHWND();
+ return WidgetWin::GetNativeView();
}
gfx::NativeView WebContentsViewWin::GetContentNativeView() const {
@@ -157,7 +157,7 @@ void WebContentsViewWin::StartDragging(const WebDropData& drop_data) {
data->SetString(drop_data.plain_text);
scoped_refptr<WebDragSource> drag_source(
- new WebDragSource(GetHWND(), web_contents_->render_view_host()));
+ new WebDragSource(GetNativeView(), web_contents_->render_view_host()));
DWORD effects;
@@ -191,12 +191,12 @@ void WebContentsViewWin::OnContentsDestroy() {
// away. This will prevent the plugin windows from getting destroyed
// automatically. The detached plugin windows will get cleaned up in proper
// sequence as part of the usual cleanup when the plugin instance goes away.
- EnumChildWindows(GetHWND(), DetachPluginWindowsCallback, NULL);
+ EnumChildWindows(GetNativeView(), DetachPluginWindowsCallback, NULL);
}
void WebContentsViewWin::OnDestroy() {
if (drop_target_.get()) {
- RevokeDragDrop(GetHWND());
+ RevokeDragDrop(GetNativeView());
drop_target_ = NULL;
}
}
@@ -339,7 +339,7 @@ void WebContentsViewWin::HandleKeyboardEvent(
// a keyboard shortcut that we have to process.
if (event.type == WebInputEvent::RAW_KEY_DOWN) {
views::FocusManager* focus_manager =
- views::FocusManager::GetFocusManager(GetHWND());
+ views::FocusManager::GetFocusManager(GetNativeView());
// We may not have a focus_manager at this point (if the tab has been
// switched by the time this message returned).
if (focus_manager) {
@@ -378,10 +378,10 @@ void WebContentsViewWin::HandleKeyboardEvent(
void WebContentsViewWin::ShowContextMenu(const ContextMenuParams& params) {
RenderViewContextMenuWin menu(web_contents_,
params,
- GetHWND());
+ GetNativeView());
POINT screen_pt = { params.x, params.y };
- MapWindowPoints(GetHWND(), HWND_DESKTOP, &screen_pt, 1);
+ MapWindowPoints(GetNativeView(), HWND_DESKTOP, &screen_pt, 1);
// Enable recursive tasks on the message loop so we can get updates while
// the context menu is being displayed.
@@ -533,7 +533,7 @@ void WebContentsViewWin::OnPaint(HDC junk_dc) {
CRect cr;
GetClientRect(&cr);
sad_tab_->SetBounds(gfx::Rect(cr));
- ChromeCanvasPaint canvas(GetHWND(), true);
+ ChromeCanvasPaint canvas(GetNativeView(), true);
sad_tab_->ProcessPaint(&canvas);
return;
}
@@ -541,7 +541,7 @@ void WebContentsViewWin::OnPaint(HDC junk_dc) {
// We need to do this to validate the dirty area so we don't end up in a
// WM_PAINTstorm that causes other mysterious bugs (such as WM_TIMERs not
// firing etc). It doesn't matter that we don't have any non-clipped area.
- CPaintDC dc(GetHWND());
+ CPaintDC dc(GetNativeView());
SetMsgHandled(FALSE);
}
@@ -620,8 +620,8 @@ void WebContentsViewWin::OnSize(UINT param, const CSize& size) {
si.nPage = 10;
si.nPos = 50;
- ::SetScrollInfo(GetHWND(), SB_HORZ, &si, FALSE);
- ::SetScrollInfo(GetHWND(), SB_VERT, &si, FALSE);
+ ::SetScrollInfo(GetNativeView(), SB_HORZ, &si, FALSE);
+ ::SetScrollInfo(GetNativeView(), SB_VERT, &si, FALSE);
}
LRESULT WebContentsViewWin::OnNCCalcSize(BOOL w_param, LPARAM l_param) {
diff --git a/chrome/browser/task_manager.cc b/chrome/browser/task_manager.cc
index 4a4ac65..cacb30c 100644
--- a/chrome/browser/task_manager.cc
+++ b/chrome/browser/task_manager.cc
@@ -928,7 +928,7 @@ void TaskManagerContents::ShowContextMenu(views::View* source,
int y,
bool is_mouse_gesture) {
UpdateStatsCounters();
- Menu menu(this, Menu::TOPLEFT, source->GetWidget()->GetHWND());
+ Menu menu(this, Menu::TOPLEFT, source->GetWidget()->GetNativeView());
for (std::vector<views::TableColumn>::iterator i =
columns_.begin(); i != columns_.end(); ++i) {
menu.AppendMenuItem(i->id, i->title, Menu::CHECKBOX);
diff --git a/chrome/browser/views/about_chrome_view.cc b/chrome/browser/views/about_chrome_view.cc
index b6e4b3d..91c10e0 100644
--- a/chrome/browser/views/about_chrome_view.cc
+++ b/chrome/browser/views/about_chrome_view.cc
@@ -784,7 +784,7 @@ void AboutChromeView::UpdateStatus(GoogleUpdateUpgradeResult result,
new_version_available_);
update_label_.SetText(update_string);
show_success_indicator = true;
- RestartMessageBox::ShowMessageBox(window()->GetHWND());
+ RestartMessageBox::ShowMessageBox(window()->GetNativeView());
break;
}
case UPGRADE_ERROR:
diff --git a/chrome/browser/views/about_ipc_dialog.cc b/chrome/browser/views/about_ipc_dialog.cc
index d1a92dc..673661d 100644
--- a/chrome/browser/views/about_ipc_dialog.cc
+++ b/chrome/browser/views/about_ipc_dialog.cc
@@ -348,7 +348,7 @@ std::wstring AboutIPCDialog::GetWindowTitle() const {
void AboutIPCDialog::Layout() {
if (!message_list_.m_hWnd) {
- HWND parent_window = GetRootView()->GetWidget()->GetHWND();
+ HWND parent_window = GetRootView()->GetWidget()->GetNativeView();
CRect rect(0, 0, 10, 10);
HWND list_hwnd = message_list_.Create(parent_window,
@@ -433,7 +433,7 @@ void AboutIPCDialog::ButtonPressed(views::BaseButton* button) {
} else if (button == clear_button_) {
message_list_.DeleteAllItems();
} else if (button == filter_button_) {
- RunSettingsDialog(GetRootView()->GetWidget()->GetHWND());
+ RunSettingsDialog(GetRootView()->GetWidget()->GetNativeView());
}
}
diff --git a/chrome/browser/views/blocked_popup_container.cc b/chrome/browser/views/blocked_popup_container.cc
index 8edf71e..bd513cf 100644
--- a/chrome/browser/views/blocked_popup_container.cc
+++ b/chrome/browser/views/blocked_popup_container.cc
@@ -176,7 +176,8 @@ gfx::Size BlockedPopupContainerView::GetPreferredSize() {
void BlockedPopupContainerView::ButtonPressed(views::BaseButton* sender) {
if (sender == popup_count_label_) {
- launch_menu_.reset(new Menu(this, Menu::TOPLEFT, container_->GetHWND()));
+ launch_menu_.reset(new Menu(this, Menu::TOPLEFT,
+ container_->GetNativeView()));
int item_count = container_->GetTabContentsCount();
for (int i = 0; i < item_count; ++i) {
diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc
index dbfb38f..6a1c2e6 100644
--- a/chrome/browser/views/bookmark_bar_view.cc
+++ b/chrome/browser/views/bookmark_bar_view.cc
@@ -358,6 +358,254 @@ struct DropInfo {
BookmarkDragData data;
};
+<<<<<<< .mine
+// MenuRunner -----------------------------------------------------------------
+
+// MenuRunner manages creation and showing of a menu containing BookmarkNodes.
+// MenuRunner is used to show the contents of bookmark folders on the
+// bookmark bar, other folder, or overflow bookmarks.
+//
+class MenuRunner : public views::MenuDelegate,
+ public BookmarkBarView::ModelChangedListener {
+ public:
+ // start_child_index is the index of the first child in node to add to the
+ // menu.
+ MenuRunner(BookmarkBarView* view, BookmarkNode* node, int start_child_index)
+ : view_(view),
+ node_(node),
+ menu_(this) {
+ int next_menu_id = 1;
+ menu_id_to_node_map_[menu_.GetCommand()] = node;
+ menu_.set_has_icons(true);
+ BuildMenu(node, start_child_index, &menu_, &next_menu_id);
+ }
+
+ // Returns the node the menu is being run for.
+ BookmarkNode* GetNode() {
+ return node_;
+ }
+
+ void RunMenuAt(HWND hwnd,
+ const gfx::Rect& bounds,
+ MenuItemView::AnchorPosition position,
+ bool for_drop) {
+ view_->SetModelChangedListener(this);
+ if (for_drop)
+ menu_.RunMenuForDropAt(hwnd, bounds, position);
+ else
+ menu_.RunMenuAt(hwnd, bounds, position, false);
+ view_->ClearModelChangedListenerIfEquals(this);
+ }
+
+ // Notification that the favicon has finished loading. Reset the icon
+ // of the menu item.
+ void FavIconLoaded(BookmarkNode* node) {
+ if (node_to_menu_id_map_.find(node) !=
+ node_to_menu_id_map_.end()) {
+ menu_.SetIcon(node->GetFavIcon(), node_to_menu_id_map_[node]);
+ }
+ }
+
+ virtual void ModelChanged() {
+ menu_.Cancel();
+ }
+
+ MenuItemView* menu() { return &menu_; }
+
+ MenuItemView* context_menu() {
+ return context_menu_.get() ? context_menu_->menu() : NULL;
+ }
+
+ private:
+ // Creates an entry in menu for each child node of parent starting at
+ // start_child_index, recursively invoking this for any star groups.
+ void BuildMenu(BookmarkNode* parent,
+ int start_child_index,
+ MenuItemView* menu,
+ int* next_menu_id) {
+ DCHECK(!parent->GetChildCount() ||
+
+ start_child_index < parent->GetChildCount());
+ for (int i = start_child_index; i < parent->GetChildCount(); ++i) {
+ BookmarkNode* node = parent->GetChild(i);
+ int id = *next_menu_id;
+
+ (*next_menu_id)++;
+ if (node->GetType() == history::StarredEntry::URL) {
+ SkBitmap icon = node->GetFavIcon();
+ if (icon.width() == 0)
+ icon = *kDefaultFavIcon;
+ menu->AppendMenuItemWithIcon(id, node->GetTitle(), icon);
+ node_to_menu_id_map_[node] = id;
+ } else {
+ SkBitmap* folder_icon =
+ ResourceBundle::GetSharedInstance().GetBitmapNamed(
+ IDR_BOOKMARK_BAR_FOLDER);
+ MenuItemView* submenu = menu->AppendSubMenuWithIcon(
+ id, node->GetTitle(), *folder_icon);
+ BuildMenu(node, 0, submenu, next_menu_id);
+ }
+ menu_id_to_node_map_[id] = node;
+ }
+ }
+
+ // ViewMenuDelegate method. Overridden to forward to the PageNavigator so
+ // that we accept any events that may trigger opening a url.
+ virtual bool IsTriggerableEvent(const views::MouseEvent& e) {
+ return event_utils::IsPossibleDispositionEvent(e);
+ }
+
+ // Invoked when a menu item is selected. Uses the PageNavigator set on
+ // the BookmarkBarView to open the URL.
+ virtual void ExecuteCommand(int id, int mouse_event_flags) {
+ DCHECK(view_->GetPageNavigator());
+ GURL url;
+ DCHECK(menu_id_to_node_map_.find(id) != menu_id_to_node_map_.end());
+ url = menu_id_to_node_map_[id]->GetURL();
+ view_->GetPageNavigator()->OpenURL(
+ url, GURL(), event_utils::DispositionFromEventFlags(mouse_event_flags),
+ PageTransition::AUTO_BOOKMARK);
+ }
+
+ virtual bool CanDrop(MenuItemView* menu, const OSExchangeData& data) {
+ // Only accept drops of 1 node, which is the case for all data dragged from
+ // bookmark bar and menus.
+ if (!drop_data_.Read(data) || drop_data_.elements.size() != 1)
+ return false;
+
+ if (drop_data_.has_single_url())
+ return true;
+
+ BookmarkNode* drag_node = drop_data_.GetFirstNode(view_->GetProfile());
+ if (!drag_node) {
+ // Dragging a group from another profile, always accept.
+ return true;
+ }
+ // Drag originated from same profile and is not a URL. Only accept it if
+ // the dragged node is not a parent of the node menu represents.
+ BookmarkNode* drop_node = menu_id_to_node_map_[menu->GetCommand()];
+ DCHECK(drop_node);
+ BookmarkNode* node = drop_node;
+ while (drop_node && drop_node != drag_node)
+ drop_node = drop_node->GetParent();
+ return (drop_node == NULL);
+ }
+
+ virtual int GetDropOperation(MenuItemView* item,
+ const views::DropTargetEvent& event,
+ DropPosition* position) {
+ DCHECK(drop_data_.is_valid());
+ BookmarkNode* node = menu_id_to_node_map_[item->GetCommand()];
+ BookmarkNode* drop_parent = node->GetParent();
+ int index_to_drop_at = drop_parent->IndexOfChild(node);
+ if (*position == DROP_AFTER) {
+ index_to_drop_at++;
+ } else if (*position == DROP_ON) {
+ drop_parent = node;
+ index_to_drop_at = node->GetChildCount();
+ }
+ DCHECK(drop_parent);
+ return view_->CalculateDropOperation(event, drop_data_, drop_parent,
+ index_to_drop_at);
+ }
+
+ virtual int OnPerformDrop(MenuItemView* menu,
+ DropPosition position,
+ const DropTargetEvent& event) {
+ BookmarkNode* drop_node = menu_id_to_node_map_[menu->GetCommand()];
+ DCHECK(drop_node);
+ BookmarkModel* model = view_->GetModel();
+ DCHECK(model);
+ BookmarkNode* drop_parent = drop_node->GetParent();
+ DCHECK(drop_parent);
+ int index_to_drop_at = drop_parent->IndexOfChild(drop_node);
+ if (position == DROP_AFTER) {
+ index_to_drop_at++;
+ } else if (position == DROP_ON) {
+ DCHECK(drop_node->GetType() != history::StarredEntry::URL);
+ drop_parent = drop_node;
+ index_to_drop_at = drop_node->GetChildCount();
+ }
+
+ const int result = view_->PerformDropImpl(drop_data_, drop_parent,
+ index_to_drop_at);
+ if (view_->drop_menu_runner_.get() == this)
+ view_->drop_menu_runner_.reset();
+ // WARNING: we've been deleted!
+ return result;
+ }
+
+ virtual bool ShowContextMenu(MenuItemView* source,
+ int id,
+ int x,
+ int y,
+ bool is_mouse_gesture) {
+ DCHECK(menu_id_to_node_map_.find(id) != menu_id_to_node_map_.end());
+ std::vector<BookmarkNode*> nodes;
+ nodes.push_back(menu_id_to_node_map_[id]);
+ context_menu_.reset(
+ new BookmarkContextMenu(view_->GetWidget()->GetNativeView(),
+ view_->GetProfile(),
+ view_->browser(),
+ view_->GetPageNavigator(),
+ nodes[0]->GetParent(),
+ nodes,
+ BookmarkContextMenu::BOOKMARK_BAR));
+ context_menu_->RunMenuAt(x, y);
+ context_menu_.reset(NULL);
+ return true;
+ }
+
+ virtual void DropMenuClosed(MenuItemView* menu) {
+ if (view_->drop_menu_runner_.get() == this)
+ view_->drop_menu_runner_.reset();
+ }
+
+ virtual bool CanDrag(MenuItemView* menu) {
+ DCHECK(menu);
+ return true;
+ }
+
+ virtual void WriteDragData(MenuItemView* sender, OSExchangeData* data) {
+ DCHECK(sender && data);
+
+ UserMetrics::RecordAction(L"BookmarkBar_DragFromFolder",
+ view_->GetProfile());
+
+ view_->WriteDragData(menu_id_to_node_map_[sender->GetCommand()], data);
+ }
+
+ virtual int GetDragOperations(MenuItemView* sender) {
+ return GetDragOperationsForNode(
+ menu_id_to_node_map_[sender->GetCommand()]);
+ }
+
+ // The node we're showing the contents of.
+ BookmarkNode* node_;
+
+ // The view that created us.
+ BookmarkBarView* view_;
+
+ // The menu.
+ MenuItemView menu_;
+
+ // Mapping from menu id to the BookmarkNode.
+ std::map<int, BookmarkNode*> menu_id_to_node_map_;
+
+ // Mapping from node to menu id. This only contains entries for nodes of type
+ // URL.
+ std::map<BookmarkNode*, int> node_to_menu_id_map_;
+
+ // Data for the drop.
+ BookmarkDragData drop_data_;
+
+ scoped_ptr<BookmarkContextMenu> context_menu_;
+
+ DISALLOW_COPY_AND_ASSIGN(MenuRunner);
+};
+
+=======
+>>>>>>> .r11559
// ButtonSeparatorView --------------------------------------------------------
class ButtonSeparatorView : public views::View {
@@ -1224,7 +1472,7 @@ void BookmarkBarView::RunMenu(views::View* view,
gfx::Point screen_loc(x, 0);
View::ConvertPointToScreen(this, &screen_loc);
bookmark_menu_ = new BookmarkMenuController(
- browser_, profile_, page_navigator_, GetWidget()->GetHWND(),
+ browser_, profile_, page_navigator_, GetWidget()->GetNativeView(),
node, start_index);
bookmark_menu_->set_observer(this);
bookmark_menu_->RunMenuAt(gfx::Rect(screen_loc.x(), screen_loc.y(),
@@ -1249,7 +1497,7 @@ void BookmarkBarView::ButtonPressed(views::BaseButton* sender) {
PageTransition::AUTO_BOOKMARK);
} else {
bookmark_utils::OpenAll(
- GetWidget()->GetHWND(), profile_, GetPageNavigator(), node,
+ GetWidget()->GetNativeView(), profile_, GetPageNavigator(), node,
event_utils::DispositionFromEventFlags(sender->mouse_event_flags()));
}
UserMetrics::RecordAction(L"ClickedBookmarkBarURLButton", profile_);
@@ -1285,7 +1533,7 @@ void BookmarkBarView::ShowContextMenu(View* source,
parent = model_->GetBookmarkBarNode();
nodes.push_back(parent);
}
- BookmarkContextMenu controller(GetWidget()->GetHWND(),
+ BookmarkContextMenu controller(GetWidget()->GetNativeView(),
GetProfile(), browser(), GetPageNavigator(),
parent, nodes,
BookmarkContextMenu::BOOKMARK_BAR);
@@ -1454,7 +1702,12 @@ void BookmarkBarView::ShowDropFolderForNode(BookmarkNode* node) {
bookmark_drop_menu_->set_observer(this);
gfx::Point screen_loc;
View::ConvertPointToScreen(view_to_position_menu_from, &screen_loc);
+<<<<<<< .mine
+ drop_menu_runner_->RunMenuAt(
+ GetWidget()->GetNativeView(),
+=======
bookmark_drop_menu_->RunMenuAt(
+>>>>>>> .r11559
gfx::Rect(screen_loc.x(), screen_loc.y(),
view_to_position_menu_from->width(),
view_to_position_menu_from->height()),
diff --git a/chrome/browser/views/bookmark_bubble_view.cc b/chrome/browser/views/bookmark_bubble_view.cc
index dc4bf29..899b5be 100644
--- a/chrome/browser/views/bookmark_bubble_view.cc
+++ b/chrome/browser/views/bookmark_bubble_view.cc
@@ -161,7 +161,7 @@ void BookmarkBubbleView::DidChangeBounds(const gfx::Rect& previous,
void BookmarkBubbleView::BubbleShown() {
DCHECK(GetWidget());
views::FocusManager* focus_manager =
- views::FocusManager::GetFocusManager(GetWidget()->GetHWND());
+ views::FocusManager::GetFocusManager(GetWidget()->GetNativeView());
focus_manager->RegisterAccelerator(
views::Accelerator(VK_RETURN, false, false, false), this);
@@ -361,7 +361,7 @@ void BookmarkBubbleView::ShowEditor() {
// Parent the editor to our root ancestor (not the root we're in, as that
// is the info bubble and will close shortly).
- HWND parent = GetAncestor(GetWidget()->GetHWND(), GA_ROOTOWNER);
+ HWND parent = GetAncestor(GetWidget()->GetNativeView(), GA_ROOTOWNER);
// We're about to show the bookmark editor. When the bookmark editor closes
// we want the browser to become active. WidgetWin::Hide() does a hide in
@@ -370,7 +370,7 @@ void BookmarkBubbleView::ShowEditor() {
// explicitly hide the bookmark bubble window in such a way that activation
// status changes. That way, when the editor closes, activation is properly
// restored to the browser.
- ShowWindow(GetWidget()->GetHWND(), SW_HIDE);
+ ShowWindow(GetWidget()->GetNativeView(), SW_HIDE);
// Even though we just hid the window, we need to invoke Close to schedule
// the delete and all that.
diff --git a/chrome/browser/views/bookmark_editor_view.cc b/chrome/browser/views/bookmark_editor_view.cc
index 566f019..6810d63 100644
--- a/chrome/browser/views/bookmark_editor_view.cc
+++ b/chrome/browser/views/bookmark_editor_view.cc
@@ -220,7 +220,8 @@ void BookmarkEditorView::ShowContextMenu(View* source,
running_menu_for_root_ =
(tree_model_->GetParent(tree_view_->GetSelectedNode()) ==
tree_model_->GetRoot());
- context_menu_.reset(new Menu(this, Menu::TOPLEFT, GetWidget()->GetHWND()));
+ context_menu_.reset(new Menu(this, Menu::TOPLEFT,
+ GetWidget()->GetNativeView()));
context_menu_->AppendMenuItemWithLabel(IDS_EDIT,
l10n_util::GetString(IDS_EDIT));
context_menu_->AppendMenuItemWithLabel(
diff --git a/chrome/browser/views/bookmark_manager_view.cc b/chrome/browser/views/bookmark_manager_view.cc
index f009e83..fb868c2 100644
--- a/chrome/browser/views/bookmark_manager_view.cc
+++ b/chrome/browser/views/bookmark_manager_view.cc
@@ -344,7 +344,7 @@ void BookmarkManagerView::OnDoubleClick() {
// we can use
// event_utils::DispositionFromEventFlags(sender->mouse_event_flags()) .
bookmark_utils::OpenAll(
- GetWidget()->GetHWND(), profile_, NULL, nodes, CURRENT_TAB);
+ GetWidget()->GetNativeView(), profile_, NULL, nodes, CURRENT_TAB);
}
void BookmarkManagerView::OnTableViewDelete(views::TableView* table) {
@@ -365,7 +365,7 @@ void BookmarkManagerView::OnKeyDown(unsigned short virtual_keycode) {
SelectInTree(selected_nodes[0]);
} else {
bookmark_utils::OpenAll(
- GetWidget()->GetHWND(), profile_, NULL, selected_nodes,
+ GetWidget()->GetNativeView(), profile_, NULL, selected_nodes,
CURRENT_TAB);
}
break;
@@ -471,7 +471,7 @@ void BookmarkManagerView::ShowContextMenu(views::View* source,
bool is_mouse_gesture) {
DCHECK(source == table_view_ || source == tree_view_);
bool is_table = (source == table_view_);
- ShowMenu(GetWidget()->GetHWND(), x, y,
+ ShowMenu(GetWidget()->GetNativeView(), x, y,
is_table ? BookmarkContextMenu::BOOKMARK_MANAGER_TABLE :
BookmarkContextMenu::BOOKMARK_MANAGER_TREE);
}
@@ -525,7 +525,7 @@ void BookmarkManagerView::FileSelected(const std::wstring& path,
ProfileInfo profile_info;
profile_info.browser_type = BOOKMARKS_HTML;
profile_info.source_path = path;
- StartImportingWithUI(GetWidget()->GetHWND(), FAVORITES, host,
+ StartImportingWithUI(GetWidget()->GetNativeView(), FAVORITES, host,
profile_info, profile_,
new ImportObserverImpl(profile()), false);
} else if (id == IDS_BOOKMARK_MANAGER_EXPORT_MENU) {
@@ -662,7 +662,7 @@ void BookmarkManagerView::ShowMenu(
std::vector<BookmarkNode*> nodes;
if (node)
nodes.push_back(node);
- BookmarkContextMenu menu(GetWidget()->GetHWND(), profile_, NULL, NULL,
+ BookmarkContextMenu menu(GetWidget()->GetNativeView(), profile_, NULL, NULL,
node, nodes, config);
menu.RunMenuAt(x, y);
}
@@ -704,7 +704,8 @@ void BookmarkManagerView::ShowToolsMenu(HWND host, int x, int y) {
views::MenuItemView::AnchorPosition anchor =
UILayoutIsRightToLeft() ? views::MenuItemView::TOPRIGHT :
views::MenuItemView::TOPLEFT;
- menu.RunMenuAt(GetWidget()->GetHWND(), gfx::Rect(x, y, 0, 0), anchor, true);
+ menu.RunMenuAt(GetWidget()->GetNativeView(), gfx::Rect(x, y, 0, 0), anchor,
+ true);
}
void BookmarkManagerView::ShowImportBookmarksFileChooser() {
@@ -716,7 +717,7 @@ void BookmarkManagerView::ShowImportBookmarksFileChooser() {
select_file_dialog_ = SelectFileDialog::Create(this);
select_file_dialog_->SelectFile(
SelectFileDialog::SELECT_OPEN_FILE, std::wstring(), L"bookmarks.html",
- filter_string, std::wstring(), GetWidget()->GetHWND(),
+ filter_string, std::wstring(), GetWidget()->GetNativeView(),
reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_IMPORT_MENU));
}
@@ -728,6 +729,6 @@ void BookmarkManagerView::ShowExportBookmarksFileChooser() {
select_file_dialog_->SelectFile(
SelectFileDialog::SELECT_SAVEAS_FILE, std::wstring(), L"bookmarks.html",
win_util::GetFileFilterFromPath(L"bookmarks.html"), L"html",
- GetWidget()->GetHWND(),
+ GetWidget()->GetNativeView(),
reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_EXPORT_MENU));
}
diff --git a/chrome/browser/views/constrained_window_impl.cc b/chrome/browser/views/constrained_window_impl.cc
index 8005457..3d0869a 100644
--- a/chrome/browser/views/constrained_window_impl.cc
+++ b/chrome/browser/views/constrained_window_impl.cc
@@ -617,7 +617,7 @@ void ConstrainedWindowImpl::ActivateConstrainedWindow() {
// Store the focus of our parent focus manager so we can restore it when we
// close.
views::FocusManager* focus_manager =
- views::FocusManager::GetFocusManager(GetHWND());
+ views::FocusManager::GetFocusManager(GetNativeView());
DCHECK(focus_manager);
focus_manager = focus_manager->GetParentFocusManager();
if (focus_manager) {
@@ -628,7 +628,7 @@ void ConstrainedWindowImpl::ActivateConstrainedWindow() {
focus_manager->StoreFocusedView();
// Give our window the focus so we get keyboard messages.
- ::SetFocus(GetHWND());
+ ::SetFocus(GetNativeView());
}
}
@@ -707,7 +707,7 @@ void ConstrainedWindowImpl::OnDestroy() {
// WM_DESTROY in FocusManager). So the FocusManager we retrieve here is the
// parent one (the one from the top window).
views::FocusManager* focus_manager =
- views::FocusManager::GetFocusManager(GetHWND());
+ views::FocusManager::GetFocusManager(GetNativeView());
if (focus_manager) {
// We may not have a focus manager if:
// - we are hidden when closed (the TabContent would be detached).
diff --git a/chrome/browser/views/download_item_view.cc b/chrome/browser/views/download_item_view.cc
index a0f83ec..c25ba4e 100644
--- a/chrome/browser/views/download_item_view.cc
+++ b/chrome/browser/views/download_item_view.cc
@@ -719,7 +719,7 @@ bool DownloadItemView::OnMousePressed(const views::MouseEvent& event) {
views::View::ConvertPointToScreen(this, &point);
DownloadShelfContextMenuWin menu(model_.get(),
- GetWidget()->GetHWND(),
+ GetWidget()->GetNativeView(),
point);
drop_down_pressed_ = false;
// Showing the menu blocks. Here we revert the state.
diff --git a/chrome/browser/views/find_bar_win.cc b/chrome/browser/views/find_bar_win.cc
index 5eae72d..354ad1a 100644
--- a/chrome/browser/views/find_bar_win.cc
+++ b/chrome/browser/views/find_bar_win.cc
@@ -32,7 +32,7 @@ FindBarWin::FindBarWin(BrowserView* browser_view)
focus_manager_(NULL),
old_accel_target_for_esc_(NULL),
find_bar_controller_(NULL) {
- HWND parent_hwnd = browser_view->GetWidget()->GetHWND();
+ HWND parent_hwnd = browser_view->GetWidget()->GetNativeView();
// Start listening to focus changes, so we can register and unregister our
// own handler for Escape.
@@ -424,8 +424,8 @@ void FindBarWin::SetDialogPosition(const gfx::Rect& new_pos, bool no_redraw) {
if (!IsVisible())
swp_flags |= SWP_SHOWWINDOW;
- ::SetWindowPos(GetHWND(), HWND_TOP, new_pos.x(), new_pos.y(), new_pos.width(),
- new_pos.height(), swp_flags);
+ ::SetWindowPos(GetNativeView(), HWND_TOP, new_pos.x(), new_pos.y(),
+ new_pos.width(), new_pos.height(), swp_flags);
}
void FindBarWin::SetFocusChangeListener(HWND parent_hwnd) {
diff --git a/chrome/browser/views/first_run_customize_view.cc b/chrome/browser/views/first_run_customize_view.cc
index 3681ee4..1f8e132 100644
--- a/chrome/browser/views/first_run_customize_view.cc
+++ b/chrome/browser/views/first_run_customize_view.cc
@@ -200,7 +200,8 @@ bool FirstRunCustomizeView::Accept() {
} else {
int browser_selected = import_from_combo_->GetSelectedItem();
FirstRun::ImportSettings(profile_, browser_selected,
- GetDefaultImportItems(), window()->GetHWND());
+ GetDefaultImportItems(),
+ window()->GetNativeView());
}
if (default_browser_->IsSelected())
SetDefaultBrowser();
diff --git a/chrome/browser/views/first_run_view.cc b/chrome/browser/views/first_run_view.cc
index 3c67693..13a10a1 100644
--- a/chrome/browser/views/first_run_view.cc
+++ b/chrome/browser/views/first_run_view.cc
@@ -150,7 +150,7 @@ void FirstRunView::Layout() {
void FirstRunView::OpenCustomizeDialog() {
// The customize dialog now owns the importer host object.
views::Window::CreateChromeWindow(
- window()->GetHWND(),
+ window()->GetNativeView(),
gfx::Rect(),
new FirstRunCustomizeView(profile_,
importer_host_,
@@ -182,7 +182,7 @@ bool FirstRunView::Accept() {
SetDefaultBrowser();
// Index 0 is the default browser.
FirstRun::ImportSettings(profile_, 0, GetDefaultImportItems(),
- window()->GetHWND());
+ window()->GetNativeView());
UserMetrics::RecordAction(L"FirstRunDef_Accept", profile_);
return true;
diff --git a/chrome/browser/views/frame/browser_frame.cc b/chrome/browser/views/frame/browser_frame.cc
index d830a81..99542c3 100644
--- a/chrome/browser/views/frame/browser_frame.cc
+++ b/chrome/browser/views/frame/browser_frame.cc
@@ -42,11 +42,11 @@ void BrowserFrame::Init() {
int BrowserFrame::GetMinimizeButtonOffset() const {
TITLEBARINFOEX titlebar_info;
titlebar_info.cbSize = sizeof(TITLEBARINFOEX);
- SendMessage(GetHWND(), WM_GETTITLEBARINFOEX, 0, (WPARAM)&titlebar_info);
+ SendMessage(GetNativeView(), WM_GETTITLEBARINFOEX, 0, (WPARAM)&titlebar_info);
CPoint minimize_button_corner(titlebar_info.rgrect[2].left,
titlebar_info.rgrect[2].top);
- MapWindowPoints(HWND_DESKTOP, GetHWND(), &minimize_button_corner, 1);
+ MapWindowPoints(HWND_DESKTOP, GetNativeView(), &minimize_button_corner, 1);
return minimize_button_corner.x;
}
@@ -105,7 +105,7 @@ LRESULT BrowserFrame::OnNCActivate(BOOL active) {
// using the native frame.
if (non_client_view_->UseNativeFrame() && !frame_initialized_) {
if (browser_view_->IsBrowserTypeNormal()) {
- ::SetWindowPos(GetHWND(), NULL, 0, 0, 0, 0,
+ ::SetWindowPos(GetNativeView(), NULL, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE | SWP_FRAMECHANGED);
UpdateDWMFrame();
}
@@ -135,7 +135,8 @@ LRESULT BrowserFrame::OnNCCalcSize(BOOL mode, LPARAM l_param) {
// thickness of the auto-hide taskbar on each such edge, so the window isn't
// treated as a "fullscreen app", which would cause the taskbars to
// disappear.
- HMONITOR monitor = MonitorFromWindow(GetHWND(), MONITOR_DEFAULTTONEAREST);
+ HMONITOR monitor = MonitorFromWindow(GetNativeView(),
+ MONITOR_DEFAULTTONEAREST);
if (win_util::EdgeHasAutoHideTaskbar(ABE_LEFT, monitor))
client_rect->left += win_util::kAutoHideTaskbarThicknessPx;
if (win_util::EdgeHasAutoHideTaskbar(ABE_RIGHT, monitor))
@@ -173,9 +174,10 @@ LRESULT BrowserFrame::OnNCHitTest(const CPoint& pt) {
// Only do DWM hit-testing when we are using the native frame.
if (non_client_view_->UseNativeFrame()) {
LRESULT result;
- if (DwmDefWindowProc(GetHWND(), WM_NCHITTEST, 0, MAKELPARAM(pt.x, pt.y),
- &result))
+ if (DwmDefWindowProc(GetNativeView(), WM_NCHITTEST, 0,
+ MAKELPARAM(pt.x, pt.y), &result)) {
return result;
+ }
}
return Window::OnNCHitTest(pt);
}
@@ -223,5 +225,5 @@ void BrowserFrame::UpdateDWMFrame() {
margins.cyTopHeight =
GetBoundsForTabStrip(browser_view_->tabstrip()).bottom();
}
- DwmExtendFrameIntoClientArea(GetHWND(), &margins);
+ DwmExtendFrameIntoClientArea(GetNativeView(), &margins);
}
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index aee2de6..69b14f2 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -439,7 +439,7 @@ void BrowserView::RegisterBrowserViewPrefs(PrefService* prefs) {
void BrowserView::Init() {
// Stow a pointer to this object onto the window handle so that we can get
// at it later when all we have is a HWND.
- SetProp(GetWidget()->GetHWND(), kBrowserViewKey, this);
+ SetProp(GetWidget()->GetNativeView(), kBrowserViewKey, this);
// Start a hung plugin window detector for this browser object (as long as
// hang detection is not disabled).
@@ -530,7 +530,7 @@ bool BrowserView::IsActive() const {
void BrowserView::FlashFrame() {
FLASHWINFO fwi;
fwi.cbSize = sizeof(fwi);
- fwi.hwnd = frame_->GetHWND();
+ fwi.hwnd = frame_->GetNativeView();
fwi.dwFlags = FLASHW_ALL;
fwi.uCount = 4;
fwi.dwTimeout = 0;
@@ -538,7 +538,7 @@ void BrowserView::FlashFrame() {
}
void* BrowserView::GetNativeHandle() {
- return GetWidget()->GetHWND();
+ return GetWidget()->GetNativeView();
}
BrowserWindowTesting* BrowserView::GetBrowserWindowTesting() {
@@ -595,7 +595,7 @@ gfx::Rect BrowserView::GetNormalBounds() const {
WINDOWPLACEMENT wp;
wp.length = sizeof(wp);
- const bool ret = !!GetWindowPlacement(frame_->GetHWND(), &wp);
+ const bool ret = !!GetWindowPlacement(frame_->GetNativeView(), &wp);
DCHECK(ret);
return gfx::Rect(wp.rcNormalPosition);
}
@@ -645,7 +645,7 @@ void BrowserView::SetFullscreen(bool fullscreen) {
// Size/position/style window appropriately.
views::Widget* widget = GetWidget();
- HWND hwnd = widget->GetHWND();
+ HWND hwnd = widget->GetNativeView();
MONITORINFO monitor_info;
monitor_info.cbSize = sizeof(monitor_info);
GetMonitorInfo(MonitorFromWindow(hwnd, MONITOR_DEFAULTTOPRIMARY),
@@ -795,7 +795,7 @@ void BrowserView::ShowFindBar() {
void BrowserView::ShowAboutChromeDialog() {
views::Window::CreateChromeWindow(
- GetWidget()->GetHWND(), gfx::Rect(),
+ GetWidget()->GetNativeView(), gfx::Rect(),
new AboutChromeView(browser_->profile()))->Show();
}
@@ -838,25 +838,25 @@ void BrowserView::ShowReportBugDialog() {
// Grab an exact snapshot of the window that the user is seeing (i.e. as
// rendered--do not re-render, and include windowed plugins)
std::vector<unsigned char> *screenshot_png = new std::vector<unsigned char>;
- win_util::GrabWindowSnapshot(GetWidget()->GetHWND(), screenshot_png);
+ win_util::GrabWindowSnapshot(GetWidget()->GetNativeView(), screenshot_png);
// the BugReportView takes ownership of the png data, and will dispose of
// it in its destructor.
bug_report_view->set_png_data(screenshot_png);
// Create and show the dialog
- views::Window::CreateChromeWindow(GetWidget()->GetHWND(), gfx::Rect(),
+ views::Window::CreateChromeWindow(GetWidget()->GetNativeView(), gfx::Rect(),
bug_report_view)->Show();
}
void BrowserView::ShowClearBrowsingDataDialog() {
views::Window::CreateChromeWindow(
- GetWidget()->GetHWND(), gfx::Rect(),
+ GetWidget()->GetNativeView(), gfx::Rect(),
new ClearBrowsingDataView(browser_->profile()))->Show();
}
void BrowserView::ShowImportDialog() {
views::Window::CreateChromeWindow(
- GetWidget()->GetHWND(), gfx::Rect(),
+ GetWidget()->GetNativeView(), gfx::Rect(),
new ImporterView(browser_->profile()))->Show();
}
@@ -879,7 +879,7 @@ void BrowserView::ShowNewProfileDialog() {
void BrowserView::ShowHTMLDialog(HtmlDialogContentsDelegate* delegate,
void* parent_window) {
HWND parent_hwnd = reinterpret_cast<HWND>(parent_window);
- parent_hwnd = parent_hwnd ? parent_hwnd : GetWidget()->GetHWND();
+ parent_hwnd = parent_hwnd ? parent_hwnd : GetWidget()->GetNativeView();
HtmlDialogView* html_view = new HtmlDialogView(browser_.get(),
browser_->profile(),
delegate);
@@ -910,8 +910,8 @@ bool BrowserView::GetFindBarWindowInfo(gfx::Point* position,
CRect window_rect;
if (!find_bar_controller_.get() ||
- !::IsWindow(find_bar_win->GetHWND()) ||
- !::GetWindowRect(find_bar_win->GetHWND(), &window_rect)) {
+ !::IsWindow(find_bar_win->GetNativeView()) ||
+ !::GetWindowRect(find_bar_win->GetNativeView(), &window_rect)) {
*position = gfx::Point(0, 0);
*fully_visible = false;
return false;
@@ -1153,7 +1153,7 @@ bool BrowserView::CanClose() const {
// Empty TabStripModel, it's now safe to allow the Window to be closed.
NotificationService::current()->Notify(
NotificationType::WINDOW_CLOSED,
- Source<HWND>(frame_->GetHWND()),
+ Source<HWND>(frame_->GetNativeView()),
NotificationService::NoDetails());
return true;
}
@@ -1166,7 +1166,7 @@ int BrowserView::NonClientHitTest(const gfx::Point& point) {
if (CanCurrentlyResize()) {
CRect client_rect;
- ::GetClientRect(frame_->GetHWND(), &client_rect);
+ ::GetClientRect(frame_->GetNativeView(), &client_rect);
gfx::Size resize_corner_size = ResizeCorner::GetSize();
gfx::Rect resize_corner_rect(client_rect.right - resize_corner_size.width(),
client_rect.bottom - resize_corner_size.height(),
@@ -1334,7 +1334,7 @@ int BrowserView::OnPerformDrop(const views::DropTargetEvent& event) {
// BrowserView, private:
void BrowserView::InitSystemMenu() {
- HMENU system_menu = GetSystemMenu(frame_->GetHWND(), FALSE);
+ HMENU system_menu = GetSystemMenu(frame_->GetNativeView(), FALSE);
system_menu_.reset(new Menu(system_menu));
int insertion_index = std::max(0, system_menu_->ItemCount() - 1);
// We add the menu items in reverse order so that insertion_index never needs
@@ -1695,7 +1695,7 @@ void BrowserView::InitHangMonitor() {
int hung_plugin_detect_freq =
pref_service->GetInteger(prefs::kHungPluginDetectFrequency);
if ((hung_plugin_detect_freq > 0) &&
- hung_window_detector_.Initialize(GetWidget()->GetHWND(),
+ hung_window_detector_.Initialize(GetWidget()->GetNativeView(),
plugin_message_response_timeout)) {
ticker_.set_tick_interval(hung_plugin_detect_freq);
ticker_.RegisterTickHandler(&hung_window_detector_);
diff --git a/chrome/browser/views/frame/glass_browser_frame_view.cc b/chrome/browser/views/frame/glass_browser_frame_view.cc
index 1798b6a..40bebe6 100644
--- a/chrome/browser/views/frame/glass_browser_frame_view.cc
+++ b/chrome/browser/views/frame/glass_browser_frame_view.cc
@@ -385,7 +385,8 @@ void GlassBrowserFrameView::StartThrobber() {
throbber_running_ = true;
throbber_frame_ = 0;
InitThrobberIcons();
- SendMessage(frame_->GetHWND(), WM_SETICON, static_cast<WPARAM>(ICON_SMALL),
+ SendMessage(frame_->GetNativeView(), WM_SETICON,
+ static_cast<WPARAM>(ICON_SMALL),
reinterpret_cast<LPARAM>(throbber_icons_[throbber_frame_]));
}
}
@@ -397,7 +398,8 @@ void GlassBrowserFrameView::StopThrobber() {
void GlassBrowserFrameView::DisplayNextThrobberFrame() {
throbber_frame_ = (throbber_frame_ + 1) % kThrobberIconCount;
- SendMessage(frame_->GetHWND(), WM_SETICON, static_cast<WPARAM>(ICON_SMALL),
+ SendMessage(frame_->GetNativeView(), WM_SETICON,
+ static_cast<WPARAM>(ICON_SMALL),
reinterpret_cast<LPARAM>(throbber_icons_[throbber_frame_]));
}
diff --git a/chrome/browser/views/fullscreen_exit_bubble.cc b/chrome/browser/views/fullscreen_exit_bubble.cc
index 5686602..5a25bad 100644
--- a/chrome/browser/views/fullscreen_exit_bubble.cc
+++ b/chrome/browser/views/fullscreen_exit_bubble.cc
@@ -143,7 +143,7 @@ FullscreenExitBubble::FullscreenExitBubble(
popup_->set_window_ex_style(WS_EX_LAYERED | WS_EX_TOOLWINDOW |
l10n_util::GetExtendedTooltipStyles());
popup_->SetLayeredAlpha(static_cast<int>(0xff * kOpacity));
- popup_->Init(frame->GetHWND(), GetPopupRect(false), false);
+ popup_->Init(frame->GetNativeView(), GetPopupRect(false), false);
popup_->SetContentsView(view_);
popup_->Show(); // This does not activate the popup.
diff --git a/chrome/browser/views/hung_renderer_view.cc b/chrome/browser/views/hung_renderer_view.cc
index 72179ea..4dc72f6 100644
--- a/chrome/browser/views/hung_renderer_view.cc
+++ b/chrome/browser/views/hung_renderer_view.cc
@@ -225,7 +225,7 @@ void HungRendererWarningView::ShowForWebContents(WebContents* contents) {
HWND frame_hwnd = GetAncestor(contents->GetNativeView(), GA_ROOT);
HWND foreground_window = GetForegroundWindow();
if (foreground_window != frame_hwnd &&
- foreground_window != window()->GetHWND()) {
+ foreground_window != window()->GetNativeView()) {
return;
}
diff --git a/chrome/browser/views/hwnd_html_view.cc b/chrome/browser/views/hwnd_html_view.cc
index 000d92b..9d28cca 100644
--- a/chrome/browser/views/hwnd_html_view.cc
+++ b/chrome/browser/views/hwnd_html_view.cc
@@ -57,5 +57,5 @@ void HWNDHtmlView::Init(HWND parent_hwnd) {
void HWNDHtmlView::ViewHierarchyChanged(bool is_add, View* parent,
View* child) {
if (is_add && GetWidget() && !initialized_)
- Init(GetWidget()->GetHWND());
+ Init(GetWidget()->GetNativeView());
}
diff --git a/chrome/browser/views/info_bubble.cc b/chrome/browser/views/info_bubble.cc
index 8dbf410..861191a 100644
--- a/chrome/browser/views/info_bubble.cc
+++ b/chrome/browser/views/info_bubble.cc
@@ -140,13 +140,13 @@ void InfoBubble::Init(HWND parent_hwnd,
// Register the Escape accelerator for closing.
views::FocusManager* focus_manager =
- views::FocusManager::GetFocusManager(GetHWND());
+ views::FocusManager::GetFocusManager(GetNativeView());
focus_manager->RegisterAccelerator(views::Accelerator(VK_ESCAPE, false,
false, false),
this);
// Set initial alpha value of the layered window.
- SetLayeredWindowAttributes(GetHWND(),
+ SetLayeredWindowAttributes(GetNativeView(),
RGB(0xFF, 0xFF, 0xFF),
kMinimumAlpha,
LWA_ALPHA);
@@ -164,7 +164,7 @@ void InfoBubble::AnimationProgressed(const Animation* animation) {
(fade_animation_->GetCurrentValue() * (255.0 - kMinimumAlpha) +
kMinimumAlpha));
- SetLayeredWindowAttributes(GetHWND(),
+ SetLayeredWindowAttributes(GetNativeView(),
RGB(0xFF, 0xFF, 0xFF),
alpha,
LWA_ALPHA);
diff --git a/chrome/browser/views/infobars/infobars.cc b/chrome/browser/views/infobars/infobars.cc
index da3af20..de1401f 100644
--- a/chrome/browser/views/infobars/infobars.cc
+++ b/chrome/browser/views/infobars/infobars.cc
@@ -192,7 +192,7 @@ void InfoBar::InfoBarAdded() {
if (widget) {
focus_tracker_.reset(
new views::ExternalFocusTracker(this,
- views::FocusManager::GetFocusManager(widget->GetHWND())));
+ views::FocusManager::GetFocusManager(widget->GetNativeView())));
}
}
diff --git a/chrome/browser/views/keyword_editor_view.cc b/chrome/browser/views/keyword_editor_view.cc
index f103e0a..86c93eb7 100644
--- a/chrome/browser/views/keyword_editor_view.cc
+++ b/chrome/browser/views/keyword_editor_view.cc
@@ -565,8 +565,9 @@ void KeywordEditorView::OnDoubleClick() {
void KeywordEditorView::ButtonPressed(views::NativeButton* sender) {
if (sender == add_button_) {
- EditKeywordController* controller =
- new EditKeywordController(GetWidget()->GetHWND(), NULL, this, profile_);
+ EditKeywordController* controller =
+ new EditKeywordController(GetWidget()->GetNativeView(), NULL, this,
+ profile_);
controller->Show();
} else if (sender == remove_button_) {
DCHECK(table_view_->SelectedRowCount() > 0);
@@ -594,7 +595,7 @@ void KeywordEditorView::ButtonPressed(views::NativeButton* sender) {
const TemplateURL* template_url =
&table_model_->GetTemplateURL(selected_row);
EditKeywordController* controller =
- new EditKeywordController(GetWidget()->GetHWND(), template_url,
+ new EditKeywordController(GetWidget()->GetNativeView(), template_url,
this, profile_);
controller->Show();
} else if (sender == make_default_button_) {
diff --git a/chrome/browser/views/location_bar_view.cc b/chrome/browser/views/location_bar_view.cc
index 6ba49c1..0596974 100644
--- a/chrome/browser/views/location_bar_view.cc
+++ b/chrome/browser/views/location_bar_view.cc
@@ -120,7 +120,7 @@ void LocationBarView::Init() {
// URL edit field.
views::Widget* widget = GetWidget();
location_entry_.reset(new AutocompleteEditViewWin(font_, this, model_, this,
- widget->GetHWND(),
+ widget->GetNativeView(),
profile_, command_updater_,
popup_window_mode_));
@@ -838,7 +838,7 @@ void LocationBarView::ShowFirstRunBubbleInternal() {
bounds.set_x(location.x() - 20);
FirstRunBubble::Show(profile_,
- location_entry_view_->GetRootView()->GetWidget()->GetHWND(),
+ location_entry_view_->GetRootView()->GetWidget()->GetNativeView(),
bounds);
}
@@ -904,7 +904,7 @@ void LocationBarView::SecurityImageView::ShowInfoBubble() {
label->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
label->SizeToFit(0);
DCHECK(info_bubble_ == NULL);
- info_bubble_ = InfoBubble::Show(GetRootView()->GetWidget()->GetHWND(),
+ info_bubble_ = InfoBubble::Show(GetRootView()->GetWidget()->GetNativeView(),
bounds, label, this);
show_info_bubble_task_ = NULL;
}
@@ -948,7 +948,7 @@ bool LocationBarView::SecurityImageView::OnMousePressed(
}
PageInfoWindow::CreatePageInfo(profile_,
nav_entry,
- GetRootView()->GetWidget()->GetHWND(),
+ GetRootView()->GetWidget()->GetNativeView(),
PageInfoWindow::SECURITY);
return true;
}
diff --git a/chrome/browser/views/options/advanced_contents_view.cc b/chrome/browser/views/options/advanced_contents_view.cc
index 8a02880..cc44291 100644
--- a/chrome/browser/views/options/advanced_contents_view.cc
+++ b/chrome/browser/views/options/advanced_contents_view.cc
@@ -674,7 +674,7 @@ void WebContentSection::ButtonPressed(views::NativeButton* sender) {
disable_popup_blocked_notification_pref_.SetValue(!notification_disabled);
} else if (sender == gears_settings_button_) {
UserMetricsRecordAction(L"Options_GearsSettings", NULL);
- GearsSettingsPressed(GetAncestor(GetWidget()->GetHWND(), GA_ROOT));
+ GearsSettingsPressed(GetAncestor(GetWidget()->GetNativeView(), GA_ROOT));
}
}
diff --git a/chrome/browser/views/options/fonts_page_view.cc b/chrome/browser/views/options/fonts_page_view.cc
index df9bb19..260c8ec 100644
--- a/chrome/browser/views/options/fonts_page_view.cc
+++ b/chrome/browser/views/options/fonts_page_view.cc
@@ -245,7 +245,7 @@ FontsPageView::~FontsPageView() {
}
void FontsPageView::ButtonPressed(views::NativeButton* sender) {
- HWND owning_hwnd = GetAncestor(GetWidget()->GetHWND(), GA_ROOT);
+ HWND owning_hwnd = GetAncestor(GetWidget()->GetNativeView(), GA_ROOT);
std::wstring font_name;
int font_size = 0;
if (sender == serif_font_change_page_button_) {
diff --git a/chrome/browser/views/options/languages_page_view.cc b/chrome/browser/views/options/languages_page_view.cc
index 25fc147..40d4444 100644
--- a/chrome/browser/views/options/languages_page_view.cc
+++ b/chrome/browser/views/options/languages_page_view.cc
@@ -507,7 +507,7 @@ void LanguagesPageView::ButtonPressed(views::NativeButton* sender) {
language_table_edited_ = true;
} else if (sender == add_button_) {
views::Window::CreateChromeWindow(
- GetWidget()->GetHWND(),
+ GetWidget()->GetNativeView(),
gfx::Rect(),
new AddLanguageWindowView(this, profile()))->Show();
language_table_edited_ = true;
diff --git a/chrome/browser/views/options/options_page_view.cc b/chrome/browser/views/options/options_page_view.cc
index 61a8977..8680fc5 100644
--- a/chrome/browser/views/options/options_page_view.cc
+++ b/chrome/browser/views/options/options_page_view.cc
@@ -56,5 +56,5 @@ void OptionsPageView::ViewHierarchyChanged(bool is_add,
HWND OptionsPageView::GetRootWindow() const {
// Our Widget is the TabbedPane content HWND, which is a child HWND.
// We need the root HWND for parenting.
- return GetAncestor(GetWidget()->GetHWND(), GA_ROOT);
+ return GetAncestor(GetWidget()->GetNativeView(), GA_ROOT);
}
diff --git a/chrome/browser/views/shelf_item_dialog.cc b/chrome/browser/views/shelf_item_dialog.cc
index 99d7f7e..162076b 100644
--- a/chrome/browser/views/shelf_item_dialog.cc
+++ b/chrome/browser/views/shelf_item_dialog.cc
@@ -466,7 +466,7 @@ bool ShelfItemDialog::AcceleratorPressed(
window()->Close();
} else if (accelerator.GetKeyCode() == VK_RETURN) {
views::FocusManager* fm = views::FocusManager::GetFocusManager(
- GetWidget()->GetHWND());
+ GetWidget()->GetNativeView());
if (fm->GetFocusedView() == url_table_) {
// Return on table behaves like a double click.
OnDoubleClick();
diff --git a/chrome/browser/views/status_bubble_views.cc b/chrome/browser/views/status_bubble_views.cc
index 8cc1ad2..bc2647db 100644
--- a/chrome/browser/views/status_bubble_views.cc
+++ b/chrome/browser/views/status_bubble_views.cc
@@ -324,7 +324,7 @@ void StatusBubbleViews::StatusView::Paint(ChromeCanvas* canvas) {
paint.setColor(kBubbleColor);
RECT parent_rect;
- ::GetWindowRect(popup_->GetHWND(), &parent_rect);
+ ::GetWindowRect(popup_->GetNativeView(), &parent_rect);
// Draw our background.
SkRect rect;
@@ -476,7 +476,7 @@ void StatusBubbleViews::Init() {
WS_EX_TRANSPARENT |
l10n_util::GetExtendedTooltipStyles());
popup_->SetLayeredAlpha(0x00);
- popup_->Init(frame_->GetHWND(), rc, false);
+ popup_->Init(frame_->GetNativeView(), rc, false);
popup_->SetContentsView(view_);
Reposition();
popup_->Show();
@@ -512,7 +512,7 @@ void StatusBubbleViews::SetURL(const GURL& url, const std::wstring& languages) {
// Set Elided Text corresponding to the GURL object.
RECT parent_rect;
- ::GetWindowRect(popup_->GetHWND(), &parent_rect);
+ ::GetWindowRect(popup_->GetNativeView(), &parent_rect);
int text_width = static_cast<int>(parent_rect.right -
parent_rect.left - kTextPositionX -
kTextPadding);
diff --git a/chrome/browser/views/tab_contents_container_view.cc b/chrome/browser/views/tab_contents_container_view.cc
index 3031835..28d6aa5 100644
--- a/chrome/browser/views/tab_contents_container_view.cc
+++ b/chrome/browser/views/tab_contents_container_view.cc
@@ -246,8 +246,8 @@ void TabContentsContainerView::RenderViewHostChanged(RenderViewHost* old_host,
}
// If we are focused, we need to pass the focus to the new RenderViewHost.
- FocusManager* focus_manager =
- FocusManager::GetFocusManager(GetRootView()->GetWidget()->GetHWND());
+ FocusManager* focus_manager = FocusManager::GetFocusManager(
+ GetRootView()->GetWidget()->GetNativeView());
if (focus_manager->GetFocusedView() == this)
Focus();
}
diff --git a/chrome/browser/views/tabs/dragged_tab_controller.cc b/chrome/browser/views/tabs/dragged_tab_controller.cc
index fe5cc51..8f0536e 100644
--- a/chrome/browser/views/tabs/dragged_tab_controller.cc
+++ b/chrome/browser/views/tabs/dragged_tab_controller.cc
@@ -170,7 +170,7 @@ class DraggedTabController::DockDisplayer : public AnimationDelegate {
animation_.Show();
popup_->SetWindowPos(HWND_TOP, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOMOVE | SWP_SHOWWINDOW);
- popup_hwnd_ = popup_->GetHWND();
+ popup_hwnd_ = popup_->GetNativeView();
}
~DockDisplayer() {
@@ -635,7 +635,7 @@ DockInfo DraggedTabController::GetDockInfoAtPoint(
return dock_info_;
}
- HWND dragged_hwnd = view_->GetWidget()->GetHWND();
+ HWND dragged_hwnd = view_->GetWidget()->GetNativeView();
dock_windows_.insert(dragged_hwnd);
DockInfo info = DockInfo::GetDockInfoAtPoint(screen_point, dock_windows_);
dock_windows_.erase(dragged_hwnd);
@@ -644,7 +644,7 @@ DockInfo DraggedTabController::GetDockInfoAtPoint(
TabStrip* DraggedTabController::GetTabStripForPoint(
const gfx::Point& screen_point) {
- HWND dragged_hwnd = view_->GetWidget()->GetHWND();
+ HWND dragged_hwnd = view_->GetWidget()->GetNativeView();
dock_windows_.insert(dragged_hwnd);
HWND local_window =
DockInfo::GetLocalProcessWindowAtPoint(screen_point, dock_windows_);
@@ -969,7 +969,7 @@ void DraggedTabController::RevertDrag() {
// it has been hidden.
if (restore_frame) {
if (!restore_bounds_.IsEmpty()) {
- HWND frame_hwnd = source_tabstrip_->GetWidget()->GetHWND();
+ HWND frame_hwnd = source_tabstrip_->GetWidget()->GetNativeView();
MoveWindow(frame_hwnd, restore_bounds_.x(), restore_bounds_.y(),
restore_bounds_.width(), restore_bounds_.height(), TRUE);
}
@@ -1037,7 +1037,7 @@ bool DraggedTabController::CompleteDrag() {
}
// Compel the model to construct a new window for the detached TabContents.
CRect browser_rect;
- GetWindowRect(source_tabstrip_->GetWidget()->GetHWND(), &browser_rect);
+ GetWindowRect(source_tabstrip_->GetWidget()->GetNativeView(), &browser_rect);
gfx::Rect window_bounds(
GetWindowCreatePoint(),
gfx::Size(browser_rect.Width(), browser_rect.Height()));
@@ -1086,7 +1086,7 @@ int DraggedTabController::NormalizeIndexToAttachedTabStrip(int index) const {
void DraggedTabController::HideFrame() {
// We don't actually hide the window, rather we just move it way off-screen.
// If we actually hide it, we stop receiving drag events.
- HWND frame_hwnd = source_tabstrip_->GetWidget()->GetHWND();
+ HWND frame_hwnd = source_tabstrip_->GetWidget()->GetNativeView();
RECT wr;
GetWindowRect(frame_hwnd, &wr);
MoveWindow(frame_hwnd, 0xFFFF, 0xFFFF, wr.right - wr.left,
@@ -1154,7 +1154,7 @@ void DraggedTabController::BringWindowUnderMouseToFront() {
// If we're going to dock to another window, bring it to the front.
HWND hwnd = dock_info_.hwnd();
if (!hwnd) {
- HWND dragged_hwnd = view_->GetWidget()->GetHWND();
+ HWND dragged_hwnd = view_->GetWidget()->GetNativeView();
dock_windows_.insert(dragged_hwnd);
hwnd = DockInfo::GetLocalProcessWindowAtPoint(GetCursorScreenPoint(),
dock_windows_);
@@ -1167,7 +1167,7 @@ void DraggedTabController::BringWindowUnderMouseToFront() {
// The previous call made the window appear on top of the dragged window,
// move the dragged window to the front.
- SetWindowPos(view_->GetWidget()->GetHWND(), HWND_TOP, 0, 0, 0, 0,
+ SetWindowPos(view_->GetWidget()->GetNativeView(), HWND_TOP, 0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
}
}
diff --git a/chrome/browser/views/tabs/dragged_tab_view.cc b/chrome/browser/views/tabs/dragged_tab_view.cc
index aae0052..eb3f15a 100644
--- a/chrome/browser/views/tabs/dragged_tab_view.cc
+++ b/chrome/browser/views/tabs/dragged_tab_view.cc
@@ -107,7 +107,7 @@ void DraggedTabView::AnimateToBounds(const gfx::Rect& bounds,
animation_callback_.reset(callback);
RECT wr;
- GetWindowRect(GetWidget()->GetHWND(), &wr);
+ GetWindowRect(GetWidget()->GetNativeView(), &wr);
animation_start_bounds_ = wr;
animation_end_bounds_ = bounds;
@@ -229,7 +229,7 @@ void DraggedTabView::PaintDetachedView(ChromeCanvas* canvas) {
void DraggedTabView::ResizeContainer() {
gfx::Size ps = GetPreferredSize();
- SetWindowPos(container_->GetHWND(), HWND_TOPMOST, 0, 0,
+ SetWindowPos(container_->GetNativeView(), HWND_TOPMOST, 0, 0,
ScaleValue(ps.width()), ScaleValue(ps.height()),
SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
}
diff --git a/chrome/browser/views/tabs/hwnd_photobooth.cc b/chrome/browser/views/tabs/hwnd_photobooth.cc
index 88fb24c..01e70a7 100644
--- a/chrome/browser/views/tabs/hwnd_photobooth.cc
+++ b/chrome/browser/views/tabs/hwnd_photobooth.cc
@@ -56,7 +56,7 @@ HWNDPhotobooth::~HWNDPhotobooth() {
void HWNDPhotobooth::ReplaceHWND(HWND new_hwnd) {
if (IsWindow(current_hwnd_) &&
- GetParent(current_hwnd_) == capture_window_->GetHWND()) {
+ GetParent(current_hwnd_) == capture_window_->GetNativeView()) {
// We need to hide the window too, so it doesn't show up in the TaskBar or
// be parented to the desktop.
ShowWindow(current_hwnd_, SW_HIDE);
@@ -66,7 +66,7 @@ void HWNDPhotobooth::ReplaceHWND(HWND new_hwnd) {
if (IsWindow(new_hwnd)) {
// Insert the TabContents into the capture window.
- SetParent(current_hwnd_, capture_window_->GetHWND());
+ SetParent(current_hwnd_, capture_window_->GetNativeView());
// Show the window (it may not be visible). This is the only safe way of
// doing this. ShowWindow does not work.
@@ -83,7 +83,7 @@ void HWNDPhotobooth::PaintScreenshotIntoCanvas(
// Our contained window may have been re-parented. Make sure it belongs to
// us until someone calls ReplaceHWND(NULL).
if (IsWindow(current_hwnd_) &&
- GetParent(current_hwnd_) != capture_window_->GetHWND()) {
+ GetParent(current_hwnd_) != capture_window_->GetNativeView()) {
ReplaceHWND(current_hwnd_);
}
@@ -153,7 +153,7 @@ void HWNDPhotobooth::CreateCaptureWindow(HWND initial_hwnd) {
// HWND's DC to the capture bitmap produces blankness.
capture_window_->Show();
SetLayeredWindowAttributes(
- capture_window_->GetHWND(), RGB(0xFF, 0xFF, 0xFF), 0xFF, LWA_ALPHA);
+ capture_window_->GetNativeView(), RGB(0xFF, 0xFF, 0xFF), 0xFF, LWA_ALPHA);
ReplaceHWND(initial_hwnd);
}
diff --git a/chrome/browser/views/tabs/tab.cc b/chrome/browser/views/tabs/tab.cc
index d0143d9..5f1a911 100644
--- a/chrome/browser/views/tabs/tab.cc
+++ b/chrome/browser/views/tabs/tab.cc
@@ -50,7 +50,7 @@ class Tab::ContextMenuController : public views::MenuDelegate {
}
void RunMenuAt(int x, int y) {
- menu_->RunMenuAt(tab_->GetWidget()->GetHWND(), gfx::Rect(x, y, 0, 0),
+ menu_->RunMenuAt(tab_->GetWidget()->GetNativeView(), gfx::Rect(x, y, 0, 0),
views::MenuItemView::TOPLEFT, true);
if (tab_)
tab_->ContextMenuClosed();
diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc
index c256a82..7b26c78 100644
--- a/chrome/browser/views/tabs/tab_strip.cc
+++ b/chrome/browser/views/tabs/tab_strip.cc
@@ -337,13 +337,14 @@ class RemoveTabAnimation : public TabStrip::TabAnimation {
GetCursorPos(&pt);
views::Widget* widget = tabstrip_->GetWidget();
RECT wr;
- GetWindowRect(widget->GetHWND(), &wr);
+ GetWindowRect(widget->GetNativeView(), &wr);
pt.x -= wr.left;
pt.y -= wr.top;
// Return to message loop - otherwise we may disrupt some operation that's
// in progress.
- PostMessage(widget->GetHWND(), WM_MOUSEMOVE, 0, MAKELPARAM(pt.x, pt.y));
+ PostMessage(widget->GetNativeView(), WM_MOUSEMOVE, 0,
+ MAKELPARAM(pt.x, pt.y));
}
int index_;
@@ -818,7 +819,7 @@ void TabStrip::TabInsertedAt(TabContents* contents,
// Don't animate the first tab, it looks weird, and don't animate anything
// if the containing window isn't visible yet.
if (GetTabCount() > 1 && GetWidget() &&
- IsWindowVisible(GetWidget()->GetHWND())) {
+ IsWindowVisible(GetWidget()->GetNativeView())) {
StartInsertTabAnimation(index);
} else {
Layout();
diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc
index 710c330..6b8e048 100644
--- a/chrome/browser/views/toolbar_view.cc
+++ b/chrome/browser/views/toolbar_view.cc
@@ -390,7 +390,7 @@ void BrowserToolbarView::DidGainFocus() {
view_index = acc_focused_view_->GetID();
}
- HWND hwnd = GetWidget()->GetHWND();
+ HWND hwnd = GetWidget()->GetNativeView();
// Notify Access Technology that there was a change in keyboard focus.
::NotifyWinEvent(EVENT_OBJECT_FOCUS, hwnd, OBJID_CLIENT,
@@ -463,7 +463,7 @@ bool BrowserToolbarView::OnKeyPressed(const views::KeyEvent& e) {
// Retrieve information to generate an MSAA focus event.
int view_id = acc_focused_view_->GetID();
- HWND hwnd = GetWidget()->GetHWND();
+ HWND hwnd = GetWidget()->GetNativeView();
// Show the tooltip for the view that got the focus.
if (GetWidget()->GetTooltipManager()) {
diff --git a/chrome/browser/views/user_data_dir_dialog.cc b/chrome/browser/views/user_data_dir_dialog.cc
index b80208d..bc0db29 100644
--- a/chrome/browser/views/user_data_dir_dialog.cc
+++ b/chrome/browser/views/user_data_dir_dialog.cc
@@ -69,7 +69,7 @@ bool UserDataDirDialog::Accept() {
std::wstring dialog_title = l10n_util::GetString(
IDS_CANT_WRITE_USER_DIRECTORY_CHOOSE_DIRECTORY_BUTTON);
HWND owning_hwnd =
- GetAncestor(message_box_view_->GetWidget()->GetHWND(), GA_ROOT);
+ GetAncestor(message_box_view_->GetWidget()->GetNativeView(), GA_ROOT);
select_file_dialog_->SelectFile(SelectFileDialog::SELECT_FOLDER,
dialog_title, std::wstring(), std::wstring(),
std::wstring(), owning_hwnd, NULL);
diff --git a/chrome/test/interactive_ui/view_event_test_base.cc b/chrome/test/interactive_ui/view_event_test_base.cc
index f5bd7a9..b2480c9 100644
--- a/chrome/test/interactive_ui/view_event_test_base.cc
+++ b/chrome/test/interactive_ui/view_event_test_base.cc
@@ -57,7 +57,7 @@ void ViewEventTestBase::SetUp() {
void ViewEventTestBase::TearDown() {
if (window_) {
- DestroyWindow(window_->GetHWND());
+ DestroyWindow(window_->GetNativeView());
window_ = NULL;
}
OleUninitialize();
@@ -79,7 +79,7 @@ void ViewEventTestBase::StartMessageLoopAndRunTest() {
window_->Show();
// Make sure the window is the foreground window, otherwise none of the
// mouse events are going to be targeted correctly.
- SetForegroundWindow(window_->GetHWND());
+ SetForegroundWindow(window_->GetNativeView());
// Flush any pending events to make sure we start with a clean slate.
MessageLoop::current()->RunAllPending();
diff --git a/chrome/views/accessibility/view_accessibility.cc b/chrome/views/accessibility/view_accessibility.cc
index 555009e..35ab3e1 100644
--- a/chrome/views/accessibility/view_accessibility.cc
+++ b/chrome/views/accessibility/view_accessibility.cc
@@ -84,7 +84,7 @@ STDMETHODIMP ViewAccessibility::get_accParent(IDispatch** disp_parent) {
if (!parent_view) {
// This function can get called during teardown of WidetWin so we
// should bail out if we fail to get the HWND.
- if (!view_->GetWidget() || !view_->GetWidget()->GetHWND()) {
+ if (!view_->GetWidget() || !view_->GetWidget()->GetNativeView()) {
*disp_parent = NULL;
return S_FALSE;
}
@@ -93,7 +93,7 @@ STDMETHODIMP ViewAccessibility::get_accParent(IDispatch** disp_parent) {
// the default implementation, to interface with Windows' hierarchy and to
// support calls from e.g. WindowFromAccessibleObject.
HRESULT hr =
- ::AccessibleObjectFromWindow(view_->GetWidget()->GetHWND(),
+ ::AccessibleObjectFromWindow(view_->GetWidget()->GetNativeView(),
OBJID_WINDOW, IID_IAccessible,
reinterpret_cast<void**>(disp_parent));
diff --git a/chrome/views/bitmap_scroll_bar.cc b/chrome/views/bitmap_scroll_bar.cc
index 686954d..98ad4ad 100644
--- a/chrome/views/bitmap_scroll_bar.cc
+++ b/chrome/views/bitmap_scroll_bar.cc
@@ -538,7 +538,7 @@ void BitmapScrollBar::ShowContextMenu(View* source,
View::ConvertPointFromWidget(this, &temp_pt);
context_menu_mouse_position_ = IsHorizontal() ? temp_pt.x() : temp_pt.y();
- Menu menu(this, Menu::TOPLEFT, GetWidget()->GetHWND());
+ Menu menu(this, Menu::TOPLEFT, GetWidget()->GetNativeView());
menu.AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollHere);
menu.AppendSeparator();
menu.AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollStart);
diff --git a/chrome/views/button_dropdown.cc b/chrome/views/button_dropdown.cc
index 6c587ae..6428598 100644
--- a/chrome/views/button_dropdown.cc
+++ b/chrome/views/button_dropdown.cc
@@ -48,7 +48,7 @@ bool ButtonDropDown::OnMousePressed(const MouseEvent& e) {
// Schedule a task that will show the menu.
MessageLoop::current()->PostDelayedTask(FROM_HERE,
show_menu_factory_.NewRunnableMethod(&ButtonDropDown::ShowDropDownMenu,
- GetWidget()->GetHWND()),
+ GetWidget()->GetNativeView()),
kMenuTimerDelay);
}
@@ -72,7 +72,7 @@ void ButtonDropDown::OnMouseReleased(const MouseEvent& e, bool canceled) {
// update the appearance synchronously.
SetState(BS_PUSHED);
PaintNow();
- ShowDropDownMenu(GetWidget()->GetHWND());
+ ShowDropDownMenu(GetWidget()->GetNativeView());
}
}
@@ -90,7 +90,7 @@ bool ButtonDropDown::OnMouseDragged(const MouseEvent& e) {
// it immediately.
if (e.y() > y_position_on_lbuttondown_ + dragging_threshold) {
show_menu_factory_.RevokeAll();
- ShowDropDownMenu(GetWidget()->GetHWND());
+ ShowDropDownMenu(GetWidget()->GetNativeView());
}
}
@@ -111,7 +111,7 @@ void ButtonDropDown::ShowContextMenu(int x, int y, bool is_mouse_gesture) {
// update the appearance synchronously.
SetState(BS_PUSHED);
PaintNow();
- ShowDropDownMenu(GetWidget()->GetHWND());
+ ShowDropDownMenu(GetWidget()->GetNativeView());
SetState(BS_HOT);
}
diff --git a/chrome/views/chrome_menu.cc b/chrome/views/chrome_menu.cc
index ef33e6a..c8df05e 100644
--- a/chrome/views/chrome_menu.cc
+++ b/chrome/views/chrome_menu.cc
@@ -2661,7 +2661,7 @@ bool MenuController::IsMenuWindow(MenuItemView* item, HWND window) {
if (!item)
return false;
return ((item->HasSubmenu() && item->GetSubmenu()->IsShowing() &&
- item->GetSubmenu()->GetWidget()->GetHWND() == window) ||
+ item->GetSubmenu()->GetWidget()->GetNativeView() == window) ||
IsMenuWindow(item->GetParentMenuItem(), window));
}
@@ -2739,8 +2739,8 @@ void MenuController::RepostEvent(SubmenuView* source,
SubmenuView* submenu = state_.item->GetRootMenuItem()->GetSubmenu();
submenu->ReleaseCapture();
- if (submenu->host() && submenu->host()->GetHWND() &&
- GetWindowThreadProcessId(submenu->host()->GetHWND(), NULL) !=
+ if (submenu->host() && submenu->host()->GetNativeView() &&
+ GetWindowThreadProcessId(submenu->host()->GetNativeView(), NULL) !=
GetWindowThreadProcessId(window, NULL)) {
// Even though we have mouse capture, windows generates a mouse event
// if the other window is in a separate thread. Don't generate an event in
diff --git a/chrome/views/focus_manager.cc b/chrome/views/focus_manager.cc
index 093b0a4..8924f5e 100644
--- a/chrome/views/focus_manager.cc
+++ b/chrome/views/focus_manager.cc
@@ -471,7 +471,7 @@ bool FocusManager::ContainsView(View* view) {
if (!widget)
return false;
- HWND window = widget->GetHWND();
+ HWND window = widget->GetNativeView();
while (window) {
if (window == root_)
return true;
diff --git a/chrome/views/focus_manager_unittest.cc b/chrome/views/focus_manager_unittest.cc
index 1207bbb..736fcbe 100644
--- a/chrome/views/focus_manager_unittest.cc
+++ b/chrome/views/focus_manager_unittest.cc
@@ -517,7 +517,7 @@ void FocusManagerTest::SetUp() {
OleInitialize(NULL);
test_window_ = new TestViewWindow(this);
test_window_->Init();
- ShowWindow(test_window_->GetHWND(), SW_SHOW);
+ ShowWindow(test_window_->GetNativeView(), SW_SHOW);
}
void FocusManagerTest::TearDown() {
@@ -550,7 +550,7 @@ TEST_F(FocusManagerTest, NormalTraversal) {
// MessageLoop::current()->Run(new views::AcceleratorHandler());
views::FocusManager* focus_manager =
- views::FocusManager::GetFocusManager(test_window_->GetHWND());
+ views::FocusManager::GetFocusManager(test_window_->GetNativeView());
// Let's traverse the whole focus hierarchy (several times, to make sure it
// loops OK).
focus_manager->SetFocusedView(NULL);
@@ -627,7 +627,7 @@ TEST_F(FocusManagerTest, TraversalWithNonEnabledViews) {
views::FocusManager* focus_manager =
- views::FocusManager::GetFocusManager(test_window_->GetHWND());
+ views::FocusManager::GetFocusManager(test_window_->GetNativeView());
views::View* focused_view;
// Let's do one traversal (several times, to make sure it loops ok).
for (int i = 0; i < 3;++i) {
diff --git a/chrome/views/hwnd_view.cc b/chrome/views/hwnd_view.cc
index 4df2b42..a89e5f9 100644
--- a/chrome/views/hwnd_view.cc
+++ b/chrome/views/hwnd_view.cc
@@ -40,7 +40,7 @@ void HWNDView::Attach(HWND hwnd) {
ShowWindow(hwnd_, SW_HIDE);
// Need to set the HWND's parent before changing its size to avoid flashing.
- ::SetParent(hwnd_, GetWidget()->GetHWND());
+ ::SetParent(hwnd_, GetWidget()->GetNativeView());
UpdateHWNDBounds();
// Register with the focus manager so the associated view is focused when the
@@ -151,7 +151,7 @@ void HWNDView::ViewHierarchyChanged(bool is_add, View *parent, View *child) {
Widget* widget = GetWidget();
if (is_add && widget) {
HWND parent = ::GetParent(hwnd_);
- HWND widget_hwnd = widget->GetHWND();
+ HWND widget_hwnd = widget->GetNativeView();
if (parent != widget_hwnd) {
::SetParent(hwnd_, widget_hwnd);
}
diff --git a/chrome/views/menu_button.cc b/chrome/views/menu_button.cc
index ad8ace1..09a9318 100644
--- a/chrome/views/menu_button.cc
+++ b/chrome/views/menu_button.cc
@@ -111,7 +111,7 @@ int MenuButton::GetMaximumScreenXCoordinate() {
return 0;
}
- HWND hwnd = widget->GetHWND();
+ HWND hwnd = widget->GetNativeView();
CRect t;
::GetWindowRect(hwnd, &t);
@@ -157,7 +157,7 @@ bool MenuButton::Activate() {
menu_visible_ = true;
menu_delegate_->RunMenu(this, menu_position.ToPOINT(),
- GetWidget()->GetHWND());
+ GetWidget()->GetNativeView());
menu_visible_ = false;
menu_closed_time_ = Time::Now();
diff --git a/chrome/views/native_control.cc b/chrome/views/native_control.cc
index 884af0e..ba7bc5d 100644
--- a/chrome/views/native_control.cc
+++ b/chrome/views/native_control.cc
@@ -38,7 +38,7 @@ class NativeControlContainer : public CWindowImpl<NativeControlContainer,
explicit NativeControlContainer(NativeControl* parent) : parent_(parent),
control_(NULL) {
- Create(parent->GetWidget()->GetHWND());
+ Create(parent->GetWidget()->GetNativeView());
::ShowWindow(m_hWnd, SW_SHOW);
}
diff --git a/chrome/views/native_frame_view.cc b/chrome/views/native_frame_view.cc
index 20b6f13..ee8eea2 100644
--- a/chrome/views/native_frame_view.cc
+++ b/chrome/views/native_frame_view.cc
@@ -36,7 +36,7 @@ gfx::Rect NativeFrameView::GetWindowBoundsForClientBounds(
gfx::Point NativeFrameView::GetSystemMenuPoint() const {
POINT temp = {0, -kFrameShadowThickness };
- MapWindowPoints(frame_->GetHWND(), HWND_DESKTOP, &temp, 1);
+ MapWindowPoints(frame_->GetNativeView(), HWND_DESKTOP, &temp, 1);
return gfx::Point(temp);
}
diff --git a/chrome/views/native_scroll_bar.cc b/chrome/views/native_scroll_bar.cc
index 3bc2c7f..c789130 100644
--- a/chrome/views/native_scroll_bar.cc
+++ b/chrome/views/native_scroll_bar.cc
@@ -30,7 +30,7 @@ class ScrollBarContainer : public CWindowImpl<ScrollBarContainer,
public:
ScrollBarContainer(ScrollBar* parent) : parent_(parent),
scrollbar_(NULL) {
- Create(parent->GetWidget()->GetHWND());
+ Create(parent->GetWidget()->GetNativeView());
::ShowWindow(m_hWnd, SW_SHOW);
}
@@ -127,7 +127,7 @@ class ScrollBarContainer : public CWindowImpl<ScrollBarContainer,
// component focused so we actually get mousewheel events.
if (source != NULL) {
Widget* widget = parent_->GetWidget();
- if (widget && widget->GetHWND() != GetFocus()) {
+ if (widget && widget->GetNativeView() != GetFocus()) {
parent_->RequestFocus();
}
}
diff --git a/chrome/views/non_client_view.cc b/chrome/views/non_client_view.cc
index 18e90b7..46bea84 100644
--- a/chrome/views/non_client_view.cc
+++ b/chrome/views/non_client_view.cc
@@ -63,21 +63,21 @@ void NonClientView::SystemThemeChanged() {
// everything has settled down.
WINDOWPLACEMENT saved_window_placement;
saved_window_placement.length = sizeof(WINDOWPLACEMENT);
- GetWindowPlacement(frame_->GetHWND(), &saved_window_placement);
+ GetWindowPlacement(frame_->GetNativeView(), &saved_window_placement);
frame_->Hide();
// Important step: restore the window first, since our hiding hack doesn't
// work for maximized windows! We tell the frame not to allow itself to be
// made visible though, which removes the brief flicker.
frame_->set_force_hidden(true);
- ShowWindow(frame_->GetHWND(), SW_RESTORE);
+ ShowWindow(frame_->GetNativeView(), SW_RESTORE);
frame_->set_force_hidden(false);
SetUseNativeFrame(win_util::ShouldUseVistaFrame());
// Now that we've updated the frame, we'll want to restore our saved placement
// since the display should have settled down and we can be properly rendered.
- SetWindowPlacement(frame_->GetHWND(), &saved_window_placement);
+ SetWindowPlacement(frame_->GetNativeView(), &saved_window_placement);
}
void NonClientView::SetUseNativeFrame(bool use_native_frame) {
diff --git a/chrome/views/root_view.cc b/chrome/views/root_view.cc
index 3fa5956..861d3c9 100644
--- a/chrome/views/root_view.cc
+++ b/chrome/views/root_view.cc
@@ -325,7 +325,7 @@ bool RootView::OnMousePressed(const MouseEvent& e) {
if (focus_on_mouse_pressed_) {
#if defined(OS_WIN)
- HWND hwnd = GetWidget()->GetHWND();
+ HWND hwnd = GetWidget()->GetNativeView();
if (::GetFocus() != hwnd) {
::SetFocus(hwnd);
}
@@ -480,7 +480,7 @@ void RootView::OnWidgetCreated() {
void RootView::OnWidgetDestroyed() {
#if defined(OS_WIN)
if (drop_target_.get()) {
- RevokeDragDrop(GetWidget()->GetHWND());
+ RevokeDragDrop(GetWidget()->GetNativeView());
drop_target_ = NULL;
}
#else
@@ -508,7 +508,7 @@ void RootView::FocusView(View* view) {
#if defined(OS_WIN)
FocusManager* focus_manager = GetFocusManager();
DCHECK(focus_manager) << "No Focus Manager for Window " <<
- (GetWidget() ? GetWidget()->GetHWND() : 0);
+ (GetWidget() ? GetWidget()->GetNativeView() : 0);
if (!focus_manager)
return;
diff --git a/chrome/views/root_view_drop_target.cc b/chrome/views/root_view_drop_target.cc
index 8ce79c2..83e301f 100644
--- a/chrome/views/root_view_drop_target.cc
+++ b/chrome/views/root_view_drop_target.cc
@@ -13,7 +13,7 @@
namespace views {
RootViewDropTarget::RootViewDropTarget(RootView* root_view)
- : BaseDropTarget(root_view->GetWidget()->GetHWND()),
+ : BaseDropTarget(root_view->GetWidget()->GetNativeView()),
root_view_(root_view),
target_view_(NULL),
deepest_view_(NULL) {
diff --git a/chrome/views/text_field.cc b/chrome/views/text_field.cc
index 10a154c..1c62b14 100644
--- a/chrome/views/text_field.cc
+++ b/chrome/views/text_field.cc
@@ -272,7 +272,7 @@ TextField::Edit::Edit(TextField* parent, bool draw_border)
DWORD ex_style = l10n_util::GetExtendedStyles();
RECT r = {0, 0, parent_->width(), parent_->height()};
- Create(parent_->GetWidget()->GetHWND(), r, NULL, style, ex_style);
+ Create(parent_->GetWidget()->GetNativeView(), r, NULL, style, ex_style);
if (parent->GetStyle() & TextField::STYLE_LOWERCASE) {
DCHECK((parent->GetStyle() & TextField::STYLE_PASSWORD) == 0);
diff --git a/chrome/views/tree_view.cc b/chrome/views/tree_view.cc
index 7166a31..764d6c7 100644
--- a/chrome/views/tree_view.cc
+++ b/chrome/views/tree_view.cc
@@ -466,7 +466,7 @@ bool TreeView::OnKeyDown(int virtual_key_code) {
} else if (virtual_key_code == VK_RETURN && !process_enter_) {
Widget* widget = GetWidget();
DCHECK(widget);
- FocusManager* fm = FocusManager::GetFocusManager(widget->GetHWND());
+ FocusManager* fm = FocusManager::GetFocusManager(widget->GetNativeView());
DCHECK(fm);
Accelerator accelerator(Accelerator(static_cast<int>(virtual_key_code),
win_util::IsShiftPressed(),
diff --git a/chrome/views/view_win.cc b/chrome/views/view_win.cc
index 190d21f..a69bf77 100644
--- a/chrome/views/view_win.cc
+++ b/chrome/views/view_win.cc
@@ -21,7 +21,7 @@ FocusManager* View::GetFocusManager() {
if (!widget)
return NULL;
- HWND hwnd = widget->GetHWND();
+ HWND hwnd = widget->GetNativeView();
if (!hwnd)
return NULL;
@@ -71,7 +71,7 @@ void View::Focus() {
// messages.
FocusManager* focus_manager = GetFocusManager();
if (focus_manager)
- focus_manager->FocusHWND(GetRootView()->GetWidget()->GetHWND());
+ focus_manager->FocusHWND(GetRootView()->GetWidget()->GetNativeView());
}
int View::GetHorizontalDragThreshold() {
diff --git a/chrome/views/widget.h b/chrome/views/widget.h
index d3c4e08..46aa754 100644
--- a/chrome/views/widget.h
+++ b/chrome/views/widget.h
@@ -5,10 +5,7 @@
#ifndef CHROME_VIEWS_WIDGET_H_
#define CHROME_VIEWS_WIDGET_H_
-#if defined(OS_WIN)
-// TODO(maruel): Remove once HWND is abstracted.
-#include <windows.h>
-#endif
+#include "base/gfx/native_widget_types.h"
namespace gfx {
class Rect;
@@ -51,10 +48,8 @@ class Widget {
// the window should also become the active window.
virtual void MoveToFront(bool should_activate) = 0;
-#if defined(OS_WIN)
- // Returns the Window HWND associated with this Widget.
- virtual HWND GetHWND() const = 0;
-#endif
+ // Returns the gfx::NativeView associated with this Widget.
+ virtual gfx::NativeView GetNativeView() const = 0;
// Forces a paint of a specified rectangle immediately.
virtual void PaintNow(const gfx::Rect& update_rect) = 0;
diff --git a/chrome/views/widget_win.cc b/chrome/views/widget_win.cc
index 29c04a5..e5a8891 100644
--- a/chrome/views/widget_win.cc
+++ b/chrome/views/widget_win.cc
@@ -186,21 +186,21 @@ void WidgetWin::Init(HWND parent, const gfx::Rect& bounds,
// that window controls in Chrome windows don't flicker when you move your
// mouse over them. See comment in aero_tooltip_manager.h.
if (win_util::ShouldUseVistaFrame()) {
- tooltip_manager_.reset(new AeroTooltipManager(this, GetHWND()));
+ tooltip_manager_.reset(new AeroTooltipManager(this, GetNativeView()));
} else {
- tooltip_manager_.reset(new TooltipManager(this, GetHWND()));
+ tooltip_manager_.reset(new TooltipManager(this, GetNativeView()));
}
// This message initializes the window so that focus border are shown for
// windows.
- ::SendMessage(GetHWND(),
+ ::SendMessage(GetNativeView(),
WM_CHANGEUISTATE,
MAKELPARAM(UIS_CLEAR, UISF_HIDEFOCUS),
0);
// Bug 964884: detach the IME attached to this window.
// We should attach IMEs only when we need to input CJK strings.
- ::ImmAssociateContextEx(GetHWND(), NULL, 0);
+ ::ImmAssociateContextEx(GetNativeView(), NULL, 0);
}
void WidgetWin::SetContentsView(View* view) {
@@ -245,12 +245,12 @@ void WidgetWin::MoveToFront(bool should_activate) {
// Keep the window topmost if it was already topmost.
WINDOWINFO wi;
wi.cbSize = sizeof WINDOWINFO;
- GetWindowInfo(GetHWND(), &wi);
+ GetWindowInfo(GetNativeView(), &wi);
SetWindowPos((wi.dwExStyle & WS_EX_TOPMOST) ? HWND_TOPMOST : HWND_NOTOPMOST,
0, 0, 0, 0, flags);
}
-HWND WidgetWin::GetHWND() const {
+gfx::NativeView WidgetWin::GetNativeView() const {
return hwnd_;
}
@@ -292,11 +292,11 @@ RootView* WidgetWin::GetRootView() {
}
bool WidgetWin::IsVisible() {
- return !!::IsWindowVisible(GetHWND());
+ return !!::IsWindowVisible(GetNativeView());
}
bool WidgetWin::IsActive() {
- return win_util::IsWindowActive(GetHWND());
+ return win_util::IsWindowActive(GetNativeView());
}
TooltipManager* WidgetWin::GetTooltipManager() {
@@ -510,7 +510,7 @@ LRESULT WidgetWin::OnGetObject(UINT uMsg, WPARAM w_param, LPARAM l_param) {
}
// Notify that an instance of IAccessible was allocated for m_hWnd
- ::NotifyWinEvent(EVENT_OBJECT_CREATE, GetHWND(), OBJID_CLIENT,
+ ::NotifyWinEvent(EVENT_OBJECT_CREATE, GetNativeView(), OBJID_CLIENT,
CHILDID_SELF);
}
@@ -619,7 +619,7 @@ LRESULT WidgetWin::OnNCMouseLeave(UINT uMsg, WPARAM w_param, LPARAM l_param) {
LRESULT WidgetWin::OnNCMouseMove(UINT flags, const CPoint& point) {
// NC points are in screen coordinates.
CPoint temp = point;
- MapWindowPoints(HWND_DESKTOP, GetHWND(), &temp, 1);
+ MapWindowPoints(HWND_DESKTOP, GetNativeView(), &temp, 1);
ProcessMouseMoved(temp, 0, true);
// We need to process this message to stop Windows from drawing the window
@@ -655,7 +655,7 @@ LRESULT WidgetWin::OnNotify(int w_param, NMHDR* l_param) {
}
void WidgetWin::OnPaint(HDC dc) {
- root_view_->OnPaint(GetHWND());
+ root_view_->OnPaint(GetNativeView());
}
void WidgetWin::OnRButtonDown(UINT flags, const CPoint& point) {
@@ -709,7 +709,7 @@ void WidgetWin::TrackMouseEvents(DWORD mouse_tracking_flags) {
TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(tme);
tme.dwFlags = mouse_tracking_flags;
- tme.hwndTrack = GetHWND();
+ tme.hwndTrack = GetNativeView();
tme.dwHoverTime = 0;
TrackMouseEvent(&tme);
} else if (mouse_tracking_flags != active_mouse_tracking_flags_) {
@@ -821,7 +821,7 @@ void WidgetWin::AdjustWindowToFitScreenSize() {
gfx::Rect new_window_rect = window_rect.AdjustToFit(monitor_rect);
if (!new_window_rect.Equals(window_rect)) {
// New position differs from last, resize window.
- ::SetWindowPos(GetHWND(),
+ ::SetWindowPos(GetNativeView(),
0,
new_window_rect.x(),
new_window_rect.y(),
diff --git a/chrome/views/widget_win.h b/chrome/views/widget_win.h
index cf2274e..f13051c 100644
--- a/chrome/views/widget_win.h
+++ b/chrome/views/widget_win.h
@@ -251,7 +251,7 @@ class WidgetWin : public Widget,
// Overridden from Widget:
virtual void GetBounds(gfx::Rect* out, bool including_frame) const;
virtual void MoveToFront(bool should_activate);
- virtual HWND GetHWND() const;
+ virtual gfx::NativeView GetNativeView() const;
virtual void PaintNow(const gfx::Rect& update_rect);
virtual RootView* GetRootView();
virtual bool IsVisible();
@@ -285,35 +285,35 @@ class WidgetWin : public Widget,
}
BOOL IsWindow() const {
- return ::IsWindow(GetHWND());
+ return ::IsWindow(GetNativeView());
}
BOOL ShowWindow(int command) {
- DCHECK(::IsWindow(GetHWND()));
- return ::ShowWindow(GetHWND(), command);
+ DCHECK(::IsWindow(GetNativeView()));
+ return ::ShowWindow(GetNativeView(), command);
}
HWND SetCapture() {
- DCHECK(::IsWindow(GetHWND()));
- return ::SetCapture(GetHWND());
+ DCHECK(::IsWindow(GetNativeView()));
+ return ::SetCapture(GetNativeView());
}
HWND GetParent() const {
- return ::GetParent(GetHWND());
+ return ::GetParent(GetNativeView());
}
BOOL GetWindowRect(RECT* rect) const {
- return ::GetWindowRect(GetHWND(), rect);
+ return ::GetWindowRect(GetNativeView(), rect);
}
BOOL SetWindowPos(HWND hwnd_after, int x, int y, int cx, int cy, UINT flags) {
- DCHECK(::IsWindow(GetHWND()));
- return ::SetWindowPos(GetHWND(), hwnd_after, x, y, cx, cy, flags);
+ DCHECK(::IsWindow(GetNativeView()));
+ return ::SetWindowPos(GetNativeView(), hwnd_after, x, y, cx, cy, flags);
}
BOOL IsZoomed() const {
- DCHECK(::IsWindow(GetHWND()));
- return ::IsZoomed(GetHWND());
+ DCHECK(::IsWindow(GetNativeView()));
+ return ::IsZoomed(GetNativeView());
}
BOOL MoveWindow(int x, int y, int width, int height) {
@@ -321,26 +321,26 @@ class WidgetWin : public Widget,
}
BOOL MoveWindow(int x, int y, int width, int height, BOOL repaint) {
- DCHECK(::IsWindow(GetHWND()));
- return ::MoveWindow(GetHWND(), x, y, width, height, repaint);
+ DCHECK(::IsWindow(GetNativeView()));
+ return ::MoveWindow(GetNativeView(), x, y, width, height, repaint);
}
int SetWindowRgn(HRGN region, BOOL redraw) {
- DCHECK(::IsWindow(GetHWND()));
- return ::SetWindowRgn(GetHWND(), region, redraw);
+ DCHECK(::IsWindow(GetNativeView()));
+ return ::SetWindowRgn(GetNativeView(), region, redraw);
}
BOOL GetClientRect(RECT* rect) const {
- DCHECK(::IsWindow(GetHWND()));
- return ::GetClientRect(GetHWND(), rect);
+ DCHECK(::IsWindow(GetNativeView()));
+ return ::GetClientRect(GetNativeView(), rect);
}
protected:
// Call close instead of this to Destroy the window.
BOOL DestroyWindow() {
- DCHECK(::IsWindow(GetHWND()));
- return ::DestroyWindow(GetHWND());
+ DCHECK(::IsWindow(GetNativeView()));
+ return ::DestroyWindow(GetNativeView());
}
// Message Handlers
diff --git a/chrome/views/window.cc b/chrome/views/window.cc
index 0548fa4..4bf24ee 100644
--- a/chrome/views/window.cc
+++ b/chrome/views/window.cc
@@ -95,16 +95,16 @@ gfx::Size Window::CalculateMaximumSize() const {
// rect of the display the window is on, less padding. If this is a child
// (constrained) window, the maximum size of this Window are the bounds of the
// parent window, less padding.
- DCHECK(GetHWND()) << "Cannot calculate maximum size before Init() is called";
+ DCHECK(GetNativeView()) << "Cannot calculate maximum size before Init() is called";
gfx::Rect working_rect;
- HWND parent_hwnd = ::GetParent(GetHWND());
+ HWND parent_hwnd = ::GetParent(GetNativeView());
if (parent_hwnd) {
RECT parent_rect;
::GetClientRect(parent_hwnd, &parent_rect);
working_rect = parent_rect;
} else {
HMONITOR current_monitor =
- ::MonitorFromWindow(GetHWND(), MONITOR_DEFAULTTONEAREST);
+ ::MonitorFromWindow(GetNativeView(), MONITOR_DEFAULTTONEAREST);
MONITORINFO mi;
mi.cbSize = sizeof(mi);
::GetMonitorInfo(current_monitor, &mi);
@@ -150,9 +150,9 @@ int Window::GetShowState() const {
void Window::Activate() {
if (IsMinimized())
- ::ShowWindow(GetHWND(), SW_RESTORE);
- ::SetWindowPos(GetHWND(), HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
- SetForegroundWindow(GetHWND());
+ ::ShowWindow(GetNativeView(), SW_RESTORE);
+ ::SetWindowPos(GetNativeView(), HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
+ SetForegroundWindow(GetNativeView());
}
void Window::SetBounds(const gfx::Rect& bounds) {
@@ -160,7 +160,7 @@ void Window::SetBounds(const gfx::Rect& bounds) {
}
void Window::SetBounds(const gfx::Rect& bounds, HWND other_hwnd) {
- win_util::SetChildBounds(GetHWND(), GetParent(), other_hwnd, bounds,
+ win_util::SetChildBounds(GetNativeView(), GetParent(), other_hwnd, bounds,
kMonitorEdgePadding, 0);
}
@@ -181,7 +181,7 @@ void Window::Close() {
// closes us, we want our owner to gain activation. But only if the owner
// is visible. If we don't manually force that here, the other app will
// regain activation instead.
- if (owning_hwnd_ && GetHWND() == GetForegroundWindow() &&
+ if (owning_hwnd_ && GetNativeView() == GetForegroundWindow() &&
IsWindowVisible(owning_hwnd_)) {
SetForegroundWindow(owning_hwnd_);
}
@@ -190,11 +190,11 @@ void Window::Close() {
}
bool Window::IsMaximized() const {
- return !!::IsZoomed(GetHWND());
+ return !!::IsZoomed(GetNativeView());
}
bool Window::IsMinimized() const {
- return !!::IsIconic(GetHWND());
+ return !!::IsIconic(GetNativeView());
}
void Window::EnableClose(bool enable) {
@@ -203,7 +203,7 @@ void Window::EnableClose(bool enable) {
// Disable the native frame's close button regardless of whether or not the
// native frame is in use, since this also affects the system menu.
- EnableMenuItem(GetSystemMenu(GetHWND(), false),
+ EnableMenuItem(GetSystemMenu(GetNativeView(), false),
SC_CLOSE, enable ? MF_ENABLED : MF_GRAYED);
// Let the window know the frame changed.
@@ -229,7 +229,7 @@ void Window::UpdateWindowTitle() {
std::wstring localized_text;
if (l10n_util::AdjustStringForLocaleDirection(window_title, &localized_text))
window_title.assign(localized_text);
- SetWindowText(GetHWND(), window_title.c_str());
+ SetWindowText(GetNativeView(), window_title.c_str());
}
void Window::UpdateWindowIcon() {
@@ -245,12 +245,12 @@ void Window::UpdateWindowIcon() {
// We need to make sure to destroy the previous icon, otherwise we'll leak
// these GDI objects until we crash!
HICON old_icon = reinterpret_cast<HICON>(
- SendMessage(GetHWND(), WM_SETICON, ICON_SMALL,
+ SendMessage(GetNativeView(), WM_SETICON, ICON_SMALL,
reinterpret_cast<LPARAM>(windows_icon)));
if (old_icon)
DestroyIcon(old_icon);
old_icon = reinterpret_cast<HICON>(
- SendMessage(GetHWND(), WM_SETICON, ICON_BIG,
+ SendMessage(GetNativeView(), WM_SETICON, ICON_BIG,
reinterpret_cast<LPARAM>(windows_icon)));
if (old_icon)
DestroyIcon(old_icon);
@@ -259,7 +259,7 @@ void Window::UpdateWindowIcon() {
void Window::ExecuteSystemMenuCommand(int command) {
if (command)
- SendMessage(GetHWND(), WM_SYSCOMMAND, command, 0);
+ SendMessage(GetNativeView(), WM_SYSCOMMAND, command, 0);
}
gfx::Rect Window::GetWindowBoundsForClientBounds(
@@ -353,7 +353,7 @@ void Window::Init(HWND parent, const gfx::Rect& bounds) {
set_window_ex_style(CalculateWindowExStyle());
WidgetWin::Init(parent, bounds, true);
- win_util::SetWindowUserData(GetHWND(), this);
+ win_util::SetWindowUserData(GetNativeView(), this);
// Create the ClientView, add it to the NonClientView and add the
// NonClientView to the RootView. This will cause everything to be parented.
@@ -387,7 +387,7 @@ void Window::UpdateFrameAfterFrameChange() {
}
void Window::SizeWindowToDefault() {
- win_util::CenterAndSizeWindow(owning_window(), GetHWND(),
+ win_util::CenterAndSizeWindow(owning_window(), GetNativeView(),
non_client_view_->GetPreferredSize().ToSIZE(),
false);
}
@@ -397,11 +397,11 @@ void Window::RunSystemMenu(const gfx::Point& point) {
// We need to call this otherwise there's a small chance that we aren't going
// to get a system menu. We also can't take the return value of this
// function. We need to call it *again* to get a valid HMENU.
- //::GetSystemMenu(GetHWND(), TRUE);
- HMENU system_menu = ::GetSystemMenu(GetHWND(), FALSE);
+ //::GetSystemMenu(GetNativeView(), TRUE);
+ HMENU system_menu = ::GetSystemMenu(GetNativeView(), FALSE);
int id = ::TrackPopupMenu(system_menu,
TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RETURNCMD,
- point.x(), point.y(), 0, GetHWND(), NULL);
+ point.x(), point.y(), 0, GetNativeView(), NULL);
ExecuteSystemMenuCommand(id);
}
@@ -466,7 +466,7 @@ LRESULT Window::OnDwmCompositionChanged(UINT msg, WPARAM w_param,
// WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want
// to notify our children too, since we can have MDI child windows who need to
// update their appearance.
- EnumChildWindows(GetHWND(), &SendDwmCompositionChanged, NULL);
+ EnumChildWindows(GetNativeView(), &SendDwmCompositionChanged, NULL);
return 0;
}
@@ -517,7 +517,7 @@ void Window::OnMouseLeave() {
POINT pt;
if (GetCursorPos(&pt)) {
LRESULT ht_component =
- ::SendMessage(GetHWND(), WM_NCHITTEST, 0, MAKELPARAM(pt.x, pt.y));
+ ::SendMessage(GetNativeView(), WM_NCHITTEST, 0, MAKELPARAM(pt.x, pt.y));
if (ht_component != HTNOWHERE) {
// If the mouse moved into a part of the window's non-client area, then
// don't send a mouse exited event since the mouse is still within the
@@ -541,7 +541,7 @@ LRESULT Window::OnNCActivate(BOOL active) {
if (!non_client_view_->UseNativeFrame()) {
// We can get WM_NCACTIVATE before we're actually visible. If we're not
// visible, no need to paint.
- if (IsWindowVisible(GetHWND())) {
+ if (IsWindowVisible(GetNativeView())) {
non_client_view_->SchedulePaint();
// We need to force a paint now, as a user dragging a window will block
// painting operations while the move is in progress.
@@ -583,7 +583,8 @@ LRESULT Window::OnNCCalcSize(BOOL mode, LPARAM l_param) {
// thickness of the auto-hide taskbar on each such edge, so the window isn't
// treated as a "fullscreen app", which would cause the taskbars to
// disappear.
- HMONITOR monitor = MonitorFromWindow(GetHWND(), MONITOR_DEFAULTTONEAREST);
+ HMONITOR monitor = MonitorFromWindow(GetNativeView(),
+ MONITOR_DEFAULTTONEAREST);
if (win_util::EdgeHasAutoHideTaskbar(ABE_LEFT, monitor))
client_rect->left += win_util::kAutoHideTaskbarThicknessPx;
if (win_util::EdgeHasAutoHideTaskbar(ABE_TOP, monitor))
@@ -610,7 +611,7 @@ LRESULT Window::OnNCHitTest(const CPoint& point) {
// First, give the NonClientView a chance to test the point to see if it
// provides any of the non-client area.
CPoint temp = point;
- MapWindowPoints(HWND_DESKTOP, GetHWND(), &temp, 1);
+ MapWindowPoints(HWND_DESKTOP, GetNativeView(), &temp, 1);
int component = non_client_view_->NonClientHitTest(gfx::Point(temp));
if (component != HTNOWHERE)
return component;
@@ -691,13 +692,13 @@ void Window::OnNCPaint(HRGN rgn) {
// In particular the docs mentiond DCX_CLIPCHILDREN, but as far as I can tell
// it doesn't work at all. So, instead we get the DC for the window then
// manually clip out the children.
- HDC dc = GetWindowDC(GetHWND());
+ HDC dc = GetWindowDC(GetNativeView());
ClipState clip_state;
clip_state.x = window_rect.left;
clip_state.y = window_rect.top;
- clip_state.parent = GetHWND();
+ clip_state.parent = GetNativeView();
clip_state.dc = dc;
- EnumChildWindows(GetHWND(), &ClipDCToChild,
+ EnumChildWindows(GetNativeView(), &ClipDCToChild,
reinterpret_cast<LPARAM>(&clip_state));
RootView* root_view = GetRootView();
@@ -722,7 +723,7 @@ void Window::OnNCPaint(HRGN rgn) {
root_view->ProcessPaint(&canvas);
}
- ReleaseDC(GetHWND(), dc);
+ ReleaseDC(GetNativeView(), dc);
}
void Window::OnNCLButtonDown(UINT ht_component, const CPoint& point) {
@@ -770,7 +771,7 @@ void Window::OnNCLButtonDown(UINT ht_component, const CPoint& point) {
// non-client painting, so we need to call it directly here inside a
// scoped update lock.
ScopedRedrawLock lock(this);
- DefWindowProc(GetHWND(), WM_NCLBUTTONDOWN, ht_component,
+ DefWindowProc(GetNativeView(), WM_NCLBUTTONDOWN, ht_component,
MAKELPARAM(point.x, point.y));
SetMsgHandled(TRUE);
}
@@ -811,7 +812,7 @@ LRESULT Window::OnSetCursor(HWND window, UINT hittest_code, UINT message) {
// This is annoying because they then have to move all the foreground windows
// out of the way to be able to activate said window. I love how on Windows,
// the answer isn't always logical.
- if (!IsWindowEnabled(GetHWND()))
+ if (!IsWindowEnabled(GetNativeView()))
return WidgetWin::OnSetCursor(window, hittest_code, message);
int index = RC_NORMAL;
@@ -844,14 +845,14 @@ LRESULT Window::OnSetCursor(HWND window, UINT hittest_code, UINT message) {
LRESULT Window::OnSetIcon(UINT size_type, HICON new_icon) {
// This shouldn't hurt even if we're using the native frame.
ScopedRedrawLock lock(this);
- return DefWindowProc(GetHWND(), WM_SETICON, size_type,
+ return DefWindowProc(GetNativeView(), WM_SETICON, size_type,
reinterpret_cast<LPARAM>(new_icon));
}
LRESULT Window::OnSetText(const wchar_t* text) {
// This shouldn't hurt even if we're using the native frame.
ScopedRedrawLock lock(this);
- return DefWindowProc(GetHWND(), WM_SETTEXT, NULL,
+ return DefWindowProc(GetNativeView(), WM_SETTEXT, NULL,
reinterpret_cast<LPARAM>(text));
}
@@ -861,7 +862,7 @@ void Window::OnSize(UINT size_param, const CSize& new_size) {
// layout differently when maximized).
SaveWindowPosition();
ChangeSize(size_param, new_size);
- RedrawWindow(GetHWND(), NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN);
+ RedrawWindow(GetNativeView(), NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN);
// ResetWindowRegion is going to trigger WM_NCPAINT. By doing it after we've
// invoked OnSize we ensure the RootView has been laid out.
@@ -896,7 +897,7 @@ void Window::OnSysCommand(UINT notification_code, CPoint click) {
is_always_on_top_ = !is_always_on_top_;
// Change the menu check state.
- HMENU system_menu = GetSystemMenu(GetHWND(), FALSE);
+ HMENU system_menu = GetSystemMenu(GetNativeView(), FALSE);
MENUITEMINFO menu_info;
memset(&menu_info, 0, sizeof(MENUITEMINFO));
menu_info.cbSize = sizeof(MENUITEMINFO);
@@ -915,7 +916,7 @@ void Window::OnSysCommand(UINT notification_code, CPoint click) {
RunSystemMenu(non_client_view_->GetSystemMenuPoint());
} else {
// Use the default implementation for any other command.
- DefWindowProc(GetHWND(), WM_SYSCOMMAND, notification_code,
+ DefWindowProc(GetNativeView(), WM_SYSCOMMAND, notification_code,
MAKELPARAM(click.y, click.x));
}
}
@@ -954,7 +955,7 @@ void Window::SetInitialFocus() {
} else {
// The window does not get keyboard messages unless we focus it, not sure
// why.
- SetFocus(GetHWND());
+ SetFocus(GetNativeView());
}
}
@@ -1019,7 +1020,7 @@ void Window::AddAlwaysOnTopSystemMenuItem() {
always_on_top_menu_text_ = l10n_util::GetString(IDS_ALWAYS_ON_TOP);
// Let's insert a menu to the window.
- HMENU system_menu = ::GetSystemMenu(GetHWND(), FALSE);
+ HMENU system_menu = ::GetSystemMenu(GetNativeView(), FALSE);
int index = ::GetMenuItemCount(system_menu) - 1;
if (index < 0) {
// Paranoia check.
@@ -1059,7 +1060,7 @@ void Window::RestoreEnabledIfNecessary() {
}
void Window::AlwaysOnTopChanged() {
- ::SetWindowPos(GetHWND(),
+ ::SetWindowPos(GetNativeView(),
is_always_on_top_ ? HWND_TOPMOST : HWND_NOTOPMOST,
0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
@@ -1106,7 +1107,7 @@ void Window::SaveWindowPosition() {
WINDOWPLACEMENT win_placement = { 0 };
win_placement.length = sizeof(WINDOWPLACEMENT);
- BOOL r = GetWindowPlacement(GetHWND(), &win_placement);
+ BOOL r = GetWindowPlacement(GetNativeView(), &win_placement);
DCHECK(r);
bool maximized = (win_placement.showCmd == SW_SHOWMAXIMIZED);
@@ -1117,12 +1118,12 @@ void Window::SaveWindowPosition() {
void Window::LockUpdates() {
lock_updates_ = true;
- saved_window_style_ = GetWindowLong(GetHWND(), GWL_STYLE);
- SetWindowLong(GetHWND(), GWL_STYLE, saved_window_style_ & ~WS_VISIBLE);
+ saved_window_style_ = GetWindowLong(GetNativeView(), GWL_STYLE);
+ SetWindowLong(GetNativeView(), GWL_STYLE, saved_window_style_ & ~WS_VISIBLE);
}
void Window::UnlockUpdates() {
- SetWindowLong(GetHWND(), GWL_STYLE, saved_window_style_);
+ SetWindowLong(GetNativeView(), GWL_STYLE, saved_window_style_);
lock_updates_ = false;
}
@@ -1138,7 +1139,7 @@ void Window::ResetWindowRegion(bool force) {
// Changing the window region is going to force a paint. Only change the
// window region if the region really differs.
HRGN current_rgn = CreateRectRgn(0, 0, 0, 0);
- int current_rgn_result = GetWindowRgn(GetHWND(), current_rgn);
+ int current_rgn_result = GetWindowRgn(GetNativeView(), current_rgn);
CRect window_rect;
GetWindowRect(&window_rect);
@@ -1160,7 +1161,7 @@ void Window::ResetWindowRegion(bool force) {
void Window::ProcessNCMousePress(const CPoint& point, int flags) {
CPoint temp = point;
- MapWindowPoints(HWND_DESKTOP, GetHWND(), &temp, 1);
+ MapWindowPoints(HWND_DESKTOP, GetNativeView(), &temp, 1);
UINT message_flags = 0;
if ((GetKeyState(VK_CONTROL) & 0x80) == 0x80)
message_flags |= MK_CONTROL;
@@ -1175,7 +1176,7 @@ LRESULT Window::CallDefaultNCActivateHandler(BOOL active) {
// window title bar directly, so we need to use a redraw lock here to prevent
// it from doing so.
ScopedRedrawLock lock(this);
- return DefWindowProc(GetHWND(), WM_NCACTIVATE, active, 0);
+ return DefWindowProc(GetNativeView(), WM_NCACTIVATE, active, 0);
}
void Window::InitClass() {