diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-12 19:29:06 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-12 19:29:06 +0000 |
commit | ed8b1b805203b6ccdb5517d0c30cc689dde65e98 (patch) | |
tree | 88b8d0c2e552f291fbb01e8aa660806597e9d3fc /chrome/browser/views | |
parent | 71994cd0877f3528079b1154d46d90801e515292 (diff) | |
download | chromium_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
Diffstat (limited to 'chrome/browser/views')
36 files changed, 363 insertions, 100 deletions
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); |