diff options
Diffstat (limited to 'chrome')
107 files changed, 663 insertions, 701 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index e11a3ce..800e5fb 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -1152,7 +1152,7 @@ void AutomationProvider::WindowGetViewBounds(const IPC::Message& message, void* iter = NULL; if (window_tracker_->ContainsHandle(handle)) { HWND hwnd = window_tracker_->GetResource(handle); - views::RootView* root_view = views::ContainerWin::FindRootView(hwnd); + views::RootView* root_view = views::WidgetWin::FindRootView(hwnd); if (root_view) { views::View* view = root_view->GetViewByID(view_id); if (view) { diff --git a/chrome/browser/automation/ui_controls.cc b/chrome/browser/automation/ui_controls.cc index c557ff7..58b85f6 100644 --- a/chrome/browser/automation/ui_controls.cc +++ b/chrome/browser/automation/ui_controls.cc @@ -335,7 +335,7 @@ bool SendMouseClick(MouseButton type) { void MoveMouseToCenterAndPress(views::View* view, MouseButton button, int state, Task* task) { DCHECK(view); - DCHECK(view->GetContainer()); + DCHECK(view->GetWidget()); gfx::Point view_center(view->width() / 2, view->height() / 2); views::View::ConvertPointToScreen(view, &view_center); SendMouseMove(view_center.x(), view_center.y()); diff --git a/chrome/browser/bookmarks/bookmark_context_menu.cc b/chrome/browser/bookmarks/bookmark_context_menu.cc index 9cdacbf..a4a1607 100644 --- a/chrome/browser/bookmarks/bookmark_context_menu.cc +++ b/chrome/browser/bookmarks/bookmark_context_menu.cc @@ -19,7 +19,6 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/views/container.h" #include "chrome/views/window.h" #include "generated_resources.h" diff --git a/chrome/browser/browser_uitest.cc b/chrome/browser/browser_uitest.cc index f564d4f..3bbffe1 100644 --- a/chrome/browser/browser_uitest.cc +++ b/chrome/browser/browser_uitest.cc @@ -12,7 +12,6 @@ #include "chrome/test/automation/tab_proxy.h" #include "chrome/test/automation/window_proxy.h" #include "chrome/test/ui/ui_test.h" -#include "chrome/views/container.h" #include "net/base/net_util.h" #include "net/url_request/url_request_unittest.h" diff --git a/chrome/browser/debugger/debugger_view.cc b/chrome/browser/debugger/debugger_view.cc index 169be19..6b59cd6 100644 --- a/chrome/browser/debugger/debugger_view.cc +++ b/chrome/browser/debugger/debugger_view.cc @@ -51,7 +51,7 @@ void DebuggerView::ViewHierarchyChanged(bool is_add, views::View* parent, views::View* child) { if (is_add && child == this) { - DCHECK(GetContainer()); + DCHECK(GetWidget()); OnInit(); } } diff --git a/chrome/browser/external_tab_container.cc b/chrome/browser/external_tab_container.cc index 62aec65..b52da83 100644 --- a/chrome/browser/external_tab_container.cc +++ b/chrome/browser/external_tab_container.cc @@ -14,7 +14,7 @@ #include "chrome/common/chrome_constants.h" #include "chrome/common/win_util.h" // Included for SetRootViewForHWND. -#include "chrome/views/container_win.h" +#include "chrome/views/widget_win.h" #include "chrome/test/automation/automation_messages.h" static const wchar_t kWindowObjectKey[] = L"ChromeWindowObject"; diff --git a/chrome/browser/external_tab_container.h b/chrome/browser/external_tab_container.h index bb8b21f..2ae64fbd 100644 --- a/chrome/browser/external_tab_container.h +++ b/chrome/browser/external_tab_container.h @@ -15,9 +15,9 @@ #include "chrome/common/chrome_constants.h" #include "chrome/common/notification_registrar.h" #include "chrome/common/notification_service.h" -#include "chrome/views/container.h" #include "chrome/views/focus_manager.h" #include "chrome/views/root_view.h" +#include "chrome/views/widget.h" class AutomationProvider; class TabContents; @@ -30,7 +30,7 @@ class TabContentsContainerView; // It also implements Container class ExternalTabContainer : public TabContentsDelegate, public NotificationObserver, - public views::Container, + public views::Widget, public views::KeystrokeListener, public CWindowImpl<ExternalTabContainer, CWindow, @@ -85,7 +85,7 @@ class ExternalTabContainer : public TabContentsDelegate, const NotificationDetails& details); //////////////////////////////////////////////////////////////////////////////// - // views::Container + // views::Widget //////////////////////////////////////////////////////////////////////////////// virtual void GetBounds(CRect *out, bool including_frame) const; virtual void MoveToFront(bool should_activate); diff --git a/chrome/browser/history_view.cc b/chrome/browser/history_view.cc index 17a3e77..4cec25f 100644 --- a/chrome/browser/history_view.cc +++ b/chrome/browser/history_view.cc @@ -22,8 +22,8 @@ #include "chrome/common/resource_bundle.h" #include "chrome/common/time_format.h" #include "chrome/common/win_util.h" -#include "chrome/views/container.h" #include "chrome/views/link.h" +#include "chrome/views/widget.h" #include "generated_resources.h" @@ -566,7 +566,7 @@ void HistoryItemRenderer::StarStateChanged(bool state) { gfx::Rect star_bounds(star_location.x(), star_location.y() + 4, star_toggle_->width(), star_toggle_->height()); - HWND parent = GetContainer()->GetHWND(); + HWND parent = GetWidget()->GetHWND(); Profile* profile = model_->profile(); GURL url = model_->GetURL(model_index_); @@ -839,8 +839,8 @@ views::VariableRowHeightScrollHelper::RowInfo } bool HistoryView::IsVisible() { - views::Container* vc = GetContainer(); - return vc && vc->IsVisible(); + views::Widget* widget = GetWidget(); + return widget && widget->IsVisible(); } void HistoryView::DidChangeBounds(const gfx::Rect& previous, @@ -1246,7 +1246,7 @@ void HistoryView::DeleteDayAtModelIndex(int index) { IDS_HISTORY_DELETE_PRIOR_VISITS_WARNING_TITLE); UINT flags = MB_OKCANCEL | MB_ICONWARNING | MB_TOPMOST | MB_SETFOREGROUND; - if (win_util::MessageBox(GetContainer()->GetHWND(), + if (win_util::MessageBox(GetWidget()->GetHWND(), text, caption, flags) != IDOK) { return; } diff --git a/chrome/browser/native_ui_contents.cc b/chrome/browser/native_ui_contents.cc index 0c87e8b..52e09076 100644 --- a/chrome/browser/native_ui_contents.cc +++ b/chrome/browser/native_ui_contents.cc @@ -16,12 +16,12 @@ #include "chrome/common/resource_bundle.h" #include "chrome/views/background.h" #include "chrome/views/checkbox.h" -#include "chrome/views/container_win.h" #include "chrome/views/grid_layout.h" #include "chrome/views/image_view.h" #include "chrome/views/root_view.h" #include "chrome/views/scroll_view.h" #include "chrome/views/throbber.h" +#include "chrome/views/widget_win.h" #include "generated_resources.h" @@ -150,7 +150,7 @@ NativeUIContents::~NativeUIContents() { void NativeUIContents::CreateView() { set_delete_on_destroy(false); - ContainerWin::Init(GetDesktopWindow(), gfx::Rect(), false); + WidgetWin::Init(GetDesktopWindow(), gfx::Rect(), false); } LRESULT NativeUIContents::OnCreate(LPCREATESTRUCT create_struct) { diff --git a/chrome/browser/native_ui_contents.h b/chrome/browser/native_ui_contents.h index 6b15ec5..d6de98c 100644 --- a/chrome/browser/native_ui_contents.h +++ b/chrome/browser/native_ui_contents.h @@ -8,10 +8,10 @@ #include "chrome/browser/page_state.h" #include "chrome/browser/tab_contents.h" #include "chrome/views/background.h" -#include "chrome/views/container_win.h" #include "chrome/views/link.h" #include "chrome/views/native_button.h" #include "chrome/views/text_field.h" +#include "chrome/views/widget_win.h" namespace views { class CheckBox; @@ -33,7 +33,7 @@ class NativeUI; // //////////////////////////////////////////////////////////////////////////////// class NativeUIContents : public TabContents, - public views::ContainerWin { + public views::WidgetWin { public: explicit NativeUIContents(Profile* profile); diff --git a/chrome/browser/render_widget_host_view_win.cc b/chrome/browser/render_widget_host_view_win.cc index e24ecbe..d530e5d 100644 --- a/chrome/browser/render_widget_host_view_win.cc +++ b/chrome/browser/render_widget_host_view_win.cc @@ -23,7 +23,7 @@ #include "chrome/common/plugin_messages.h" #include "chrome/common/win_util.h" // Included for views::kReflectedMessage - TODO(beng): move this to win_util.h! -#include "chrome/views/container_win.h" +#include "chrome/views/widget_win.h" #include "webkit/glue/webcursor.h" using base::TimeDelta; diff --git a/chrome/browser/tab_contents.cc b/chrome/browser/tab_contents.cc index ec3c8af..e5131dc 100644 --- a/chrome/browser/tab_contents.cc +++ b/chrome/browser/tab_contents.cc @@ -14,11 +14,11 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/views/container.h" #include "chrome/views/native_scroll_bar.h" #include "chrome/views/root_view.h" #include "chrome/views/view.h" #include "chrome/views/view_storage.h" +#include "chrome/views/widget.h" #include "generated_resources.h" @@ -347,7 +347,7 @@ void TabContents::StoreFocus() { if (container_hwnd) { views::View* focused_view = focus_manager->GetFocusedView(); if (focused_view) { - HWND hwnd = focused_view->GetRootView()->GetContainer()->GetHWND(); + HWND hwnd = focused_view->GetRootView()->GetWidget()->GetHWND(); if (container_hwnd == hwnd || ::IsChild(container_hwnd, hwnd)) focus_manager->ClearFocus(); } diff --git a/chrome/browser/task_manager.cc b/chrome/browser/task_manager.cc index b1994da..009d44c 100644 --- a/chrome/browser/task_manager.cc +++ b/chrome/browser/task_manager.cc @@ -915,7 +915,7 @@ void TaskManagerContents::ShowContextMenu(views::View* source, int y, bool is_mouse_gesture) { UpdateStatsCounters(); - Menu menu(this, Menu::TOPLEFT, source->GetContainer()->GetHWND()); + Menu menu(this, Menu::TOPLEFT, source->GetWidget()->GetHWND()); 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/blocked_popup_container.cc b/chrome/browser/views/blocked_popup_container.cc index 6d9320e..63f6eb8 100644 --- a/chrome/browser/views/blocked_popup_container.cc +++ b/chrome/browser/views/blocked_popup_container.cc @@ -457,11 +457,11 @@ void BlockedPopupContainer::AnimateToState(double state) { } //////////////////////////////////////////////////////////////////////////////// -// Override from views::ContainerWin: +// Override from views::WidgetWin: void BlockedPopupContainer::OnFinalMessage(HWND window) { owner_->WillClose(this); CloseEachTabContents(); - ContainerWin::OnFinalMessage(window); + WidgetWin::OnFinalMessage(window); } void BlockedPopupContainer::OnSize(UINT param, const CSize& size) { @@ -482,7 +482,7 @@ void BlockedPopupContainer::Init(const gfx::Point& initial_anchor) { container_view_->SetVisible(true); set_window_style(WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN); - ContainerWin::Init(owner_->GetContainerHWND(), gfx::Rect(), false); + WidgetWin::Init(owner_->GetContainerHWND(), gfx::Rect(), false); SetContentsView(container_view_); RepositionConstrainedWindowTo(initial_anchor); diff --git a/chrome/browser/views/blocked_popup_container.h b/chrome/browser/views/blocked_popup_container.h index 0ae552e..12800c7 100644 --- a/chrome/browser/views/blocked_popup_container.h +++ b/chrome/browser/views/blocked_popup_container.h @@ -13,7 +13,7 @@ #include "chrome/browser/tab_contents_delegate.h" #include "chrome/common/animation.h" #include "chrome/common/pref_member.h" -#include "chrome/views/container_win.h" +#include "chrome/views/widget_win.h" class BlockedPopupContainerView; class Profile; @@ -30,7 +30,7 @@ class TextButton; // class BlockedPopupContainer : public ConstrainedWindow, public TabContentsDelegate, - public views::ContainerWin, + public views::WidgetWin, public Animation { public: virtual ~BlockedPopupContainer(); @@ -101,7 +101,7 @@ class BlockedPopupContainer : public ConstrainedWindow, virtual void AnimateToState(double state); protected: - // Override from views::ContainerWin: + // Override from views::WidgetWin: virtual void OnFinalMessage(HWND window); virtual void OnSize(UINT param, const CSize& size); diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc index 49e758d6..aaca5af 100644 --- a/chrome/browser/views/bookmark_bar_view.cc +++ b/chrome/browser/views/bookmark_bar_view.cc @@ -39,10 +39,10 @@ #include "chrome/common/resource_bundle.h" #include "chrome/common/win_util.h" #include "chrome/views/chrome_menu.h" -#include "chrome/views/container.h" #include "chrome/views/menu_button.h" #include "chrome/views/tooltip_manager.h" #include "chrome/views/view_constants.h" +#include "chrome/views/widget.h" #include "chrome/views/window.h" #include "generated_resources.h" @@ -532,7 +532,7 @@ class MenuRunner : public views::MenuDelegate, std::vector<BookmarkNode*> nodes; nodes.push_back(menu_id_to_node_map_[id]); context_menu_.reset( - new BookmarkContextMenu(view_->GetContainer()->GetHWND(), + new BookmarkContextMenu(view_->GetWidget()->GetHWND(), view_->GetProfile(), view_->browser(), view_->GetPageNavigator(), @@ -1403,7 +1403,7 @@ void BookmarkBarView::RunMenu(views::View* view, gfx::Point screen_loc(x, 0); View::ConvertPointToScreen(this, &screen_loc); menu_runner_.reset(new MenuRunner(this, node, start_index)); - HWND parent_hwnd = GetContainer()->GetHWND(); + HWND parent_hwnd = GetWidget()->GetHWND(); menu_runner_->RunMenuAt(parent_hwnd, gfx::Rect(screen_loc.x(), screen_loc.y(), view->width(), bar_height), @@ -1428,7 +1428,7 @@ void BookmarkBarView::ButtonPressed(views::BaseButton* sender) { PageTransition::AUTO_BOOKMARK); } else { bookmark_utils::OpenAll( - GetContainer()->GetHWND(), profile_, GetPageNavigator(), node, + GetWidget()->GetHWND(), profile_, GetPageNavigator(), node, event_utils::DispositionFromEventFlags(sender->mouse_event_flags())); } UserMetrics::RecordAction(L"ClickedBookmarkBarURLButton", profile_); @@ -1463,7 +1463,7 @@ void BookmarkBarView::ShowContextMenu(View* source, } else { parent = model_->GetBookmarkBarNode(); } - BookmarkContextMenu controller(GetContainer()->GetHWND(), + BookmarkContextMenu controller(GetWidget()->GetHWND(), GetProfile(), browser(), GetPageNavigator(), parent, nodes, BookmarkContextMenu::BOOKMARK_BAR); @@ -1598,7 +1598,7 @@ void BookmarkBarView::ShowDropFolderForNode(BookmarkNode* node) { gfx::Point screen_loc; View::ConvertPointToScreen(view_to_position_menu_from, &screen_loc); drop_menu_runner_->RunMenuAt( - GetContainer()->GetHWND(), + GetWidget()->GetHWND(), gfx::Rect(screen_loc.x(), screen_loc.y(), view_to_position_menu_from->width(), view_to_position_menu_from->height()), @@ -1807,7 +1807,7 @@ void BookmarkBarView::StartThrobbing() { if (bubble_url_.is_empty()) return; // Bubble isn't showing; nothing to throb. - if (!GetContainer()) + if (!GetWidget()) return; // We're not showing, don't do anything. BookmarkNode* node = model_->GetMostRecentlyAddedNodeForURL(bubble_url_); diff --git a/chrome/browser/views/bookmark_bubble_view.cc b/chrome/browser/views/bookmark_bubble_view.cc index d32d3f3..a15e939 100644 --- a/chrome/browser/views/bookmark_bubble_view.cc +++ b/chrome/browser/views/bookmark_bubble_view.cc @@ -136,9 +136,9 @@ void BookmarkBubbleView::DidChangeBounds(const gfx::Rect& previous, } void BookmarkBubbleView::BubbleShown() { - DCHECK(GetContainer()); + DCHECK(GetWidget()); views::FocusManager* focus_manager = - views::FocusManager::GetFocusManager(GetContainer()->GetHWND()); + views::FocusManager::GetFocusManager(GetWidget()->GetHWND()); focus_manager->RegisterAccelerator( views::Accelerator(VK_RETURN, false, false, false), this); @@ -316,7 +316,7 @@ bool BookmarkBubbleView::CloseOnEscape() { } void BookmarkBubbleView::Close() { - static_cast<InfoBubble*>(GetContainer())->Close(); + static_cast<InfoBubble*>(GetWidget())->Close(); } void BookmarkBubbleView::RemoveBookmark() { @@ -342,16 +342,16 @@ 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(GetContainer()->GetHWND(), GA_ROOTOWNER); + HWND parent = GetAncestor(GetWidget()->GetHWND(), GA_ROOTOWNER); // We're about to show the bookmark editor. When the bookmark editor closes - // we want the browser to become active. ContainerWin::Hide() does a hide in + // we want the browser to become active. WidgetWin::Hide() does a hide in // a such way that activation isn't changed, which means when we close // Windows gets confused as to who it should give active status to. We // 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(GetContainer()->GetHWND(), SW_HIDE); + ShowWindow(GetWidget()->GetHWND(), 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 db8d5ec..eccca6d 100644 --- a/chrome/browser/views/bookmark_editor_view.cc +++ b/chrome/browser/views/bookmark_editor_view.cc @@ -221,8 +221,7 @@ 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, - GetContainer()->GetHWND())); + context_menu_.reset(new Menu(this, Menu::TOPLEFT, GetWidget()->GetHWND())); 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 fc36cd6..ae9973a 100644 --- a/chrome/browser/views/bookmark_manager_view.cc +++ b/chrome/browser/views/bookmark_manager_view.cc @@ -27,7 +27,6 @@ #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" #include "chrome/common/win_util.h" -#include "chrome/views/container_win.h" #include "chrome/views/grid_layout.h" #include "chrome/views/menu_button.h" #include "chrome/views/single_split_view.h" @@ -338,7 +337,7 @@ void BookmarkManagerView::OnDoubleClick() { // we can use // event_utils::DispositionFromEventFlags(sender->mouse_event_flags()) . bookmark_utils::OpenAll( - GetContainer()->GetHWND(), profile_, NULL, nodes, CURRENT_TAB); + GetWidget()->GetHWND(), profile_, NULL, nodes, CURRENT_TAB); } void BookmarkManagerView::OnTableViewDelete(views::TableView* table) { @@ -359,7 +358,7 @@ void BookmarkManagerView::OnKeyDown(unsigned short virtual_keycode) { SelectInTree(selected_nodes[0]); } else { bookmark_utils::OpenAll( - GetContainer()->GetHWND(), profile_, NULL, selected_nodes, + GetWidget()->GetHWND(), profile_, NULL, selected_nodes, CURRENT_TAB); } break; @@ -463,7 +462,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(GetContainer()->GetHWND(), x, y, + ShowMenu(GetWidget()->GetHWND(), x, y, is_table ? BookmarkContextMenu::BOOKMARK_MANAGER_TABLE : BookmarkContextMenu::BOOKMARK_MANAGER_TREE); } @@ -514,7 +513,7 @@ void BookmarkManagerView::FileSelected(const std::wstring& path, ProfileInfo profile_info; profile_info.browser_type = BOOKMARKS_HTML; profile_info.source_path = path; - StartImportingWithUI(GetContainer()->GetHWND(), FAVORITES, host, + StartImportingWithUI(GetWidget()->GetHWND(), FAVORITES, host, profile_info, profile_, new ImportObserverImpl(profile()), false); } else if (id == IDS_BOOKMARK_MANAGER_EXPORT_MENU) { @@ -640,7 +639,7 @@ void BookmarkManagerView::ShowMenu( std::vector<BookmarkNode*> nodes; if (node) nodes.push_back(node); - BookmarkContextMenu menu(GetContainer()->GetHWND(), profile_, NULL, NULL, + BookmarkContextMenu menu(GetWidget()->GetHWND(), profile_, NULL, NULL, node, nodes, config); menu.RunMenuAt(x, y); } @@ -679,7 +678,7 @@ void BookmarkManagerView::ShowToolsMenu(HWND host, int x, int y) { menu.AppendMenuItemWithLabel( IDS_BOOKMARK_MANAGER_EXPORT_MENU, l10n_util::GetString(IDS_BOOKMARK_MANAGER_EXPORT_MENU)); - menu.RunMenuAt(GetContainer()->GetHWND(), gfx::Rect(x, y, 0, 0), + menu.RunMenuAt(GetWidget()->GetHWND(), gfx::Rect(x, y, 0, 0), views::MenuItemView::TOPLEFT, true); } @@ -696,7 +695,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(), GetContainer()->GetHWND(), + filter_string, std::wstring(), GetWidget()->GetHWND(), reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_IMPORT_MENU)); } @@ -708,6 +707,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", - GetContainer()->GetHWND(), + GetWidget()->GetHWND(), 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 d504585..43e6b3a9 100644 --- a/chrome/browser/views/constrained_window_impl.cc +++ b/chrome/browser/views/constrained_window_impl.cc @@ -465,10 +465,10 @@ gfx::Size ConstrainedWindowNonClientView::GetPreferredSize() { void ConstrainedWindowNonClientView::ViewHierarchyChanged(bool is_add, View *parent, View *child) { - if (is_add && GetContainer()) { + if (is_add && GetWidget()) { // Add our Client View as we are added to the Container so that if we are // subsequently resized all the parent-child relationships are established. - if (is_add && GetContainer() && child == this) + if (is_add && GetWidget() && child == this) AddChildView(container_->client_view()); } } @@ -677,7 +677,7 @@ void ConstrainedWindowImpl::UpdateUI(unsigned int changed_flags) { } //////////////////////////////////////////////////////////////////////////////// -// ConstrainedWindowImpl, views::ContainerWin overrides: +// ConstrainedWindowImpl, views::WidgetWin overrides: void ConstrainedWindowImpl::OnDestroy() { // We do this here, rather than |Close|, since the window may be destroyed in @@ -709,7 +709,7 @@ void ConstrainedWindowImpl::OnFinalMessage(HWND window) { // list. owner_->WillClose(this); - ContainerWin::OnFinalMessage(window); + WidgetWin::OnFinalMessage(window); } void ConstrainedWindowImpl::OnGetMinMaxInfo(LPMINMAXINFO mm_info) { diff --git a/chrome/browser/views/dom_view.cc b/chrome/browser/views/dom_view.cc index ba74fac..ed8fa95 100644 --- a/chrome/browser/views/dom_view.cc +++ b/chrome/browser/views/dom_view.cc @@ -5,7 +5,6 @@ #include "chrome/browser/views/dom_view.h" #include "chrome/browser/dom_ui/dom_ui_host.h" -#include "chrome/views/container.h" DOMView::DOMView(const GURL& contents) : contents_(contents), initialized_(false), host_(NULL) { diff --git a/chrome/browser/views/download_item_view.cc b/chrome/browser/views/download_item_view.cc index ab21fe2..f3e4a2a 100644 --- a/chrome/browser/views/download_item_view.cc +++ b/chrome/browser/views/download_item_view.cc @@ -17,9 +17,9 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/resource_bundle.h" #include "chrome/common/win_util.h" -#include "chrome/views/container.h" #include "chrome/views/native_button.h" #include "chrome/views/root_view.h" +#include "chrome/views/widget.h" #include "generated_resources.h" @@ -659,7 +659,7 @@ bool DownloadItemView::OnMousePressed(const views::MouseEvent& event) { views::View::ConvertPointToScreen(this, &point); download_util::DownloadShelfContextMenu menu(download_, - GetContainer()->GetHWND(), + GetWidget()->GetHWND(), model_.get(), point.ToPOINT()); drop_down_pressed_ = false; diff --git a/chrome/browser/views/download_shelf_view.cc b/chrome/browser/views/download_shelf_view.cc index 4190d78..cb5ef66 100644 --- a/chrome/browser/views/download_shelf_view.cc +++ b/chrome/browser/views/download_shelf_view.cc @@ -204,7 +204,7 @@ void DownloadShelfView::Layout() { // another tab (that doesn't have a download shelf) _before_ the download // has started and we'll crash when calling SetVisible() below because // the NativeControlContainer ctor tries to use the Container. - if (!GetContainer()) + if (!GetWidget()) return; gfx::Size image_size = arrow_image_->GetPreferredSize(); diff --git a/chrome/browser/views/download_started_animation.cc b/chrome/browser/views/download_started_animation.cc index e716317..001208d 100644 --- a/chrome/browser/views/download_started_animation.cc +++ b/chrome/browser/views/download_started_animation.cc @@ -7,7 +7,7 @@ #include "chrome/app/theme/theme_resources.h" #include "chrome/browser/tab_contents.h" #include "chrome/common/resource_bundle.h" -#include "chrome/views/container_win.h" +#include "chrome/views/widget_win.h" // How long to spend moving downwards and fading out after waiting. static const int kMoveTimeMs = 600; @@ -44,7 +44,7 @@ DownloadStartedAnimation::DownloadStartedAnimation(TabContents* tab_contents) SetImage(kDownloadImage); gfx::Rect rc(0, 0, 0, 0); - popup_ = new views::ContainerWin; + popup_ = new views::WidgetWin; popup_->set_window_style(WS_POPUP); popup_->set_window_ex_style(WS_EX_LAYERED | WS_EX_TOOLWINDOW | WS_EX_TRANSPARENT); diff --git a/chrome/browser/views/download_started_animation.h b/chrome/browser/views/download_started_animation.h index 9ad3528..c097ca9 100644 --- a/chrome/browser/views/download_started_animation.h +++ b/chrome/browser/views/download_started_animation.h @@ -11,7 +11,7 @@ #include "chrome/views/image_view.h" namespace views { -class ContainerWin; +class WidgetWin; }; class TabContents; @@ -42,7 +42,7 @@ class DownloadStartedAnimation : public Animation, const NotificationDetails& details); // We use a HWND for the popup so that it may float above any HWNDs in our UI. - views::ContainerWin* popup_; + views::WidgetWin* popup_; // The content area holding us. TabContents* tab_contents_; diff --git a/chrome/browser/views/download_tab_view.cc b/chrome/browser/views/download_tab_view.cc index 6528fa5..6a83bd8 100644 --- a/chrome/browser/views/download_tab_view.cc +++ b/chrome/browser/views/download_tab_view.cc @@ -716,7 +716,7 @@ bool DownloadItemTabView::OnMousePressed(const views::MouseEvent& event) { views::View::ConvertPointToScreen(this, &point); download_util::DownloadDestinationContextMenu menu( - model_, GetContainer()->GetHWND(), point.ToPOINT()); + model_, GetWidget()->GetHWND(), point.ToPOINT()); } } else { parent_->ItemBecameSelected(NULL); @@ -758,8 +758,8 @@ bool DownloadItemTabView::OnMouseDragged(const views::MouseEvent& event) { void DownloadItemTabView::LinkActivated(views::Link* source, int event_flags) { // There are several links in our view that could have been clicked: if (source == file_name_) { - views::Container* container = this->GetContainer(); - HWND parent_window = container ? container->GetHWND() : NULL; + views::Widget* widget = this->GetWidget(); + HWND parent_window = widget ? widget->GetHWND() : NULL; model_->manager()->OpenDownloadInShell(model_, parent_window); } else if (source == pause_) { model_->TogglePause(); diff --git a/chrome/browser/views/find_bar_view.cc b/chrome/browser/views/find_bar_view.cc index a065c1b..d528096 100644 --- a/chrome/browser/views/find_bar_view.cc +++ b/chrome/browser/views/find_bar_view.cc @@ -250,7 +250,7 @@ void FindBarView::Paint(ChromeCanvas* canvas) { // middle and right). Note, that the window region has been set by the // controller, so the whitespace in the left and right background images is // actually outside the window region and is therefore not drawn. See - // FindInPageContainerWin::CreateRoundedWindowEdges() for details. + // FindInPageWidgetWin::CreateRoundedWindowEdges() for details. const SkBitmap *bg_left = toolbar_blend_ ? kDlgBackground_left : kDlgBackground_bb_left; const SkBitmap *bg_middle = diff --git a/chrome/browser/views/find_bar_win.cc b/chrome/browser/views/find_bar_win.cc index d0c0889..4df9801 100644 --- a/chrome/browser/views/find_bar_win.cc +++ b/chrome/browser/views/find_bar_win.cc @@ -13,11 +13,11 @@ #include "chrome/browser/views/find_bar_view.h" #include "chrome/browser/web_contents.h" #include "chrome/browser/web_contents_view.h" -#include "chrome/views/container_win.h" #include "chrome/views/external_focus_tracker.h" #include "chrome/views/native_scroll_bar.h" #include "chrome/views/root_view.h" #include "chrome/views/view_storage.h" +#include "chrome/views/widget_win.h" int FindBarWin::request_id_counter_ = 0; @@ -42,9 +42,9 @@ FindBarWin::FindBarWin(WebContentsView* parent_tab, HWND parent_hwnd) // own handler for Escape. SetFocusChangeListener(parent_hwnd); - // Don't let ContainerWin manage our lifetime. We want our lifetime to + // Don't let WidgetWin manage our lifetime. We want our lifetime to // coincide with WebContents. - ContainerWin::set_delete_on_destroy(false); + WidgetWin::set_delete_on_destroy(false); view_ = new FindBarView(this); @@ -60,7 +60,7 @@ FindBarWin::FindBarWin(WebContentsView* parent_tab, HWND parent_hwnd) gfx::Rect find_dlg_rect = GetDialogPosition(gfx::Rect()); set_window_style(WS_CHILD | WS_CLIPCHILDREN); set_window_ex_style(WS_EX_TOPMOST); - ContainerWin::Init(parent_hwnd, find_dlg_rect, false); + WidgetWin::Init(parent_hwnd, find_dlg_rect, false); SetContentsView(view_); // Start the process of animating the opening of the window. @@ -326,7 +326,7 @@ void FindBarWin::SetParent(HWND new_parent) { } //////////////////////////////////////////////////////////////////////////////// -// FindBarWin, views::ContainerWin implementation: +// FindBarWin, views::WidgetWin implementation: void FindBarWin::OnFinalMessage(HWND window) { // We are exiting, so we no longer need to monitor focus changes. @@ -483,12 +483,12 @@ void FindBarWin::GetDialogBounds(gfx::Rect* bounds) { gfx::Rect toolbar_bounds, bookmark_bar_bounds; if (toolbar) { toolbar_bounds = toolbar->GetLocalBounds(false); - // Need to convert toolbar bounds into Container coords because the toolbar + // Need to convert toolbar bounds into Widget coords because the toolbar // is the child of another view that isn't the top level view. This is // required to ensure correct positioning relative to the top,left of the // window. gfx::Point topleft; - views::View::ConvertPointToContainer(toolbar, &topleft); + views::View::ConvertPointToWidget(toolbar, &topleft); toolbar_bounds.Offset(topleft.x(), topleft.y()); } diff --git a/chrome/browser/views/find_bar_win.h b/chrome/browser/views/find_bar_win.h index bd3b06c..6cc6029 100644 --- a/chrome/browser/views/find_bar_win.h +++ b/chrome/browser/views/find_bar_win.h @@ -8,7 +8,7 @@ #include "base/gfx/rect.h" #include "chrome/browser/render_view_host_delegate.h" #include "chrome/common/animation.h" -#include "chrome/views/container_win.h" +#include "chrome/views/widget_win.h" class FindBarView; class RenderViewHost; @@ -34,7 +34,7 @@ class View; // //////////////////////////////////////////////////////////////////////////////// class FindBarWin : public views::FocusChangeListener, - public views::ContainerWin, + public views::WidgetWin, public AnimationDelegate { public: FindBarWin(WebContentsView* parent_tab, HWND parent_hwnd); @@ -113,7 +113,7 @@ class FindBarWin : public views::FocusChangeListener, int active_match_ordinal, bool final_update); - // Overridden from views::ContainerWin: + // Overridden from views::WidgetWin: virtual void OnFinalMessage(HWND window); // Overridden from views::FocusChangeListener: diff --git a/chrome/browser/views/frame/aero_glass_frame.cc b/chrome/browser/views/frame/aero_glass_frame.cc index a24e274..5694163 100644 --- a/chrome/browser/views/frame/aero_glass_frame.cc +++ b/chrome/browser/views/frame/aero_glass_frame.cc @@ -91,7 +91,7 @@ views::Window* AeroGlassFrame::GetWindow() { } /////////////////////////////////////////////////////////////////////////////// -// AeroGlassFrame, views::ContainerWin overrides: +// AeroGlassFrame, views::WidgetWin overrides: bool AeroGlassFrame::AcceleratorPressed(views::Accelerator* accelerator) { return browser_view_->AcceleratorPressed(*accelerator); diff --git a/chrome/browser/views/frame/aero_glass_frame.h b/chrome/browser/views/frame/aero_glass_frame.h index 86df734..7daa04a 100644 --- a/chrome/browser/views/frame/aero_glass_frame.h +++ b/chrome/browser/views/frame/aero_glass_frame.h @@ -39,7 +39,7 @@ class AeroGlassFrame : public BrowserFrame, virtual views::Window* GetWindow(); protected: - // Overridden from views::ContainerWin: + // Overridden from views::WidgetWin: virtual bool AcceleratorPressed(views::Accelerator* accelerator); virtual bool GetAccelerator(int cmd_id, views::Accelerator* accelerator); virtual void OnInitMenuPopup(HMENU menu, UINT position, BOOL is_system_menu); diff --git a/chrome/browser/views/frame/aero_glass_non_client_view.cc b/chrome/browser/views/frame/aero_glass_non_client_view.cc index 8e6694b..2f5b18c 100644 --- a/chrome/browser/views/frame/aero_glass_non_client_view.cc +++ b/chrome/browser/views/frame/aero_glass_non_client_view.cc @@ -181,7 +181,7 @@ gfx::Size AeroGlassNonClientView::CalculateWindowSizeForClientSize( CPoint AeroGlassNonClientView::GetSystemMenuPoint() const { CPoint offset(0, 0); - MapWindowPoints(GetContainer()->GetHWND(), HWND_DESKTOP, &offset, 1); + MapWindowPoints(GetWidget()->GetHWND(), HWND_DESKTOP, &offset, 1); return offset; } @@ -260,7 +260,7 @@ void AeroGlassNonClientView::ViewHierarchyChanged(bool is_add, views::View* parent, views::View* child) { if (is_add && child == this) { - DCHECK(GetContainer()); + DCHECK(GetWidget()); DCHECK(frame_->client_view()->GetParent() != this); AddChildView(frame_->client_view()); } diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index 2b6af47..8dbeb98 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -318,7 +318,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(GetContainer()->GetHWND(), kBrowserWindowKey, this); + SetProp(GetWidget()->GetHWND(), kBrowserWindowKey, this); // Start a hung plugin window detector for this browser object (as long as // hang detection is not disabled). @@ -342,7 +342,7 @@ void BrowserView::Init() { set_contents_view(contents_container_); AddChildView(contents_container_); - status_bubble_.reset(new StatusBubble(GetContainer())); + status_bubble_.reset(new StatusBubble(GetWidget())); #ifdef CHROME_PERSONALIZATION EnablePersonalization(CommandLine().HasSwitch(switches::kEnableP13n)); @@ -405,7 +405,7 @@ void BrowserView::FlashFrame() { } void* BrowserView::GetNativeHandle() { - return GetContainer()->GetHWND(); + return GetWidget()->GetHWND(); } TabStrip* BrowserView::GetTabStrip() const { @@ -525,7 +525,7 @@ void BrowserView::ToggleBookmarkBar() { void BrowserView::ShowAboutChromeDialog() { views::Window::CreateChromeWindow( - GetContainer()->GetHWND(), gfx::Rect(), + GetWidget()->GetHWND(), gfx::Rect(), new AboutChromeView(browser_->profile()))->Show(); } @@ -564,25 +564,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(GetContainer()->GetHWND(), screenshot_png); + win_util::GrabWindowSnapshot(GetWidget()->GetHWND(), 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(GetContainer()->GetHWND(), gfx::Rect(), + views::Window::CreateChromeWindow(GetWidget()->GetHWND(), gfx::Rect(), bug_report_view)->Show(); } void BrowserView::ShowClearBrowsingDataDialog() { views::Window::CreateChromeWindow( - GetContainer()->GetHWND(), gfx::Rect(), + GetWidget()->GetHWND(), gfx::Rect(), new ClearBrowsingDataView(browser_->profile()))->Show(); } void BrowserView::ShowImportDialog() { views::Window::CreateChromeWindow( - GetContainer()->GetHWND(), gfx::Rect(), + GetWidget()->GetHWND(), gfx::Rect(), new ImporterView(browser_->profile()))->Show(); } @@ -597,7 +597,7 @@ void BrowserView::ShowPasswordManager() { void BrowserView::ShowHTMLDialog(HtmlDialogContentsDelegate* delegate, void* parent_window) { HWND parent_hwnd = reinterpret_cast<HWND>(parent_window); - parent_hwnd = parent_hwnd ? parent_hwnd : GetContainer()->GetHWND(); + parent_hwnd = parent_hwnd ? parent_hwnd : GetWidget()->GetHWND(); HtmlDialogView* html_view = new HtmlDialogView(browser_.get(), browser_->profile(), delegate); @@ -909,7 +909,7 @@ void BrowserView::Layout() { void BrowserView::ViewHierarchyChanged(bool is_add, views::View* parent, views::View* child) { - if (is_add && child == this && GetContainer() && !initialized_) { + if (is_add && child == this && GetWidget() && !initialized_) { Init(); initialized_ = true; } @@ -1210,7 +1210,7 @@ void BrowserView::LoadAccelerators() { CopyAcceleratorTable(accelerator_table, accelerators, count); views::FocusManager* focus_manager = - views::FocusManager::GetFocusManager(GetContainer()->GetHWND()); + views::FocusManager::GetFocusManager(GetWidget()->GetHWND()); DCHECK(focus_manager); // Let's build our own accelerator table. @@ -1325,7 +1325,7 @@ void BrowserView::InitHangMonitor() { int hung_plugin_detect_freq = pref_service->GetInteger(prefs::kHungPluginDetectFrequency); if ((hung_plugin_detect_freq > 0) && - hung_window_detector_.Initialize(GetContainer()->GetHWND(), + hung_window_detector_.Initialize(GetWidget()->GetHWND(), plugin_message_response_timeout)) { ticker_.set_tick_interval(hung_plugin_detect_freq); ticker_.RegisterTickHandler(&hung_window_detector_); diff --git a/chrome/browser/views/frame/opaque_frame.cc b/chrome/browser/views/frame/opaque_frame.cc index f04d8e2..9a7f356 100644 --- a/chrome/browser/views/frame/opaque_frame.cc +++ b/chrome/browser/views/frame/opaque_frame.cc @@ -71,7 +71,7 @@ int OpaqueFrame::GetShowState() const { } /////////////////////////////////////////////////////////////////////////////// -// OpaqueFrame, views::ContainerWin overrides: +// OpaqueFrame, views::WidgetWin overrides: bool OpaqueFrame::AcceleratorPressed(views::Accelerator* accelerator) { return browser_view_->AcceleratorPressed(*accelerator); diff --git a/chrome/browser/views/frame/opaque_frame.h b/chrome/browser/views/frame/opaque_frame.h index f28d782..13c20d2 100644 --- a/chrome/browser/views/frame/opaque_frame.h +++ b/chrome/browser/views/frame/opaque_frame.h @@ -44,7 +44,7 @@ class OpaqueFrame : public BrowserFrame, virtual void UpdateWindowIcon(); virtual int GetShowState() const; - // Overridden from views::ContainerWin: + // Overridden from views::WidgetWin: virtual bool AcceleratorPressed(views::Accelerator* accelerator); virtual bool GetAccelerator(int cmd_id, views::Accelerator* accelerator); virtual void OnEndSession(BOOL ending, UINT logoff); diff --git a/chrome/browser/views/frame/opaque_non_client_view.cc b/chrome/browser/views/frame/opaque_non_client_view.cc index 1f30ae5..f7bfe22 100644 --- a/chrome/browser/views/frame/opaque_non_client_view.cc +++ b/chrome/browser/views/frame/opaque_non_client_view.cc @@ -667,7 +667,7 @@ void OpaqueNonClientView::ViewHierarchyChanged(bool is_add, views::View* parent, views::View* child) { if (is_add && child == this) { - DCHECK(GetContainer()); + DCHECK(GetWidget()); DCHECK(frame_->client_view()->GetParent() != this); AddChildView(frame_->client_view()); diff --git a/chrome/browser/views/hung_renderer_view.cc b/chrome/browser/views/hung_renderer_view.cc index 92f68b7..5e5a411 100644 --- a/chrome/browser/views/hung_renderer_view.cc +++ b/chrome/browser/views/hung_renderer_view.cc @@ -314,7 +314,7 @@ void HungRendererWarningView::ButtonPressed(views::NativeButton* sender) { void HungRendererWarningView::ViewHierarchyChanged(bool is_add, views::View* parent, views::View* child) { - if (!initialized_ && is_add && child == this && GetContainer()) + if (!initialized_ && is_add && child == this && GetWidget()) Init(); } diff --git a/chrome/browser/views/hwnd_html_view.cc b/chrome/browser/views/hwnd_html_view.cc index 1661624..41fc7c6 100644 --- a/chrome/browser/views/hwnd_html_view.cc +++ b/chrome/browser/views/hwnd_html_view.cc @@ -8,7 +8,7 @@ #include "chrome/browser/render_widget_host_view_win.h" #include "chrome/browser/render_view_host_delegate.h" #include "chrome/browser/site_instance.h" -#include "chrome/views/container.h" +#include "chrome/views/widget.h" HWNDHtmlView::~HWNDHtmlView() { if (render_view_host_) { @@ -47,6 +47,6 @@ void HWNDHtmlView::Init(HWND parent_hwnd) { void HWNDHtmlView::ViewHierarchyChanged(bool is_add, View* parent, View* child) { - if (is_add && GetContainer() && !initialized_) - Init(GetContainer()->GetHWND()); + if (is_add && GetWidget() && !initialized_) + Init(GetWidget()->GetHWND()); } diff --git a/chrome/browser/views/info_bar_item_view.cc b/chrome/browser/views/info_bar_item_view.cc index 78c4179..843f92e 100644 --- a/chrome/browser/views/info_bar_item_view.cc +++ b/chrome/browser/views/info_bar_item_view.cc @@ -7,10 +7,10 @@ #include "chrome/browser/views/standard_layout.h" #include "chrome/common/l10n_util.h" #include "chrome/common/resource_bundle.h" -#include "chrome/views/container.h" #include "chrome/views/external_focus_tracker.h" #include "chrome/views/image_view.h" #include "chrome/views/root_view.h" +#include "chrome/views/widget.h" #include "generated_resources.h" @@ -203,7 +203,7 @@ void InfoBarItemView::ViewHierarchyChanged(bool is_add, View* root_view = GetRootView(); HWND root_hwnd = NULL; if (root_view) - root_hwnd = root_view->GetContainer()->GetHWND(); + root_hwnd = root_view->GetWidget()->GetHWND(); if (root_hwnd) { focus_tracker_.reset(new views::ExternalFocusTracker( diff --git a/chrome/browser/views/info_bubble.cc b/chrome/browser/views/info_bubble.cc index 0fc2264..56e1e48 100644 --- a/chrome/browser/views/info_bubble.cc +++ b/chrome/browser/views/info_bubble.cc @@ -109,7 +109,7 @@ void InfoBubble::Init(HWND parent_hwnd, (win_util::GetWinVersion() < win_util::WINVERSION_XP) ? 0 : CS_DROPSHADOW); - ContainerWin::Init(parent_hwnd, bounds, true); + WidgetWin::Init(parent_hwnd, bounds, true); SetContentsView(content_view_); // The preferred size may differ when parented. Ask for the bounds again // and if they differ reset the bounds. @@ -145,7 +145,7 @@ void InfoBubble::Close() { if (delegate_) delegate_->InfoBubbleClosing(this); parent_->DisableInactiveRendering(false); - ContainerWin::Close(); + WidgetWin::Close(); } void InfoBubble::AnimationProgressed(const Animation* animation) { diff --git a/chrome/browser/views/info_bubble.h b/chrome/browser/views/info_bubble.h index cab1644..08a0667 100644 --- a/chrome/browser/views/info_bubble.h +++ b/chrome/browser/views/info_bubble.h @@ -6,8 +6,8 @@ #define CHROME_BROWSER_VIEWS_INFO_BUBBLE_H_ #include "chrome/common/slide_animation.h" -#include "chrome/views/container_win.h" #include "chrome/views/view.h" +#include "chrome/views/widget_win.h" // InfoBubble is used to display an arbitrary view above all other windows. // Think of InfoBubble as a tooltip that allows you to embed an arbitrary view @@ -33,7 +33,7 @@ class InfoBubbleDelegate { virtual bool CloseOnEscape() = 0; }; -class InfoBubble : public views::ContainerWin, +class InfoBubble : public views::WidgetWin, public AnimationDelegate { public: // Shows the InfoBubble. The InfoBubble is parented to parent_hwnd, contains diff --git a/chrome/browser/views/keyword_editor_view.cc b/chrome/browser/views/keyword_editor_view.cc index 1bd08a4..be35283 100644 --- a/chrome/browser/views/keyword_editor_view.cc +++ b/chrome/browser/views/keyword_editor_view.cc @@ -553,8 +553,7 @@ void KeywordEditorView::OnDoubleClick() { void KeywordEditorView::ButtonPressed(views::NativeButton* sender) { if (sender == add_button_) { EditKeywordController* controller = - new EditKeywordController(GetContainer()->GetHWND(), NULL, this, - profile_); + new EditKeywordController(GetWidget()->GetHWND(), NULL, this, profile_); controller->Show(); } else if (sender == remove_button_) { DCHECK(table_view_->SelectedRowCount() > 0); @@ -582,7 +581,7 @@ void KeywordEditorView::ButtonPressed(views::NativeButton* sender) { const TemplateURL* template_url = &table_model_->GetTemplateURL(selected_row); EditKeywordController* controller = - new EditKeywordController(GetContainer()->GetHWND(), template_url, + new EditKeywordController(GetWidget()->GetHWND(), 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 c28974f..c8a4ebc 100644 --- a/chrome/browser/views/location_bar_view.cc +++ b/chrome/browser/views/location_bar_view.cc @@ -26,8 +26,8 @@ #include "chrome/common/win_util.h" #include "chrome/views/background.h" #include "chrome/views/border.h" -#include "chrome/views/container.h" #include "chrome/views/root_view.h" +#include "chrome/views/widget.h" #include "generated_resources.h" using views::View; @@ -123,10 +123,9 @@ void LocationBarView::Init() { } // URL edit field. - views::Container* vc = GetContainer(); - DCHECK(vc) << "LocationBarView::Init - vc is NULL!"; + views::Widget* widget = GetWidget(); location_entry_.reset(new AutocompleteEditView(font_, this, model_, this, - vc->GetHWND(), + widget->GetHWND(), profile_, controller_, popup_window_mode_)); @@ -826,7 +825,7 @@ void LocationBarView::ShowInfoBubbleTask::Run() { if (cancelled_) return; - if (!image_view_->GetContainer()->IsActive()) { + if (!image_view_->GetWidget()->IsActive()) { // The browser is no longer active. Let's not show the info bubble, this // would make the browser the active window again. Also makes sure we NULL // show_info_bubble_task_ to prevent the SecurityImageView from keeping a @@ -847,7 +846,7 @@ void LocationBarView::ShowInfoBubbleTask::Cancel() { void LocationBarView::ShowFirstRunBubbleInternal() { if (!location_entry_view_) return; - if (!location_entry_view_->GetContainer()->IsActive()) { + if (!location_entry_view_->GetWidget()->IsActive()) { // The browser is no longer active. Let's not show the info bubble, this // would make the browser the active window again. return; @@ -872,7 +871,7 @@ void LocationBarView::ShowFirstRunBubbleInternal() { bounds.set_x(location.x() - 20); FirstRunBubble::Show( - location_entry_view_->GetRootView()->GetContainer()->GetHWND(), + location_entry_view_->GetRootView()->GetWidget()->GetHWND(), bounds); } @@ -945,7 +944,7 @@ void LocationBarView::SecurityImageView::ShowInfoBubble() { label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); label->SizeToFit(0); DCHECK(info_bubble_ == NULL); - info_bubble_ = InfoBubble::Show(GetRootView()->GetContainer()->GetHWND(), + info_bubble_ = InfoBubble::Show(GetRootView()->GetWidget()->GetHWND(), bounds, label, this); show_info_bubble_task_ = NULL; } @@ -989,7 +988,7 @@ bool LocationBarView::SecurityImageView::OnMousePressed( } PageInfoWindow::CreatePageInfo(profile_, nav_entry, - GetRootView()->GetContainer()->GetHWND(), + GetRootView()->GetWidget()->GetHWND(), 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 d50ce4e..c8f7d46 100644 --- a/chrome/browser/views/options/advanced_contents_view.cc +++ b/chrome/browser/views/options/advanced_contents_view.cc @@ -675,7 +675,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(GetContainer()->GetHWND(), GA_ROOT)); + GearsSettingsPressed(GetAncestor(GetWidget()->GetHWND(), GA_ROOT)); } } diff --git a/chrome/browser/views/options/content_page_view.cc b/chrome/browser/views/options/content_page_view.cc index acad68d..e4e443d 100644 --- a/chrome/browser/views/options/content_page_view.cc +++ b/chrome/browser/views/options/content_page_view.cc @@ -25,11 +25,11 @@ #include "chrome/common/pref_service.h" #include "chrome/common/resource_bundle.h" #include "chrome/views/checkbox.h" -#include "chrome/views/container.h" #include "chrome/views/grid_layout.h" #include "chrome/views/native_button.h" #include "chrome/views/radio_button.h" #include "chrome/views/text_field.h" +#include "chrome/views/widget.h" #include "generated_resources.h" #include "skia/include/SkBitmap.h" @@ -127,7 +127,7 @@ gfx::Size FileDisplayArea::GetPreferredSize() { void FileDisplayArea::ViewHierarchyChanged(bool is_add, views::View* parent, views::View* child) { - if (!initialized_ && is_add && GetContainer()) + if (!initialized_ && is_add && GetWidget()) Init(); } diff --git a/chrome/browser/views/options/fonts_page_view.cc b/chrome/browser/views/options/fonts_page_view.cc index aa0b7be..b41fb55 100644 --- a/chrome/browser/views/options/fonts_page_view.cc +++ b/chrome/browser/views/options/fonts_page_view.cc @@ -26,11 +26,11 @@ #include "chrome/common/pref_service.h" #include "chrome/common/resource_bundle.h" #include "chrome/views/checkbox.h" -#include "chrome/views/container.h" #include "chrome/views/grid_layout.h" #include "chrome/views/native_button.h" #include "chrome/views/radio_button.h" #include "chrome/views/text_field.h" +#include "chrome/views/widget.h" #include "generated_resources.h" #include "skia/include/SkBitmap.h" @@ -228,7 +228,7 @@ FontsPageView::~FontsPageView() { } void FontsPageView::ButtonPressed(views::NativeButton* sender) { - HWND owning_hwnd = GetAncestor(GetContainer()->GetHWND(), GA_ROOT); + HWND owning_hwnd = GetAncestor(GetWidget()->GetHWND(), 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 84e35f8..78d5235 100644 --- a/chrome/browser/views/options/languages_page_view.cc +++ b/chrome/browser/views/options/languages_page_view.cc @@ -28,12 +28,12 @@ #include "chrome/common/resource_bundle.h" #include "chrome/views/checkbox.h" #include "chrome/views/combo_box.h" -#include "chrome/views/container.h" #include "chrome/views/grid_layout.h" #include "chrome/views/native_button.h" #include "chrome/views/radio_button.h" #include "chrome/views/tabbed_pane.h" #include "chrome/views/text_field.h" +#include "chrome/views/widget.h" #include "skia/include/SkBitmap.h" #include "unicode/uloc.h" @@ -318,7 +318,7 @@ gfx::Size AddLanguageWindowView::GetPreferredSize() { void AddLanguageWindowView::ViewHierarchyChanged(bool is_add, views::View* parent, views::View* child) { - // Can't init before we're inserted into a Container, because we require + // Can't init before we're inserted into a Widget, because we require // a HWND to parent native child controls to. if (is_add && child == this) Init(); @@ -523,7 +523,7 @@ void LanguagesPageView::ButtonPressed(views::NativeButton* sender) { language_table_edited_ = true; } else if (sender == add_button_) { views::Window::CreateChromeWindow( - GetContainer()->GetHWND(), + GetWidget()->GetHWND(), 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 bf16a17..8fa28a4 100644 --- a/chrome/browser/views/options/options_page_view.cc +++ b/chrome/browser/views/options/options_page_view.cc @@ -7,7 +7,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/user_metrics.h" #include "chrome/common/pref_service.h" -#include "chrome/views/container.h" +#include "chrome/views/widget.h" /////////////////////////////////////////////////////////////////////////////// // OptionsPageView @@ -43,7 +43,7 @@ void OptionsPageView::Observe(NotificationType type, void OptionsPageView::ViewHierarchyChanged(bool is_add, views::View* parent, views::View* child) { - if (!initialized_ && is_add && GetContainer()) { + if (!initialized_ && is_add && GetWidget()) { // It is important that this only get done _once_ otherwise we end up // duplicating the view hierarchy when tabs are switched. initialized_ = true; @@ -53,7 +53,7 @@ void OptionsPageView::ViewHierarchyChanged(bool is_add, } HWND OptionsPageView::GetRootWindow() const { - // Our Container is the TabbedPane content HWND, which is a child HWND. + // Our Widget is the TabbedPane content HWND, which is a child HWND. // We need the root HWND for parenting. - return GetAncestor(GetContainer()->GetHWND(), GA_ROOT); + return GetAncestor(GetWidget()->GetHWND(), GA_ROOT); } diff --git a/chrome/browser/views/shelf_item_dialog.cc b/chrome/browser/views/shelf_item_dialog.cc index f32ce79..fed7d5c 100644 --- a/chrome/browser/views/shelf_item_dialog.cc +++ b/chrome/browser/views/shelf_item_dialog.cc @@ -455,7 +455,7 @@ bool ShelfItemDialog::AcceleratorPressed( window()->Close(); } else if (accelerator.GetKeyCode() == VK_RETURN) { views::FocusManager* fm = views::FocusManager::GetFocusManager( - GetContainer()->GetHWND()); + GetWidget()->GetHWND()); if (fm->GetFocusedView() == url_table_) { // Return on table behaves like a double click. OnDoubleClick(); diff --git a/chrome/browser/views/status_bubble.cc b/chrome/browser/views/status_bubble.cc index 526e9b3..db19e0c 100644 --- a/chrome/browser/views/status_bubble.cc +++ b/chrome/browser/views/status_bubble.cc @@ -16,7 +16,7 @@ #include "chrome/common/resource_bundle.h" #include "chrome/views/label.h" #include "chrome/views/root_view.h" -#include "chrome/views/container_win.h" +#include "chrome/views/widget_win.h" #include "googleurl/src/gurl.h" #include "net/base/net_util.h" #include "SkPaint.h" @@ -68,7 +68,7 @@ class StatusBubble::StatusView : public views::Label, public Animation, public AnimationDelegate { public: - StatusView(StatusBubble* status_bubble, views::ContainerWin* popup) + StatusView(StatusBubble* status_bubble, views::WidgetWin* popup) : Animation(kFramerate, this), status_bubble_(status_bubble), popup_(popup), @@ -152,7 +152,7 @@ class StatusBubble::StatusView : public views::Label, StatusBubble* status_bubble_; // Handle to the HWND that contains us. - views::ContainerWin* popup_; + views::WidgetWin* popup_; // The currently-displayed text. std::wstring text_; @@ -443,7 +443,7 @@ void StatusBubble::StatusView::Paint(ChromeCanvas* canvas) { // StatusBubble --------------------------------------------------------------- -StatusBubble::StatusBubble(views::Container* frame) +StatusBubble::StatusBubble(views::Widget* frame) : popup_(NULL), frame_(frame), view_(NULL), @@ -465,7 +465,7 @@ StatusBubble::~StatusBubble() { void StatusBubble::Init() { if (!popup_) { - popup_ = new views::ContainerWin(); + popup_ = new views::WidgetWin(); popup_->set_delete_on_destroy(false); if (!view_) { diff --git a/chrome/browser/views/status_bubble.h b/chrome/browser/views/status_bubble.h index 981eda7..834feccc 100644 --- a/chrome/browser/views/status_bubble.h +++ b/chrome/browser/views/status_bubble.h @@ -6,8 +6,8 @@ #define CHROME_BROWSER_VIEWS_STATUS_BUBBLE_H__ #include "base/gfx/rect.h" -#include "chrome/views/container.h" -#include "chrome/views/container_win.h" +#include "chrome/views/widget.h" +#include "chrome/views/widget_win.h" class GURL; @@ -16,7 +16,7 @@ class GURL; // to allow users to see where hovered links point to. class StatusBubble { public: - explicit StatusBubble(views::Container* frame); + explicit StatusBubble(views::Widget* frame); ~StatusBubble(); // Sets the bubble contents to a specific string and causes the bubble @@ -74,10 +74,10 @@ class StatusBubble { // We use a HWND for the popup so that it may float above any HWNDs in our // UI (the location bar, for example). - views::ContainerWin* popup_; + views::WidgetWin* popup_; double opacity_; - views::Container* frame_; + views::Widget* frame_; StatusView* view_; DISALLOW_EVIL_CONSTRUCTORS(StatusBubble); diff --git a/chrome/browser/views/tab_contents_container_view.cc b/chrome/browser/views/tab_contents_container_view.cc index c0c013b6..27e664e 100644 --- a/chrome/browser/views/tab_contents_container_view.cc +++ b/chrome/browser/views/tab_contents_container_view.cc @@ -13,8 +13,8 @@ #include "chrome/browser/tab_contents.h" #include "chrome/browser/view_ids.h" #include "chrome/browser/web_contents.h" -#include "chrome/views/container.h" #include "chrome/views/root_view.h" +#include "chrome/views/widget.h" using views::FocusTraversable; using views::FocusManager; @@ -235,7 +235,7 @@ 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()->GetContainer()->GetHWND()); + FocusManager::GetFocusManager(GetRootView()->GetWidget()->GetHWND()); 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 c88920a..b0a162d 100644 --- a/chrome/browser/views/tabs/dragged_tab_controller.cc +++ b/chrome/browser/views/tabs/dragged_tab_controller.cc @@ -208,7 +208,7 @@ class DraggedTabController::DockDisplayer : public AnimationDelegate { break; } - popup_ = new views::ContainerWin; + popup_ = new views::WidgetWin; popup_->set_window_style(WS_POPUP); popup_->set_window_ex_style(WS_EX_LAYERED | WS_EX_TOOLWINDOW | WS_EX_TOPMOST); @@ -282,7 +282,7 @@ class DraggedTabController::DockDisplayer : public AnimationDelegate { DraggedTabController* controller_; // Window we're showing. - views::ContainerWin* popup_; + views::WidgetWin* popup_; // HWND of |popup_|. We cache this to avoid the possibility of invoking a // method on popup_ after we close it. @@ -502,7 +502,7 @@ void DraggedTabController::DidProcessMessage(const MSG& msg) { void DraggedTabController::InitWindowCreatePoint() { window_create_point_.SetPoint(mouse_offset_.x(), mouse_offset_.y()); Tab* first_tab = attached_tabstrip_->GetTabAt(0); - views::View::ConvertPointToContainer(first_tab, &window_create_point_); + views::View::ConvertPointToWidget(first_tab, &window_create_point_); } gfx::Point DraggedTabController::GetWindowCreatePoint() const { @@ -664,7 +664,7 @@ DockInfo DraggedTabController::GetDockInfoAtPoint( return dock_info_; } - HWND dragged_hwnd = view_->GetContainer()->GetHWND(); + HWND dragged_hwnd = view_->GetWidget()->GetHWND(); dock_windows_.insert(dragged_hwnd); DockInfo info = DockInfo::GetDockInfoAtPoint(screen_point, dock_windows_); dock_windows_.erase(dragged_hwnd); @@ -673,7 +673,7 @@ DockInfo DraggedTabController::GetDockInfoAtPoint( TabStrip* DraggedTabController::GetTabStripForPoint( const gfx::Point& screen_point) { - HWND dragged_hwnd = view_->GetContainer()->GetHWND(); + HWND dragged_hwnd = view_->GetWidget()->GetHWND(); dock_windows_.insert(dragged_hwnd); HWND local_window = DockInfo::GetLocalProcessWindowAtPoint(screen_point, dock_windows_); @@ -776,7 +776,7 @@ void DraggedTabController::Attach(TabStrip* attached_tabstrip, tab->SetVisible(false); // Move the corresponding window to the front. - attached_tabstrip_->GetContainer()->MoveToFront(true); + attached_tabstrip_->GetWidget()->MoveToFront(true); } void DraggedTabController::Detach() { @@ -984,7 +984,7 @@ void DraggedTabController::RevertDrag() { // it has been hidden. if (restore_frame) { if (!restore_bounds_.IsEmpty()) { - HWND frame_hwnd = source_tabstrip_->GetContainer()->GetHWND(); + HWND frame_hwnd = source_tabstrip_->GetWidget()->GetHWND(); MoveWindow(frame_hwnd, restore_bounds_.x(), restore_bounds_.y(), restore_bounds_.width(), restore_bounds_.height(), TRUE); } @@ -1052,7 +1052,7 @@ bool DraggedTabController::CompleteDrag() { } // Compel the model to construct a new window for the detached TabContents. CRect browser_rect; - GetWindowRect(source_tabstrip_->GetContainer()->GetHWND(), &browser_rect); + GetWindowRect(source_tabstrip_->GetWidget()->GetHWND(), &browser_rect); gfx::Rect window_bounds( GetWindowCreatePoint(), gfx::Size(browser_rect.Width(), browser_rect.Height())); @@ -1101,7 +1101,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_->GetContainer()->GetHWND(); + HWND frame_hwnd = source_tabstrip_->GetWidget()->GetHWND(); RECT wr; GetWindowRect(frame_hwnd, &wr); MoveWindow(frame_hwnd, 0xFFFF, 0xFFFF, wr.right - wr.left, diff --git a/chrome/browser/views/tabs/dragged_tab_view.cc b/chrome/browser/views/tabs/dragged_tab_view.cc index 6f20c6a..9aaeee1 100644 --- a/chrome/browser/views/tabs/dragged_tab_view.cc +++ b/chrome/browser/views/tabs/dragged_tab_view.cc @@ -9,7 +9,7 @@ #include "chrome/browser/tabs/tab_strip_model.h" #include "chrome/browser/views/tabs/hwnd_photobooth.h" #include "chrome/browser/views/tabs/tab_renderer.h" -#include "chrome/views/container_win.h" +#include "chrome/views/widget_win.h" #include "skia/include/SkShader.h" const int kTransparentAlpha = 200; @@ -38,7 +38,7 @@ DraggedTabView::DraggedTabView(TabContents* datasource, renderer_->UpdateData(datasource); - container_.reset(new views::ContainerWin); + container_.reset(new views::WidgetWin); container_->set_delete_on_destroy(false); container_->set_window_style(WS_POPUP); container_->set_window_ex_style( @@ -107,7 +107,7 @@ void DraggedTabView::AnimateToBounds(const gfx::Rect& bounds, animation_callback_.reset(callback); RECT wr; - GetWindowRect(GetContainer()->GetHWND(), &wr); + GetWindowRect(GetWidget()->GetHWND(), &wr); animation_start_bounds_ = wr; animation_end_bounds_ = bounds; diff --git a/chrome/browser/views/tabs/dragged_tab_view.h b/chrome/browser/views/tabs/dragged_tab_view.h index be809f4..e219a5d 100644 --- a/chrome/browser/views/tabs/dragged_tab_view.h +++ b/chrome/browser/views/tabs/dragged_tab_view.h @@ -13,7 +13,7 @@ #include "skia/include/SkBitmap.h" namespace views { -class ContainerWin; +class WidgetWin; } namespace gfx { class Point; @@ -76,7 +76,7 @@ class DraggedTabView : public views::View, int ScaleValue(int value); // The window that contains the DraggedTabView. - scoped_ptr<views::ContainerWin> container_; + scoped_ptr<views::WidgetWin> container_; // The renderer that paints the Tab shape. scoped_ptr<TabRenderer> renderer_; diff --git a/chrome/browser/views/tabs/hwnd_photobooth.cc b/chrome/browser/views/tabs/hwnd_photobooth.cc index 052c4aa..19e130c 100644 --- a/chrome/browser/views/tabs/hwnd_photobooth.cc +++ b/chrome/browser/views/tabs/hwnd_photobooth.cc @@ -6,7 +6,7 @@ #include "chrome/browser/tab_contents.h" #include "chrome/browser/views/tabs/hwnd_photobooth.h" #include "chrome/common/gfx/chrome_canvas.h" -#include "chrome/views/container_win.h" +#include "chrome/views/widget_win.h" #include "skia/include/SkBitmap.h" namespace { @@ -143,7 +143,7 @@ void HWNDPhotobooth::CreateCaptureWindow(HWND initial_hwnd) { gfx::Point window_position = GetCaptureWindowPosition(); gfx::Rect capture_bounds(window_position.x(), window_position.y(), contents_rect.Width(), contents_rect.Height()); - capture_window_ = new views::ContainerWin; + capture_window_ = new views::WidgetWin; capture_window_->set_window_style(WS_POPUP); // WS_EX_TOOLWINDOW ensures the capture window doesn't produce a Taskbar // button. diff --git a/chrome/browser/views/tabs/hwnd_photobooth.h b/chrome/browser/views/tabs/hwnd_photobooth.h index e3fb423..56a5eb2 100644 --- a/chrome/browser/views/tabs/hwnd_photobooth.h +++ b/chrome/browser/views/tabs/hwnd_photobooth.h @@ -10,7 +10,7 @@ class ChromeCanvas; namespace views { -class ContainerWin; +class WidgetWin; } /////////////////////////////////////////////////////////////////////////////// @@ -50,7 +50,7 @@ class HWNDPhotobooth { void CreateCaptureWindow(HWND initial_hwnd); // The nearly off-screen photo-booth layered window used to hold the HWND. - views::ContainerWin* capture_window_; + views::WidgetWin* capture_window_; // The current HWND being captured. HWND current_hwnd_; diff --git a/chrome/browser/views/tabs/tab.cc b/chrome/browser/views/tabs/tab.cc index e170b76..d4b28ac 100644 --- a/chrome/browser/views/tabs/tab.cc +++ b/chrome/browser/views/tabs/tab.cc @@ -10,8 +10,8 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/resource_bundle.h" #include "chrome/views/chrome_menu.h" -#include "chrome/views/container.h" #include "chrome/views/tooltip_manager.h" +#include "chrome/views/widget.h" #include "generated_resources.h" const std::string Tab::kTabClassName = "browser/tabs/Tab"; @@ -53,7 +53,7 @@ class TabContextMenuController : public views::MenuDelegate { } void RunMenuAt(int x, int y) { - menu_->RunMenuAt(tab_->GetContainer()->GetHWND(), gfx::Rect(x, y, 0, 0), + menu_->RunMenuAt(tab_->GetWidget()->GetHWND(), gfx::Rect(x, y, 0, 0), views::MenuItemView::TOPLEFT, true); } diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc index 0f7a743..eb344c0 100644 --- a/chrome/browser/views/tabs/tab_strip.cc +++ b/chrome/browser/views/tabs/tab_strip.cc @@ -354,15 +354,15 @@ class RemoveTabAnimation : public TabStrip::TabAnimation { POINT pt; GetCursorPos(&pt); - views::Container* vc = tabstrip_->GetContainer(); + views::Widget* widget = tabstrip_->GetWidget(); RECT wr; - GetWindowRect(vc->GetHWND(), &wr); + GetWindowRect(widget->GetHWND(), &wr); pt.x -= wr.left; pt.y -= wr.top; // Return to message loop - otherwise we may disrupt some operation that's // in progress. - PostMessage(vc->GetHWND(), WM_MOUSEMOVE, 0, MAKELPARAM(pt.x, pt.y)); + PostMessage(widget->GetHWND(), WM_MOUSEMOVE, 0, MAKELPARAM(pt.x, pt.y)); } int index_; @@ -845,7 +845,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 && IsWindowVisible(GetContainer()->GetHWND())) { + if (GetTabCount() > 1 && IsWindowVisible(GetWidget()->GetHWND())) { StartInsertTabAnimation(index); } else { Layout(); @@ -1369,7 +1369,7 @@ TabStrip::DropInfo::DropInfo(int drop_index, bool drop_before, bool point_down) : drop_index(drop_index), drop_before(drop_before), point_down(point_down) { - arrow_window = new views::ContainerWin; + arrow_window = new views::WidgetWin; arrow_window->set_window_style(WS_POPUP); arrow_window->set_window_ex_style(WS_EX_TOPMOST | WS_EX_NOACTIVATE | WS_EX_LAYERED | WS_EX_TRANSPARENT); diff --git a/chrome/browser/views/tabs/tab_strip.h b/chrome/browser/views/tabs/tab_strip.h index 360ab41..e3389ab 100644 --- a/chrome/browser/views/tabs/tab_strip.h +++ b/chrome/browser/views/tabs/tab_strip.h @@ -9,9 +9,9 @@ #include "chrome/browser/tabs/tab_strip_model.h" #include "chrome/browser/views/tabs/tab.h" #include "chrome/views/button.h" -#include "chrome/views/container_win.h" #include "chrome/views/menu.h" #include "chrome/views/view.h" +#include "chrome/views/widget_win.h" class DraggedTabController; class ScopedMouseCloseWidthCalculator; @@ -332,7 +332,7 @@ class TabStrip : public views::View, bool point_down; // Renders the drop indicator. - views::ContainerWin* arrow_window; + views::WidgetWin* arrow_window; views::ImageView* arrow_view; private: diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc index 1b56e84..ad3d8d0 100644 --- a/chrome/browser/views/toolbar_view.cc +++ b/chrome/browser/views/toolbar_view.cc @@ -34,12 +34,12 @@ #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" #include "chrome/common/resource_bundle.h" -#include "chrome/views/container.h" +#include "chrome/views/background.h" #include "chrome/views/button_dropdown.h" #include "chrome/views/hwnd_view.h" -#include "chrome/views/background.h" #include "chrome/views/label.h" #include "chrome/views/tooltip_manager.h" +#include "chrome/views/widget.h" #include "net/base/net_util.h" #include "chromium_strings.h" @@ -341,16 +341,14 @@ void BrowserToolbarView::DidGainFocus() { acc_focused_view_->SetHotTracked(true); // Show the tooltip for the view that got the focus. - if (GetContainer()->GetTooltipManager()) { - GetContainer()->GetTooltipManager()-> - ShowKeyboardTooltip(acc_focused_view_); - } + if (GetWidget()->GetTooltipManager()) + GetWidget()->GetTooltipManager()->ShowKeyboardTooltip(acc_focused_view_); // Update focused_view with MSAA-adjusted child id. view_index = acc_focused_view_->GetID(); } - HWND hwnd = GetContainer()->GetHWND(); + HWND hwnd = GetWidget()->GetHWND(); // Notify Access Technology that there was a change in keyboard focus. ::NotifyWinEvent(EVENT_OBJECT_FOCUS, hwnd, OBJID_CLIENT, @@ -361,8 +359,8 @@ void BrowserToolbarView::WillLoseFocus() { // Resetting focus state. acc_focused_view_->SetHotTracked(false); // Any tooltips that are active should be hidden when toolbar loses focus. - if (GetContainer() && GetContainer()->GetTooltipManager()) - GetContainer()->GetTooltipManager()->HideKeyboardTooltip(); + if (GetWidget() && GetWidget()->GetTooltipManager()) + GetWidget()->GetTooltipManager()->HideKeyboardTooltip(); acc_focused_view_ = NULL; } @@ -388,8 +386,8 @@ bool BrowserToolbarView::OnKeyPressed(const views::KeyEvent& e) { acc_focused_view_->GetID() == VIEW_ID_APP_MENU) { // If a menu button in toolbar is activated and its menu is displayed, // then active tooltip should be hidden. - if (GetContainer()->GetTooltipManager()) - GetContainer()->GetTooltipManager()->HideKeyboardTooltip(); + if (GetWidget()->GetTooltipManager()) + GetWidget()->GetTooltipManager()->HideKeyboardTooltip(); // Safe to cast, given to above view id check. static_cast<views::MenuButton*>(acc_focused_view_)->Activate(); if (!acc_focused_view_) { @@ -422,11 +420,11 @@ bool BrowserToolbarView::OnKeyPressed(const views::KeyEvent& e) { // Retrieve information to generate an MSAA focus event. int view_id = acc_focused_view_->GetID(); - HWND hwnd = GetContainer()->GetHWND(); + HWND hwnd = GetWidget()->GetHWND(); // Show the tooltip for the view that got the focus. - if (GetContainer()->GetTooltipManager()) { - GetContainer()->GetTooltipManager()-> + if (GetWidget()->GetTooltipManager()) { + GetWidget()->GetTooltipManager()-> ShowKeyboardTooltip(GetChildViewAt(next_view)); } // Notify Access Technology that there was a change in keyboard focus. @@ -717,6 +715,6 @@ bool BrowserToolbarView::GetAcceleratorInfo(int id, return true; } // Else, we retrieve the accelerator information from the frame. - return GetContainer()->GetAccelerator(id, accel); + return GetWidget()->GetAccelerator(id, accel); } diff --git a/chrome/browser/views/user_data_dir_dialog.cc b/chrome/browser/views/user_data_dir_dialog.cc index 85e512d..ec0c535 100644 --- a/chrome/browser/views/user_data_dir_dialog.cc +++ b/chrome/browser/views/user_data_dir_dialog.cc @@ -70,7 +70,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_->GetContainer()->GetHWND(), GA_ROOT); + GetAncestor(message_box_view_->GetWidget()->GetHWND(), GA_ROOT); select_file_dialog_->SelectFile(SelectFileDialog::SELECT_FOLDER, dialog_title, std::wstring(), std::wstring(), std::wstring(), owning_hwnd, NULL); diff --git a/chrome/browser/web_contents_view_win.cc b/chrome/browser/web_contents_view_win.cc index 4a15e62..a3a9cdc 100644 --- a/chrome/browser/web_contents_view_win.cc +++ b/chrome/browser/web_contents_view_win.cc @@ -58,7 +58,7 @@ void WebContentsViewWin::CreateView() { // Since we create these windows parented to the desktop window initially, we // don't want to create them initially visible. set_window_style(WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); - ContainerWin::Init(GetDesktopWindow(), gfx::Rect(), false); + WidgetWin::Init(GetDesktopWindow(), gfx::Rect(), false); // Remove the root view drop target so we can register our own. RevokeDragDrop(GetHWND()); @@ -583,7 +583,7 @@ void WebContentsViewWin::OnWindowPosChanged(WINDOWPOS* window_pos) { } void WebContentsViewWin::OnSize(UINT param, const CSize& size) { - ContainerWin::OnSize(param, size); + WidgetWin::OnSize(param, size); // Hack for thinkpad touchpad driver. // Set fake scrollbars so that we can get scroll messages, diff --git a/chrome/browser/web_contents_view_win.h b/chrome/browser/web_contents_view_win.h index fa249c0..4b9d1fb 100644 --- a/chrome/browser/web_contents_view_win.h +++ b/chrome/browser/web_contents_view_win.h @@ -8,7 +8,7 @@ #include "base/gfx/size.h" #include "base/scoped_ptr.h" #include "chrome/browser/web_contents_view.h" -#include "chrome/views/container_win.h" +#include "chrome/views/widget_win.h" class FindBarWin; class InfoBarView; @@ -20,7 +20,7 @@ class WebDropTarget; // Windows-specific implementation of the WebContentsView. It is a HWND that // contains all of the contents of the tab and associated child views. class WebContentsViewWin : public WebContentsView, - public views::ContainerWin { + public views::WidgetWin { public: // The corresponding WebContents is passed in the constructor, and manages our // lifetime. This doesn't need to be the case, but is this way currently @@ -78,7 +78,7 @@ class WebContentsViewWin : public WebContentsView, private: // Windows events ------------------------------------------------------------ - // Overrides from ContainerWin. + // Overrides from WidgetWin. virtual void OnDestroy(); virtual void OnHScroll(int scroll_type, short position, HWND scrollbar); virtual void OnMouseLeave(); diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc index b9ca768..5052019 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc @@ -28,7 +28,7 @@ namespace { // to kill them. void CloseAllChromeProcesses() { for (int j = 0; j < 4; ++j) { - std::wstring wnd_class(L"Chrome_ContainerWin_"); + std::wstring wnd_class(L"Chrome_WidgetWin_"); wnd_class.append(IntToWString(j)); HWND window = FindWindowEx(NULL, NULL, wnd_class.c_str(), NULL); while (window) { diff --git a/chrome/test/accessibility/accessibility_util.cc b/chrome/test/accessibility/accessibility_util.cc index d52d57e..06b42ef 100644 --- a/chrome/test/accessibility/accessibility_util.cc +++ b/chrome/test/accessibility/accessibility_util.cc @@ -19,7 +19,7 @@ static const wchar_t* kBrowserWindowKey = L"__BROWSER_WINDOW__"; static BOOL CALLBACK WindowEnumProc(HWND hwnd, LPARAM data) { std::wstring class_name = win_util::GetClassName(hwnd); - if (class_name == L"Chrome_ContainerWin_0") { + if (class_name == L"Chrome_WidgetWin_0") { HANDLE window_interface = GetProp(hwnd, kBrowserWindowKey); if (window_interface) { HWND* out = reinterpret_cast<HWND*>(data); diff --git a/chrome/test/accessibility/constants.h b/chrome/test/accessibility/constants.h index a3d6060..dfba0f5 100644 --- a/chrome/test/accessibility/constants.h +++ b/chrome/test/accessibility/constants.h @@ -24,7 +24,7 @@ #define CHROME_VIEWS_TEXT_FIELD_EDIT _T("ChromeViewsTextFieldEdit") #define CHROME_AUTOCOMPLETE_EDIT _T("Chrome_AutocompleteEdit") #define CHROME_VIEWS_NATIVE_CTRL_CONTNR _T("ChromeViewsNativeControlContainer") -#define CHROME_HWND_VIEW_CONTAINER _T("Chrome_ContainerWin_0") +#define CHROME_HWND_VIEW_CONTAINER _T("Chrome_WidgetWin_0") #define STD_BUTTON _T("Button") #define AUTH_TITLE _T("Authentication Required - Chrome") #define CHROME_TAB_CONTENTS _T("Chrome_TabContents") diff --git a/chrome/views/accessibility/view_accessibility.cc b/chrome/views/accessibility/view_accessibility.cc index af2d933..ac7ed71 100644 --- a/chrome/views/accessibility/view_accessibility.cc +++ b/chrome/views/accessibility/view_accessibility.cc @@ -109,9 +109,9 @@ STDMETHODIMP ViewAccessibility::get_accParent(IDispatch** disp_parent) { views::View* parent = view_->GetParent(); if (!parent) { - // This function can get called during teardown of ContainerWin so we + // This function can get called during teardown of WidetWin so we // should bail out if we fail to get the HWND. - if (!view_->GetContainer() || !view_->GetContainer()->GetHWND()) { + if (!view_->GetWidget() || !view_->GetWidget()->GetHWND()) { *disp_parent = NULL; return S_FALSE; } @@ -120,7 +120,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_->GetContainer()->GetHWND(), + ::AccessibleObjectFromWindow(view_->GetWidget()->GetHWND(), OBJID_WINDOW, IID_IAccessible, reinterpret_cast<void**>(disp_parent)); diff --git a/chrome/views/aero_tooltip_manager.cc b/chrome/views/aero_tooltip_manager.cc index 5977644..29f3d66 100644 --- a/chrome/views/aero_tooltip_manager.cc +++ b/chrome/views/aero_tooltip_manager.cc @@ -18,8 +18,8 @@ namespace views { /////////////////////////////////////////////////////////////////////////////// // AeroTooltipManager, public: -AeroTooltipManager::AeroTooltipManager(Container* container, HWND parent) - : TooltipManager(container, parent), +AeroTooltipManager::AeroTooltipManager(Widget* widget, HWND parent) + : TooltipManager(widget, parent), initial_delay_(0) { } diff --git a/chrome/views/aero_tooltip_manager.h b/chrome/views/aero_tooltip_manager.h index 3b7b99a..7635904 100644 --- a/chrome/views/aero_tooltip_manager.h +++ b/chrome/views/aero_tooltip_manager.h @@ -28,7 +28,7 @@ namespace views { // TODO(glen): Resolve this with Microsoft. class AeroTooltipManager : public TooltipManager { public: - AeroTooltipManager(Container* container, HWND parent); + AeroTooltipManager(Widget* widget, HWND parent); virtual ~AeroTooltipManager(); virtual void OnMouse(UINT u_msg, WPARAM w_param, LPARAM l_param); diff --git a/chrome/views/bitmap_scroll_bar.cc b/chrome/views/bitmap_scroll_bar.cc index 5297f59..283f987 100644 --- a/chrome/views/bitmap_scroll_bar.cc +++ b/chrome/views/bitmap_scroll_bar.cc @@ -7,9 +7,9 @@ #include "base/message_loop.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/l10n_util.h" -#include "chrome/views/container.h" #include "chrome/views/menu.h" #include "chrome/views/scroll_view.h" +#include "chrome/views/widget.h" #include "skia/include/SkBitmap.h" #include "generated_resources.h" @@ -529,14 +529,14 @@ enum ScrollBarContextMenuCommands { void BitmapScrollBar::ShowContextMenu(View* source, int x, int y, bool is_mouse_gesture) { - Container* vc = GetContainer(); - CRect vc_bounds; - vc->GetBounds(&vc_bounds, true); - gfx::Point temp_pt(x - vc_bounds.left, y - vc_bounds.top); - View::ConvertPointFromContainer(this, &temp_pt); + Widget* widget = GetWidget(); + CRect widget_bounds; + widget->GetBounds(&widget_bounds, true); + gfx::Point temp_pt(x - widget_bounds.left, y - widget_bounds.top); + View::ConvertPointFromWidget(this, &temp_pt); context_menu_mouse_position_ = IsHorizontal() ? temp_pt.x() : temp_pt.y(); - Menu menu(this, Menu::TOPLEFT, GetContainer()->GetHWND()); + Menu menu(this, Menu::TOPLEFT, GetWidget()->GetHWND()); menu.AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollHere); menu.AppendSeparator(); menu.AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollStart); diff --git a/chrome/views/button.cc b/chrome/views/button.cc index 1a55aaf..93e2e3c 100644 --- a/chrome/views/button.cc +++ b/chrome/views/button.cc @@ -8,12 +8,11 @@ #include <atlapp.h> #include "base/gfx/image_operations.h" +#include "chrome/app/chrome_dll_resource.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/l10n_util.h" #include "chrome/common/throb_animation.h" -#include "chrome/views/container.h" #include "chrome/views/event.h" -#include "chrome/app/chrome_dll_resource.h" #include "generated_resources.h" diff --git a/chrome/views/button_dropdown.cc b/chrome/views/button_dropdown.cc index 2b07def..cb2b4b2 100644 --- a/chrome/views/button_dropdown.cc +++ b/chrome/views/button_dropdown.cc @@ -7,8 +7,8 @@ #include "base/message_loop.h" #include "chrome/browser/back_forward_menu_model.h" #include "chrome/common/l10n_util.h" -#include "chrome/views/container.h" #include "chrome/views/view_menu_delegate.h" +#include "chrome/views/widget.h" #include "generated_resources.h" @@ -49,7 +49,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, - GetContainer()->GetHWND()), + GetWidget()->GetHWND()), kMenuTimerDelay); } @@ -73,7 +73,7 @@ void ButtonDropDown::OnMouseReleased(const MouseEvent& e, bool canceled) { // update the appearance synchronously. SetState(BS_PUSHED); PaintNow(); - ShowDropDownMenu(GetContainer()->GetHWND()); + ShowDropDownMenu(GetWidget()->GetHWND()); } } @@ -91,7 +91,7 @@ bool ButtonDropDown::OnMouseDragged(const MouseEvent& e) { // it immediately. if (e.y() > y_position_on_lbuttondown_ + dragging_threshold) { show_menu_factory_.RevokeAll(); - ShowDropDownMenu(GetContainer()->GetHWND()); + ShowDropDownMenu(GetWidget()->GetHWND()); } } @@ -112,7 +112,7 @@ void ButtonDropDown::ShowContextMenu(int x, int y, bool is_mouse_gesture) { // update the appearance synchronously. SetState(BS_PUSHED); PaintNow(); - ShowDropDownMenu(GetContainer()->GetHWND()); + ShowDropDownMenu(GetWidget()->GetHWND()); SetState(BS_HOT); } diff --git a/chrome/views/chrome_menu.cc b/chrome/views/chrome_menu.cc index ffa4891..549bedf 100644 --- a/chrome/views/chrome_menu.cc +++ b/chrome/views/chrome_menu.cc @@ -21,9 +21,9 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/os_exchange_data.h" #include "chrome/views/border.h" -#include "chrome/views/container_win.h" #include "chrome/views/root_view.h" #include "chrome/views/view_constants.h" +#include "chrome/views/widget_win.h" #include "generated_resources.h" #undef min @@ -542,9 +542,9 @@ class MenuSeparator : public View { class MenuHostRootView : public RootView { public: - explicit MenuHostRootView(Container* container, + explicit MenuHostRootView(Widget* widget, SubmenuView* submenu) - : RootView(container), + : RootView(widget), submenu_(submenu), forward_drag_to_menu_controller_(true), suspend_events_(false) { @@ -648,7 +648,7 @@ class MenuHostRootView : public RootView { // DelayedClosed, which avoids timing issues with deleting the window while // capture or events are directed at it. -class MenuHost : public ContainerWin { +class MenuHost : public WidgetWin { public: MenuHost(SubmenuView* submenu) : closed_(false), @@ -672,7 +672,7 @@ class MenuHost : public ContainerWin { const gfx::Rect& bounds, View* contents_view, bool do_capture) { - ContainerWin::Init(parent, bounds, true); + WidgetWin::Init(parent, bounds, true); SetContentsView(contents_view); // We don't want to take focus away from the hosting window. ShowWindow(SW_SHOWNA); @@ -699,17 +699,17 @@ class MenuHost : public ContainerWin { GetRootView()->RemoveAllChildViews(false); closed_ = true; ReleaseCapture(); - ContainerWin::Hide(); + WidgetWin::Hide(); } virtual void HideWindow() { // Make sure we release capture before hiding. ReleaseCapture(); - ContainerWin::Hide(); + WidgetWin::Hide(); } virtual void OnCaptureChanged(HWND hwnd) { - ContainerWin::OnCaptureChanged(hwnd); + WidgetWin::OnCaptureChanged(hwnd); owns_capture_ = false; #ifdef DEBUG_MENU DLOG(INFO) << "Capture changed"; @@ -2638,7 +2638,7 @@ bool MenuController::IsMenuWindow(MenuItemView* item, HWND window) { if (!item) return false; return ((item->HasSubmenu() && item->GetSubmenu()->IsShowing() && - item->GetSubmenu()->GetContainer()->GetHWND() == window) || + item->GetSubmenu()->GetWidget()->GetHWND() == window) || IsMenuWindow(item->GetParentMenuItem(), window)); } diff --git a/chrome/views/chrome_menu.h b/chrome/views/chrome_menu.h index dd17a84..98ce67b 100644 --- a/chrome/views/chrome_menu.h +++ b/chrome/views/chrome_menu.h @@ -19,7 +19,7 @@ namespace views { -class ContainerWin; +class WidgetWin; class MenuController; class MenuItemView; class SubmenuView; @@ -484,7 +484,7 @@ class MenuItemView : public View { // . Forwards the appropriate events to the MenuController. This allows the // MenuController to update the selection as the user moves the mouse around. // . Renders the drop indicator during a drop operation. -// . Shows and hides the window (a ContainerWin) when the menu is shown on +// . Shows and hides the window (a WidgetWin) when the menu is shown on // screen. // // SubmenuView is itself contained in a MenuScrollViewContainer. @@ -590,7 +590,7 @@ class SubmenuView : public View { // Parent menu item. MenuItemView* parent_menu_item_; - // ContainerWin subclass used to show the children. + // WidgetWin subclass used to show the children. MenuHost* host_; // If non-null, indicates a drop is in progress and drop_item is the item diff --git a/chrome/views/client_view.cc b/chrome/views/client_view.cc index ba3f6e4..4f4bae3 100644 --- a/chrome/views/client_view.cc +++ b/chrome/views/client_view.cc @@ -38,7 +38,7 @@ gfx::Size ClientView::GetPreferredSize() { void ClientView::ViewHierarchyChanged(bool is_add, View* parent, View* child) { if (is_add && child == this) { - DCHECK(GetContainer()); + DCHECK(GetWidget()); DCHECK(contents_view_); // |contents_view_| must be valid now! AddChildView(contents_view_); } diff --git a/chrome/views/container.h b/chrome/views/container.h deleted file mode 100644 index 08f776c..0000000 --- a/chrome/views/container.h +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_VIEWS_CONTAINER_H_ -#define CHROME_VIEWS_CONTAINER_H_ - -// TODO(maruel): Remove once HWND is abstracted. -#include <windows.h> - -namespace gfx { -class Rect; -} - -// TODO(maruel): Remove once gfx::Rect is used instead. -namespace WTL { -class CRect; -} -using WTL::CRect; - -namespace views { - -class RootView; -class TooltipManager; -class Accelerator; - -///////////////////////////////////////////////////////////////////////////// -// -// Container interface -// -// Container is an abstract class that defines the API that should be -// implemented by a CWindow / HWND implementation in order to host a view -// hierarchy. -// -// Container wraps a hierarchy of View objects (see view.h) that implement -// painting and flexible layout within the bounds of the Container's window. -// -// The Container is responsible for handling various system events and -// forwarding them to the appropriate view. -// -///////////////////////////////////////////////////////////////////////////// - -class Container { - public: - virtual ~Container() { } - - // Returns the bounds of this container in the screen coordinate system. - // If the receiving view container is a frame which is larger than its - // client area, this method returns the client area if including_frame is - // false and the frame bounds otherwise. If the receiving view container - // is not a frame, including_frame is ignored. - virtual void GetBounds(CRect *out, bool including_frame) const = 0; - - // Moves this view container to the front of the Z-Order - // If should_activate is TRUE, the window should also become the active - // window - virtual void MoveToFront(bool should_activate) = 0; - - // Returns the Window HWND associated with this container - virtual HWND GetHWND() const = 0; - - // Forces a paint of a specified rectangle immediately. - virtual void PaintNow(const gfx::Rect& update_rect) = 0; - - // Returns the RootView contained by this container - virtual RootView* GetRootView() = 0; - - // Returns whether the view container is visible to the user - virtual bool IsVisible() = 0; - - // Returns whether the view container is the currently active window. - virtual bool IsActive() = 0; - - // Returns the TooltipManager for this Container. If this Container does not - // support tooltips, NULL is returned. - virtual TooltipManager* GetTooltipManager() { - return NULL; - } - - // Returns the accelerator given a command id. Returns false if there is - // no accelerator associated with a given id, which is a common condition. - virtual bool GetAccelerator(int cmd_id, - Accelerator* accelerator) = 0; -}; - -} // namespace views - -#endif // CHROME_VIEWS_VIEW_CONTAINER_H_ - diff --git a/chrome/views/custom_frame_window.cc b/chrome/views/custom_frame_window.cc index 33df287..3ff64a6 100644 --- a/chrome/views/custom_frame_window.cc +++ b/chrome/views/custom_frame_window.cc @@ -532,9 +532,9 @@ gfx::Size DefaultNonClientView::GetPreferredSize() { void DefaultNonClientView::ViewHierarchyChanged(bool is_add, View* parent, View* child) { - // Add our Client View as we are added to the Container so that if we are + // Add our Client View as we are added to the Widget so that if we are // subsequently resized all the parent-child relationships are established. - if (is_add && GetContainer() && child == this) + if (is_add && GetWidget() && child == this) AddChildView(container_->client_view()); } @@ -927,7 +927,7 @@ void CustomFrameWindow::SetClientView(ClientView* cv) { DCHECK(cv && !client_view() && GetHWND()); set_client_view(cv); // For a CustomFrameWindow, the non-client view is the root. - ContainerWin::SetContentsView(non_client_view_); + WidgetWin::SetContentsView(non_client_view_); // When the non client view is added to the view hierarchy, it will cause the // client view to be added as well. } @@ -977,7 +977,7 @@ void CustomFrameWindow::SizeWindowToDefault() { } /////////////////////////////////////////////////////////////////////////////// -// CustomFrameWindow, ContainerWin overrides: +// CustomFrameWindow, WidgetWin overrides: void CustomFrameWindow::OnGetMinMaxInfo(MINMAXINFO* minmax_info) { // We handle this message so that we can make sure we interact nicely with @@ -1207,7 +1207,7 @@ void CustomFrameWindow::OnNCLButtonDown(UINT ht_component, /* if (!IsMsgHandled()) { // Window::OnNCLButtonDown set the message as unhandled. This normally - // means ContainerWin::ProcessWindowMessage will pass it to + // means WidgetWin::ProcessWindowMessage will pass it to // DefWindowProc. Sadly, DefWindowProc for WM_NCLBUTTONDOWN does weird // non-client painting, so we need to call it directly here inside a // scoped update lock. @@ -1232,23 +1232,21 @@ void CustomFrameWindow::OnNCMButtonDown(UINT ht_component, SetMsgHandled(FALSE); return; } - ContainerWin::OnNCMButtonDown(ht_component, point); + WidgetWin::OnNCMButtonDown(ht_component, point); } LRESULT CustomFrameWindow::OnNCUAHDrawCaption(UINT msg, WPARAM w_param, LPARAM l_param) { - // See comment in hwnd_view_container.h at the definition of - // WM_NCUAHDRAWCAPTION for an explanation about why we need to handle this - // message. + // See comment in widget_win.h at the definition of WM_NCUAHDRAWCAPTION for + // an explanation about why we need to handle this message. SetMsgHandled(TRUE); return 0; } LRESULT CustomFrameWindow::OnNCUAHDrawFrame(UINT msg, WPARAM w_param, LPARAM l_param) { - // See comment in hwnd_view_container.h at the definition of - // WM_NCUAHDRAWCAPTION for an explanation about why we need to handle this - // message. + // See comment in widget_win.h at the definition of WM_NCUAHDRAWCAPTION for + // an explanation about why we need to handle this message. SetMsgHandled(TRUE); return 0; } diff --git a/chrome/views/custom_frame_window.h b/chrome/views/custom_frame_window.h index 85c6b2d..2878f91 100644 --- a/chrome/views/custom_frame_window.h +++ b/chrome/views/custom_frame_window.h @@ -47,7 +47,7 @@ class CustomFrameWindow : public Window { virtual void EnableClose(bool enable); virtual void DisableInactiveRendering(bool disable); - // Overridden from ContainerWin: + // Overridden from WidgetWin: virtual void OnGetMinMaxInfo(MINMAXINFO* minmax_info); virtual void OnInitMenu(HMENU menu); virtual void OnMouseLeave(); diff --git a/chrome/views/focus_manager.cc b/chrome/views/focus_manager.cc index 4164cb8..da23bda 100644 --- a/chrome/views/focus_manager.cc +++ b/chrome/views/focus_manager.cc @@ -9,11 +9,11 @@ #include "chrome/browser/render_widget_host_view_win.h" #include "chrome/common/notification_types.h" #include "chrome/views/accelerator.h" -#include "chrome/views/container.h" #include "chrome/views/focus_manager.h" #include "chrome/views/root_view.h" #include "chrome/views/view.h" #include "chrome/views/view_storage.h" +#include "chrome/views/widget.h" // The following keys are used in SetProp/GetProp to associate additional // information needed for focus tracking with a window. @@ -304,11 +304,11 @@ bool FocusManager::OnKeyDown(HWND window, UINT message, WPARAM wparam, DCHECK((message == WM_KEYDOWN) || (message == WM_SYSKEYDOWN)); if (!IsWindowVisible(root_)) { - // We got a message for a hidden window. Because ContainerWin::Close - // hides the window, then destroys it, it it possible to get a message after - // we've hidden the window. If we allow the message to be dispatched - // chances are we'll crash in some weird place. By returning false we make - // sure the message isn't dispatched. + // We got a message for a hidden window. Because WidgetWin::Close hides the + // window, then destroys it, it it possible to get a message after we've + // hidden the window. If we allow the message to be dispatched chances are + // we'll crash in some weird place. By returning false we make sure the + // message isn't dispatched. return false; } @@ -425,11 +425,11 @@ bool FocusManager::ContainsView(View* view) { if (!root_view) return false; - Container* view_container = root_view->GetContainer(); - if (!view_container) + Widget* widget = root_view->GetWidget(); + if (!widget) return false; - HWND window = view_container->GetHWND(); + HWND window = widget->GetHWND(); while (window) { if (window == root_) return true; @@ -457,7 +457,7 @@ View* FocusManager::GetNextFocusableView(View* original_starting_view, View* starting_view = NULL; if (original_starting_view) { // If the starting view has a focus traversable, use it. - // This is the case with ContainerWins for example. + // This is the case with WidgetWins for example. focus_traversable = original_starting_view->GetFocusTraversable(); // Otherwise default to the root view. diff --git a/chrome/views/focus_manager.h b/chrome/views/focus_manager.h index 835b745..4fcd1ce 100644 --- a/chrome/views/focus_manager.h +++ b/chrome/views/focus_manager.h @@ -29,10 +29,10 @@ // This is already done for you if you subclass the NativeControl class or if // you use the HWNDView class. // -// When creating a top window, if it derives from ContainerWin, the +// When creating a top window, if it derives from WidgetWin, the // |has_own_focus_manager| of the Init method lets you specify whether that // window should have its own focus manager (so focus traversal stays confined -// in that window). If you are not deriving from ContainerWin or one of its +// in that window). If you are not deriving from WidgetWin or one of its // derived classes (Window, FramelessWindow, ConstrainedWindow), you must // create a FocusManager when the window is created (it is automatically deleted // when the window is destroyed). @@ -49,7 +49,7 @@ // method SetNextFocusableView(). // // If you are embedding a native view containing a nested RootView (for example -// by adding a NativeControl that contains a ContainerWin as its native +// by adding a NativeControl that contains a WidgetWin as its native // component), then you need to: // - override the View::GetFocusTraversable() method in your outter component. // It should return the RootView of the inner component. This is used when diff --git a/chrome/views/focus_manager_unittest.cc b/chrome/views/focus_manager_unittest.cc index 861979e..30f7e85 100644 --- a/chrome/views/focus_manager_unittest.cc +++ b/chrome/views/focus_manager_unittest.cc @@ -14,7 +14,6 @@ #include "chrome/views/background.h" #include "chrome/views/border.h" #include "chrome/views/checkbox.h" -#include "chrome/views/container_win.h" #include "chrome/views/label.h" #include "chrome/views/link.h" #include "chrome/views/native_button.h" @@ -23,6 +22,7 @@ #include "chrome/views/scroll_view.h" #include "chrome/views/tabbed_pane.h" #include "chrome/views/text_field.h" +#include "chrome/views/widget_win.h" #include "chrome/views/window.h" #include "chrome/views/window_delegate.h" #include "SkColor.h" @@ -114,10 +114,10 @@ class BorderView : public views::NativeControl { 0, 0, width(), height(), parent_container, NULL, NULL, NULL); // Create the view container which is a child of the TabControl. - view_container_ = new views::ContainerWin(); - view_container_->Init(tab_control, gfx::Rect(), false); - view_container_->SetContentsView(child_); - view_container_->SetFocusTraversableParentView(this); + widget_ = new views::WidgetWin(); + widget_->Init(tab_control, gfx::Rect(), false); + widget_->SetContentsView(child_); + widget_->SetFocusTraversableParentView(this); ResizeContents(tab_control); return tab_control; } @@ -132,11 +132,11 @@ class BorderView : public views::NativeControl { } virtual views::RootView* GetContentsRootView() { - return view_container_->GetRootView(); + return widget_->GetRootView(); } virtual views::FocusTraversable* GetFocusTraversable() { - return view_container_; + return widget_; } virtual void ViewHierarchyChanged(bool is_add, View *parent, View *child) { @@ -145,7 +145,7 @@ class BorderView : public views::NativeControl { if (child == this && is_add) { // We have been added to a view hierarchy, update the FocusTraversable // parent. - view_container_->SetFocusTraversableParent(GetRootView()); + widget_->SetFocusTraversableParent(GetRootView()); } } @@ -156,18 +156,18 @@ private: if (!GetClientRect(tab_control, &content_bounds)) return; TabCtrl_AdjustRect(tab_control, FALSE, &content_bounds); - view_container_->MoveWindow(content_bounds.left, content_bounds.top, + widget_->MoveWindow(content_bounds.left, content_bounds.top, content_bounds.Width(), content_bounds.Height(), TRUE); } View* child_; - views::ContainerWin* view_container_; + views::WidgetWin* widget_; DISALLOW_EVIL_CONSTRUCTORS(BorderView); }; -class TestViewWindow : public views::ContainerWin { +class TestViewWindow : public views::WidgetWin { public: explicit TestViewWindow(FocusManagerTest* test); ~TestViewWindow() { } @@ -239,7 +239,7 @@ void TestViewWindow::Init() { contents_->set_background( views::Background::CreateSolidBackground(255, 255, 255)); - ContainerWin::Init(NULL, bounds, true); + WidgetWin::Init(NULL, bounds, true); SetContentsView(contents_); views::CheckBox* cb = diff --git a/chrome/views/hwnd_view.cc b/chrome/views/hwnd_view.cc index 9a4ab30..22990fb 100644 --- a/chrome/views/hwnd_view.cc +++ b/chrome/views/hwnd_view.cc @@ -6,9 +6,9 @@ #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/win_util.h" -#include "chrome/views/container.h" #include "chrome/views/focus_manager.h" #include "chrome/views/scroll_view.h" +#include "chrome/views/widget.h" #include "base/logging.h" namespace views { @@ -38,7 +38,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_, GetContainer()->GetHWND()); + ::SetParent(hwnd_, GetWidget()->GetHWND()); UpdateHWNDBounds(); // Register with the focus manager so the associated view is focused when the @@ -67,11 +67,11 @@ void HWNDView::UpdateHWNDBounds() { return; // Since HWNDs know nothing about the View hierarchy (they are direct - // children of the Container that hosts our View hierarchy) they need to be - // positioned in the coordinate system of the Container, not the current + // children of the Widget that hosts our View hierarchy) they need to be + // positioned in the coordinate system of the Widget, not the current // view. gfx::Point top_left; - ConvertPointToContainer(this, &top_left); + ConvertPointToWidget(this, &top_left); gfx::Rect vis_bounds = GetVisibleBounds(); bool visible = !vis_bounds.IsEmpty(); @@ -150,12 +150,12 @@ gfx::Size HWNDView::GetPreferredSize() { void HWNDView::ViewHierarchyChanged(bool is_add, View *parent, View *child) { if (hwnd_) { - Container* vc = GetContainer(); - if (is_add && vc) { + Widget* widget = GetWidget(); + if (is_add && widget) { HWND parent = ::GetParent(hwnd_); - HWND vc_hwnd = vc->GetHWND(); - if (parent != vc_hwnd) { - ::SetParent(hwnd_, vc_hwnd); + HWND widget_hwnd = widget->GetHWND(); + if (parent != widget_hwnd) { + ::SetParent(hwnd_, widget_hwnd); } if (IsVisibleInRootView()) ::ShowWindow(hwnd_, SW_SHOW); diff --git a/chrome/views/label.cc b/chrome/views/label.cc index d63e2f0..fc1e9d3 100644 --- a/chrome/views/label.cc +++ b/chrome/views/label.cc @@ -15,7 +15,6 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/resource_bundle.h" #include "chrome/views/background.h" -#include "chrome/views/container.h" namespace views { diff --git a/chrome/views/menu_button.cc b/chrome/views/menu_button.cc index 59b0aa2..011a8b3 100644 --- a/chrome/views/menu_button.cc +++ b/chrome/views/menu_button.cc @@ -14,10 +14,10 @@ #include "chrome/common/resource_bundle.h" #include "chrome/common/win_util.h" #include "chrome/views/button.h" -#include "chrome/views/container.h" #include "chrome/views/event.h" #include "chrome/views/root_view.h" #include "chrome/views/view_menu_delegate.h" +#include "chrome/views/widget.h" #include "generated_resources.h" @@ -105,14 +105,14 @@ void MenuButton::Paint(ChromeCanvas* canvas, bool for_drag) { //////////////////////////////////////////////////////////////////////////////// int MenuButton::GetMaximumScreenXCoordinate() { - Container* vc = GetContainer(); + Widget* widget = GetWidget(); - if (!vc) { + if (!widget) { NOTREACHED(); return 0; } - HWND hwnd = vc->GetHWND(); + HWND hwnd = widget->GetHWND(); CRect t; ::GetWindowRect(hwnd, &t); @@ -158,7 +158,7 @@ bool MenuButton::Activate() { menu_visible_ = true; menu_delegate_->RunMenu(this, menu_position.ToPOINT(), - GetContainer()->GetHWND()); + GetWidget()->GetHWND()); menu_visible_ = false; menu_closed_time_ = Time::Now(); diff --git a/chrome/views/native_control.cc b/chrome/views/native_control.cc index fd81b4f..4236e27 100644 --- a/chrome/views/native_control.cc +++ b/chrome/views/native_control.cc @@ -11,11 +11,11 @@ #include "base/win_util.h" #include "chrome/common/l10n_util.h" +#include "chrome/views/background.h" #include "chrome/views/border.h" -#include "chrome/views/container.h" #include "chrome/views/focus_manager.h" #include "chrome/views/hwnd_view.h" -#include "chrome/views/background.h" +#include "chrome/views/widget.h" #include "base/gfx/native_theme.h" namespace views { @@ -36,7 +36,7 @@ class NativeControlContainer : public CWindowImpl<NativeControlContainer, explicit NativeControlContainer(NativeControl* parent) : parent_(parent), control_(NULL) { - Create(parent->GetContainer()->GetHWND()); + Create(parent->GetWidget()->GetHWND()); ::ShowWindow(m_hWnd, SW_SHOW); } @@ -199,14 +199,14 @@ void NativeControl::ValidateNativeControl() { void NativeControl::ViewHierarchyChanged(bool is_add, View *parent, View *child) { - if (is_add && GetContainer()) { + if (is_add && GetWidget()) { ValidateNativeControl(); Layout(); } } void NativeControl::Layout() { - if (!container_ && GetContainer()) + if (!container_ && GetWidget()) ValidateNativeControl(); if (hwnd_view_) { diff --git a/chrome/views/native_scroll_bar.cc b/chrome/views/native_scroll_bar.cc index fb10520..38f4b8d 100644 --- a/chrome/views/native_scroll_bar.cc +++ b/chrome/views/native_scroll_bar.cc @@ -11,8 +11,8 @@ #include <atlframe.h> #include "base/message_loop.h" -#include "chrome/views/container.h" #include "chrome/views/hwnd_view.h" +#include "chrome/views/widget.h" namespace views { @@ -30,7 +30,7 @@ class ScrollBarContainer : public CWindowImpl<ScrollBarContainer, public: ScrollBarContainer(ScrollBar* parent) : parent_(parent), scrollbar_(NULL) { - Create(parent->GetContainer()->GetHWND()); + Create(parent->GetWidget()->GetHWND()); ::ShowWindow(m_hWnd, SW_SHOW); } @@ -126,8 +126,8 @@ class ScrollBarContainer : public CWindowImpl<ScrollBarContainer, // If we receive an event from the scrollbar, make the view // component focused so we actually get mousewheel events. if (source != NULL) { - Container* vc = parent_->GetContainer(); - if (vc && vc->GetHWND() != GetFocus()) { + Widget* widget = parent_->GetWidget(); + if (widget && widget->GetHWND() != GetFocus()) { parent_->RequestFocus(); } } @@ -227,8 +227,8 @@ NativeScrollBar::~NativeScrollBar() { void NativeScrollBar::ViewHierarchyChanged(bool is_add, View *parent, View *child) { - Container* vc; - if (is_add && (vc = GetContainer()) && !sb_view_) { + Widget* widget; + if (is_add && (widget = GetWidget()) && !sb_view_) { sb_view_ = new HWNDView(); AddChildView(sb_view_); sb_container_ = new ScrollBarContainer(this); diff --git a/chrome/views/root_view.cc b/chrome/views/root_view.cc index 4b4027d..ac59d3f 100644 --- a/chrome/views/root_view.cc +++ b/chrome/views/root_view.cc @@ -12,7 +12,7 @@ #include "chrome/common/drag_drop_types.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/views/root_view_drop_target.h" -#include "chrome/views/container.h" +#include "chrome/views/widget.h" namespace views { @@ -51,8 +51,8 @@ const char RootView::kViewClassName[] = "chrome/views/RootView"; // ///////////////////////////////////////////////////////////////////////////// -RootView::RootView(Container* container) - : container_(container), +RootView::RootView(Widget* widget) + : widget_(widget), mouse_pressed_handler_(NULL), mouse_move_handler_(NULL), explicit_mouse_handler_(FALSE), @@ -178,9 +178,9 @@ void RootView::PaintNow() { } if (!paint_task_needed_) return; - Container* vc = GetContainer(); - if (vc) - vc->PaintNow(invalid_rect_); + Widget* widget = GetWidget(); + if (widget) + widget->PaintNow(invalid_rect_); } bool RootView::NeedsPainting(bool urgent) { @@ -212,8 +212,8 @@ RECT RootView::GetScheduledPaintRectConstrainedToSize() { // ///////////////////////////////////////////////////////////////////////////// -Container* RootView::GetContainer() const { - return container_; +Widget* RootView::GetWidget() const { + return widget_; } ///////////////////////////////////////////////////////////////////////////// @@ -311,7 +311,7 @@ bool RootView::OnMousePressed(const MouseEvent& e) { mouse_pressed_handler_ = NULL; if (focus_on_mouse_pressed_) { - HWND hwnd = container_->GetHWND(); + HWND hwnd = GetWidget()->GetHWND(); if (::GetFocus() != hwnd) { ::SetFocus(hwnd); } @@ -327,7 +327,7 @@ bool RootView::ConvertPointToMouseHandler(const gfx::Point& l, // window. (a non explicit mouse handler is automatically // cleared when the control is removed from the hierarchy) if (explicit_mouse_handler_) { - if (mouse_pressed_handler_->GetContainer()) { + if (mouse_pressed_handler_->GetWidget()) { *p = l; ConvertPointToScreen(this, p); ConvertPointToView(NULL, mouse_pressed_handler_, p); @@ -459,17 +459,17 @@ void RootView::SetMouseHandler(View *new_mh) { mouse_pressed_handler_ = new_mh; } -void RootView::OnContainerCreated() { +void RootView::OnWidgetCreated() { DCHECK(!drop_target_.get()); drop_target_ = new RootViewDropTarget(this); } -void RootView::OnContainerDestroyed() { +void RootView::OnWidgetDestroyed() { if (drop_target_.get()) { - RevokeDragDrop(GetContainer()->GetHWND()); + RevokeDragDrop(GetWidget()->GetHWND()); drop_target_ = NULL; } - container_ = NULL; + widget_ = NULL; } void RootView::ProcessMouseDragCanceled() { @@ -489,7 +489,7 @@ void RootView::FocusView(View* view) { if (view != GetFocusedView()) { FocusManager* focus_manager = GetFocusManager(); DCHECK(focus_manager) << "No Focus Manager for Window " << - (GetContainer() ? GetContainer()->GetHWND() : 0); + (GetWidget() ? GetWidget()->GetHWND() : 0); if (!focus_manager) return; diff --git a/chrome/views/root_view.h b/chrome/views/root_view.h index d15d354..6c62ba8 100644 --- a/chrome/views/root_view.h +++ b/chrome/views/root_view.h @@ -11,9 +11,9 @@ namespace views { -class Container; class PaintTask; class RootViewDropTarget; +class Widget; //////////////////////////////////////////////////////////////////////////////// // @@ -30,13 +30,12 @@ class FocusListener { // // RootView class // -// The RootView is the root of a View hierarchy. Its parent is not -// necessarily a Container, but the Container's View child is always a -// RootView. +// The RootView is the root of a View hierarchy. A RootView is always the +// first and only child of a Widget. // -// The RootView manages the View hierarchy's interface with the -// Container, and also maintains the current invalid rect - the region -// that needs repainting. +// The RootView manages the View hierarchy's interface with the Widget +// and also maintains the current invalid rect - the region that needs +// repainting. // ///////////////////////////////////////////////////////////////////////////// class RootView : public View, @@ -44,7 +43,7 @@ class RootView : public View, public: static const char kViewClassName[]; - explicit RootView(Container* container); + explicit RootView(Widget* widget); virtual ~RootView(); @@ -71,8 +70,7 @@ class RootView : public View, // returns whether this root view needs to paint as soon as possible. virtual bool NeedsPainting(bool urgent); - // Invoked by the Container to discover what rectangle should be - // painted + // Invoked by the Widget to discover what rectangle should be painted. const gfx::Rect& GetScheduledPaintRect(); // Returns the region scheduled to paint clipped to the RootViews bounds. @@ -80,8 +78,8 @@ class RootView : public View, // Tree functions - // Get the Container that hosts this View. - virtual Container* GetContainer() const; + // Get the Widget that hosts this View. + virtual Widget* GetWidget() const; // The following event methods are overridden to propagate event to the // control tree @@ -91,24 +89,23 @@ class RootView : public View, virtual void OnMouseMoved(const MouseEvent& e); virtual void SetMouseHandler(View* new_mouse_handler); - // Invoked when the Containers has been fully initialized. - // At the time the constructor is invoked the Container may not be - // completely initialized, when this method is invoked, it is. - void OnContainerCreated(); + // Invoked when the Widget has been fully initialized. + // At the time the constructor is invoked the Widget may not be completely + // initialized, when this method is invoked, it is. + void OnWidgetCreated(); - // Invoked prior to the Container being destroyed. - void OnContainerDestroyed(); + // Invoked prior to the Widget being destroyed. + void OnWidgetDestroyed(); - // Invoked By the Container if the mouse drag is interrupted by + // Invoked By the Widget if the mouse drag is interrupted by // the system. Invokes OnMouseReleased with a value of true for canceled. void ProcessMouseDragCanceled(); - // Invoked by the Container instance when the mouse moves outside of - // the container bounds + // Invoked by the Widget instance when the mouse moves outside of the Widget + // bounds. virtual void ProcessOnMouseExited(); - // Make the provided view focused. Also make sure that our container - // is focused. + // Make the provided view focused. Also make sure that our Widget is focused. void FocusView(View* view); // Check whether the provided view is in the focus path. The focus path is the @@ -167,10 +164,10 @@ class RootView : public View, virtual std::string GetClassName() const; // Clears the region that is schedule to be painted. You nearly never need - // to invoke this. This is primarily intended for Containers. + // to invoke this. This is primarily intended for Widgets. void ClearPaintRect(); - // Invoked from the Container to service a WM_PAINT call. + // Invoked from the Widget to service a WM_PAINT call. void OnPaint(HWND hwnd); // Returns the MSAA role of the current view. The role is what assistive @@ -202,7 +199,7 @@ class RootView : public View, DISALLOW_EVIL_CONSTRUCTORS(RootView); // Convert a point to our current mouse handler. Returns false if the - // mouse handler is not connected to a Container. In that case, the + // mouse handler is not connected to a Widget. In that case, the // conversion cannot take place and *p is unchanged bool ConvertPointToMouseHandler(const gfx::Point& l, gfx::Point *p); @@ -267,8 +264,8 @@ class RootView : public View, // The view currently handling enter / exit View* mouse_move_handler_; - // The host Container - Container* container_; + // The host Widget + Widget* widget_; // The rectangle that should be painted gfx::Rect invalid_rect_; diff --git a/chrome/views/root_view_drop_target.cc b/chrome/views/root_view_drop_target.cc index c5beedc..8920234 100644 --- a/chrome/views/root_view_drop_target.cc +++ b/chrome/views/root_view_drop_target.cc @@ -7,13 +7,13 @@ #include "base/gfx/point.h" #include "base/logging.h" #include "chrome/common/drag_drop_types.h" -#include "chrome/views/container.h" #include "chrome/views/root_view.h" +#include "chrome/views/widget.h" namespace views { RootViewDropTarget::RootViewDropTarget(RootView* root_view) - : BaseDropTarget(root_view->GetContainer()->GetHWND()), + : BaseDropTarget(root_view->GetWidget()->GetHWND()), root_view_(root_view), target_view_(NULL), deepest_view_(NULL) { diff --git a/chrome/views/tabbed_pane.cc b/chrome/views/tabbed_pane.cc index 9fe72a7..2638972 100644 --- a/chrome/views/tabbed_pane.cc +++ b/chrome/views/tabbed_pane.cc @@ -16,8 +16,8 @@ #include "chrome/common/stl_util-inl.h" #include "chrome/common/throb_animation.h" #include "chrome/views/background.h" -#include "chrome/views/container_win.h" #include "chrome/views/root_view.h" +#include "chrome/views/widget_win.h" #include "skia/include/SkColor.h" namespace views { @@ -167,7 +167,7 @@ HWND TabbedPane::CreateNativeControl(HWND parent_container) { SendMessage(tab_control_, WM_SETFONT, reinterpret_cast<WPARAM>(font), FALSE); // Create the view container which is a child of the TabControl. - content_window_ = new ContainerWin(); + content_window_ = new WidgetWin(); content_window_->Init(tab_control_, gfx::Rect(), false); // Explicitly setting the WS_EX_LAYOUTRTL property for the HWND (see above diff --git a/chrome/views/tabbed_pane.h b/chrome/views/tabbed_pane.h index fc30765..5e0dd5e 100644 --- a/chrome/views/tabbed_pane.h +++ b/chrome/views/tabbed_pane.h @@ -12,7 +12,7 @@ namespace views { // The TabbedPane class is a view that shows tabs. When the user clicks on a // tab, the associated view is displayed. // TODO (jcampan): implement GetPreferredSize(). -class ContainerWin; +class WidgetWin; class TabbedPane : public NativeControl { public: @@ -75,7 +75,7 @@ class TabbedPane : public NativeControl { std::vector<View*> tab_views_; // The window displayed in the tab. - ContainerWin* content_window_; + WidgetWin* content_window_; // The listener we notify about tab selection changes. Listener* listener_; diff --git a/chrome/views/table_view.cc b/chrome/views/table_view.cc index b67ca49..61d70388 100644 --- a/chrome/views/table_view.cc +++ b/chrome/views/table_view.cc @@ -15,7 +15,6 @@ #include "chrome/common/gfx/icon_util.h" #include "chrome/common/resource_bundle.h" #include "chrome/common/win_util.h" -#include "chrome/views/container.h" #include "chrome/views/hwnd_view.h" #include "SkBitmap.h" #include "SkColorFilter.h" @@ -438,7 +437,7 @@ void TableView::SetColumnVisibility(int id, bool is_visible) { int index = static_cast<int>(i - visible_columns_.begin()); // This could be called before the native list view has been created // (in CreateNativeControl, called when the view is added to a - // container). In that case since the column is not in + // Widget). In that case since the column is not in // visible_columns_ it will not be added later on when it is created. if (list_view_) SendMessage(list_view_, LVM_DELETECOLUMN, index, 0); diff --git a/chrome/views/text_button.cc b/chrome/views/text_button.cc index a64c2fd..30019c4 100644 --- a/chrome/views/text_button.cc +++ b/chrome/views/text_button.cc @@ -10,7 +10,6 @@ #include "chrome/common/throb_animation.h" #include "chrome/common/win_util.h" #include "chrome/views/button.h" -#include "chrome/views/container.h" #include "chrome/views/event.h" #include "chrome/views/view_menu_delegate.h" diff --git a/chrome/views/text_field.cc b/chrome/views/text_field.cc index 3c64c3d..072ff76 100644 --- a/chrome/views/text_field.cc +++ b/chrome/views/text_field.cc @@ -22,9 +22,9 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/logging_chrome.h" #include "chrome/common/win_util.h" -#include "chrome/views/container.h" #include "chrome/views/hwnd_view.h" #include "chrome/views/menu.h" +#include "chrome/views/widget.h" #include "generated_resources.h" @@ -267,7 +267,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_->GetContainer()->GetHWND(), r, NULL, style, ex_style); + Create(parent_->GetWidget()->GetHWND(), r, NULL, style, ex_style); // Set up the text_object_model_. CComPtr<IRichEditOle> ole_interface; @@ -884,9 +884,9 @@ TextField::~TextField() { } void TextField::ViewHierarchyChanged(bool is_add, View* parent, View* child) { - Container* vc; + Widget* widget; - if (is_add && (vc = GetContainer())) { + if (is_add && (widget = GetWidget())) { // This notification is called from the AddChildView call below. Ignore it. if (native_view_ && !edit_) return; diff --git a/chrome/views/tooltip_manager.cc b/chrome/views/tooltip_manager.cc index ae842bf..2e5c00b 100644 --- a/chrome/views/tooltip_manager.cc +++ b/chrome/views/tooltip_manager.cc @@ -13,7 +13,7 @@ #include "chrome/views/root_view.h" #include "chrome/views/tooltip_manager.h" #include "chrome/views/view.h" -#include "chrome/views/container.h" +#include "chrome/views/widget.h" namespace views { @@ -76,8 +76,8 @@ const std::wstring& TooltipManager::GetLineSeparator() { return *separator; } -TooltipManager::TooltipManager(Container* container, HWND parent) - : container_(container), +TooltipManager::TooltipManager(Widget* widget, HWND parent) + : widget_(widget), parent_(parent), last_mouse_x_(-1), last_mouse_y_(-1), @@ -88,7 +88,7 @@ TooltipManager::TooltipManager(Container* container, HWND parent) keyboard_tooltip_hwnd_(NULL), #pragma warning(suppress: 4355) keyboard_tooltip_factory_(this) { - DCHECK(container && parent); + DCHECK(widget && parent); Init(); } @@ -147,7 +147,7 @@ LRESULT TooltipManager::OnNotify(int w_param, NMHDR* l_param, bool* handled) { case TTN_GETDISPINFO: { if (last_view_out_of_sync_) { // View under the mouse is out of sync, determine it now. - RootView* root_view = container_->GetRootView(); + RootView* root_view = widget_->GetRootView(); last_tooltip_view_ = root_view->GetViewForPoint( gfx::Point(last_mouse_x_, last_mouse_y_)); last_view_out_of_sync_ = false; @@ -165,7 +165,7 @@ LRESULT TooltipManager::OnNotify(int w_param, NMHDR* l_param, bool* handled) { tooltip_text_.clear(); // Mouse is over a View, ask the View for it's tooltip. gfx::Point view_loc(last_mouse_x_, last_mouse_y_); - View::ConvertPointToView(container_->GetRootView(), + View::ConvertPointToView(widget_->GetRootView(), last_tooltip_view_, &view_loc); if (last_tooltip_view_->GetTooltipText(view_loc.x(), view_loc.y(), &tooltip_text_) && @@ -194,7 +194,7 @@ LRESULT TooltipManager::OnNotify(int w_param, NMHDR* l_param, bool* handled) { if (tooltip_height_ == 0) tooltip_height_ = CalcTooltipHeight(); gfx::Point view_loc(last_mouse_x_, last_mouse_y_); - View::ConvertPointToView(container_->GetRootView(), + View::ConvertPointToView(widget_->GetRootView(), last_tooltip_view_, &view_loc); if (last_tooltip_view_->GetTooltipTextOrigin( view_loc.x(), view_loc.y(), &text_origin) && @@ -284,7 +284,7 @@ void TooltipManager::TrimTooltipToFit(std::wstring* text, // Determine the available width for the tooltip. gfx::Point screen_loc(position_x, position_y); - View::ConvertPointToScreen(container_->GetRootView(), &screen_loc); + View::ConvertPointToScreen(widget_->GetRootView(), &screen_loc); gfx::Rect monitor_bounds = win_util::GetMonitorBoundsForRect(gfx::Rect(screen_loc.x(), screen_loc.y(), 0, 0)); @@ -319,7 +319,7 @@ void TooltipManager::TrimTooltipToFit(std::wstring* text, } void TooltipManager::UpdateTooltip(int x, int y) { - RootView* root_view = container_->GetRootView(); + RootView* root_view = widget_->GetRootView(); View* view = root_view->GetViewForPoint(gfx::Point(x, y)); if (view != last_tooltip_view_) { // NOTE: This *must* be sent regardless of the visibility of the tooltip. @@ -352,7 +352,7 @@ void TooltipManager::OnMouse(UINT u_msg, WPARAM w_param, LPARAM l_param) { if (u_msg >= WM_NCMOUSEMOVE && u_msg <= WM_NCXBUTTONDBLCLK) { // NC message coordinates are in screen coordinates. CRect frame_bounds; - container_->GetBounds(&frame_bounds, true); + widget_->GetBounds(&frame_bounds, true); x -= frame_bounds.left; y -= frame_bounds.top; } @@ -385,8 +385,7 @@ void TooltipManager::ShowKeyboardTooltip(View* focused_view) { gfx::Point screen_point; focused_view->ConvertPointToScreen(focused_view, &screen_point); gfx::Point relative_point_coordinates; - focused_view->ConvertPointToContainer(focused_view, - &relative_point_coordinates); + focused_view->ConvertPointToWidget(focused_view, &relative_point_coordinates); keyboard_tooltip_hwnd_ = CreateWindowEx( WS_EX_TRANSPARENT | l10n_util::GetExtendedTooltipStyles(), TOOLTIPS_CLASS, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL); diff --git a/chrome/views/tooltip_manager.h b/chrome/views/tooltip_manager.h index f1aab66a..2800fb0 100644 --- a/chrome/views/tooltip_manager.h +++ b/chrome/views/tooltip_manager.h @@ -13,11 +13,11 @@ class ChromeFont; namespace views { -class Container; class View; +class Widget; // TooltipManager takes care of the wiring to support tooltips for Views. -// This class is intended to be used by Containers. To use this, you must +// This class is intended to be used by Widgets. To use this, you must // do the following: // Add the following to your MSG_MAP: // @@ -57,8 +57,8 @@ class TooltipManager { // Returns the separator for lines of text in a tooltip. static const std::wstring& GetLineSeparator(); - // Creates a TooltipManager for the specified Container and parent window. - TooltipManager(Container* container, HWND parent); + // Creates a TooltipManager for the specified Widget and parent window. + TooltipManager(Widget* widget, HWND parent); virtual ~TooltipManager(); // Notification that the view hierarchy has changed in some way. @@ -123,8 +123,8 @@ class TooltipManager { // Invoked when the timer elapses and tooltip has to be destroyed. void DestroyKeyboardTooltipWindow(HWND window_to_destroy); - // Hosting view container. - Container* container_; + // Hosting Widget. + Widget* widget_; // The View the mouse is under. This is null if the mouse isn't under a // View. diff --git a/chrome/views/tree_view.cc b/chrome/views/tree_view.cc index 0410ecc..ffb3e4c 100644 --- a/chrome/views/tree_view.cc +++ b/chrome/views/tree_view.cc @@ -13,8 +13,8 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/resource_bundle.h" #include "chrome/common/stl_util-inl.h" -#include "chrome/views/container.h" #include "chrome/views/focus_manager.h" +#include "chrome/views/widget.h" namespace views { @@ -436,9 +436,9 @@ bool TreeView::OnKeyDown(int virtual_key_code) { } return true; } else if (virtual_key_code == VK_RETURN && !process_enter_) { - Container* vc = GetContainer(); - DCHECK(vc); - FocusManager* fm = FocusManager::GetFocusManager(vc->GetHWND()); + Widget* widget = GetWidget(); + DCHECK(widget); + FocusManager* fm = FocusManager::GetFocusManager(widget->GetHWND()); DCHECK(fm); Accelerator accelerator(Accelerator(static_cast<int>(virtual_key_code), win_util::IsShiftPressed(), diff --git a/chrome/views/view.cc b/chrome/views/view.cc index 4525724..823cb3e 100644 --- a/chrome/views/view.cc +++ b/chrome/views/view.cc @@ -22,10 +22,10 @@ #include "chrome/views/accessibility/accessible_wrapper.h" #include "chrome/views/background.h" #include "chrome/views/border.h" -#include "chrome/views/container.h" #include "chrome/views/layout_manager.h" #include "chrome/views/root_view.h" #include "chrome/views/tooltip_manager.h" +#include "chrome/views/widget.h" #include "SkShader.h" namespace views { @@ -282,11 +282,11 @@ void View::SetFocusable(bool focusable) { } FocusManager* View::GetFocusManager() { - Container* container = GetContainer(); - if (!container) + Widget* widget = GetWidget(); + if (!widget) return NULL; - HWND hwnd = container->GetHWND(); + HWND hwnd = widget->GetHWND(); if (!hwnd) return NULL; @@ -748,19 +748,15 @@ View* View::GetViewForPoint(const gfx::Point& point, return this; } -Container* View::GetContainer() const { - // The root view holds a reference to this view hierarchy's container. - return parent_ ? parent_->GetContainer() : NULL; +Widget* View::GetWidget() const { + // The root view holds a reference to this view hierarchy's Widget. + return parent_ ? parent_->GetWidget() : NULL; } // Get the containing RootView RootView* View::GetRootView() { - Container* vc = GetContainer(); - if (vc) { - return vc->GetRootView(); - } else { - return NULL; - } + Widget* widget = GetWidget(); + return widget ? widget->GetRootView() : NULL; } View* View::GetViewByID(int id) const { @@ -1291,10 +1287,10 @@ void View::ConvertPointToView(View* src, View* dst, gfx::Point* point, // If src is NULL, sp is in the screen coordinate system if (src == NULL) { - Container* vc = dst->GetContainer(); - if (vc) { + Widget* widget = dst->GetWidget(); + if (widget) { CRect b; - vc->GetBounds(&b, false); + widget->GetBounds(&b, false); point->SetPoint(point->x() - b.left, point->y() - b.top); } } @@ -1302,7 +1298,7 @@ void View::ConvertPointToView(View* src, View* dst, gfx::Point* point, } // static -void View::ConvertPointToContainer(View* src, gfx::Point* p) { +void View::ConvertPointToWidget(View* src, gfx::Point* p) { DCHECK(src); DCHECK(p); @@ -1316,9 +1312,9 @@ void View::ConvertPointToContainer(View* src, gfx::Point* p) { } // static -void View::ConvertPointFromContainer(View *source, gfx::Point* p) { +void View::ConvertPointFromWidget(View *source, gfx::Point* p) { gfx::Point t; - ConvertPointToContainer(source, &t); + ConvertPointToWidget(source, &t); p->SetPoint(p->x() - t.x(), p->y() - t.y()); } @@ -1328,11 +1324,11 @@ void View::ConvertPointToScreen(View* src, gfx::Point* p) { DCHECK(p); // If the view is not connected to a tree, there's nothing we can do. - Container* vc = src->GetContainer(); - if (vc) { - ConvertPointToContainer(src, p); + Widget* widget = src->GetWidget(); + if (widget) { + ConvertPointToWidget(src, p); CRect r; - vc->GetBounds(&r, false); + widget->GetBounds(&r, false); p->SetPoint(p->x() + r.left, p->y() + r.top); } } @@ -1503,7 +1499,7 @@ void View::Focus() { // messages. FocusManager* focus_manager = GetFocusManager(); if (focus_manager) - focus_manager->FocusHWND(GetRootView()->GetContainer()->GetHWND()); + focus_manager->FocusHWND(GetRootView()->GetWidget()->GetHWND()); } bool View::CanProcessTabKeyEvents() { @@ -1520,15 +1516,15 @@ bool View::GetTooltipTextOrigin(int x, int y, gfx::Point* loc) { } void View::TooltipTextChanged() { - Container* view_container = GetContainer(); - if (view_container != NULL && view_container->GetTooltipManager()) - view_container->GetTooltipManager()->TooltipTextChanged(this); + Widget* widget = GetWidget(); + if (widget && widget->GetTooltipManager()) + widget->GetTooltipManager()->TooltipTextChanged(this); } void View::UpdateTooltip() { - Container* view_container = GetContainer(); - if (view_container != NULL && view_container->GetTooltipManager()) - view_container->GetTooltipManager()->UpdateTooltip(); + Widget* widget = GetWidget(); + if (widget && widget->GetTooltipManager()) + widget->GetTooltipManager()->UpdateTooltip(); } void View::SetParentOwned(bool f) { @@ -1549,7 +1545,6 @@ gfx::Rect View::GetVisibleBounds() { View* view = this; int root_x = 0; int root_y = 0; - bool has_view_container = false; while (view != NULL && !vis_bounds.IsEmpty()) { root_x += view->GetX(APPLY_MIRRORING_TRANSFORMATION); root_y += view->y(); @@ -1559,9 +1554,8 @@ gfx::Rect View::GetVisibleBounds() { ancestor_bounds.SetRect(0, 0, ancestor->width(), ancestor->height()); vis_bounds = vis_bounds.Intersect(ancestor_bounds); - } else if (!view->GetContainer()) { - // If the view has no Container, we're not visible. Return an empty - // rect. + } else if (!view->GetWidget()) { + // If the view has no Widget, we're not visible. Return an empty rect. return gfx::Rect(); } view = ancestor; diff --git a/chrome/views/view.h b/chrome/views/view.h index d6b16ce..383473f 100644 --- a/chrome/views/view.h +++ b/chrome/views/view.h @@ -32,13 +32,13 @@ namespace views { class Background; class Border; -class Container; class FocusManager; class FocusTraversable; class LayoutManager; class RestoreFocusTask; class RootView; class ScrollView; +class Widget; // ContextMenuController is responsible for showing the context menu for a // View. To use a ContextMenuController invoke SetContextMenuController on a @@ -424,8 +424,8 @@ class View : public AcceleratorTarget { // Get the child View at the specified point. virtual View* GetViewForPoint(const gfx::Point& point); - // Get the Container that hosts this View, if any. - virtual Container* GetContainer() const; + // Get the Widget that hosts this View, if any. + virtual Widget* GetWidget() const; // Get the containing RootView virtual RootView* GetRootView(); @@ -496,8 +496,8 @@ class View : public AcceleratorTarget { virtual void SetFocusable(bool focusable); // Convenience method to retrieve the FocusManager associated with the - // container window that contains this view. This can return NULL if this - // view is not part of a view hierarchy with a Container. + // Widget that contains this view. This can return NULL if this view is not + // part of a view hierarchy with a Widget. virtual FocusManager* GetFocusManager(); // Sets a keyboard accelerator for that view. When the user presses the @@ -672,13 +672,13 @@ class View : public AcceleratorTarget { gfx::Point* point); // Convert a point from the coordinate system of a View to that of the - // Container. This is useful for example when sizing HWND children of the - // Container that don't know about the View hierarchy and need to be placed - // relative to the Container that is their parent. - static void ConvertPointToContainer(View* src, gfx::Point* point); + // Widget. This is useful for example when sizing HWND children of the + // Widget that don't know about the View hierarchy and need to be placed + // relative to the Widget that is their parent. + static void ConvertPointToWidget(View* src, gfx::Point* point); - // Convert a point from a view Container to a View dest - static void ConvertPointFromContainer(View *dest, gfx::Point* p); + // Convert a point from a view Widget to a View dest + static void ConvertPointFromWidget(View *dest, gfx::Point* p); // Convert a point from the coordinate system of a View to that of the // screen. This is useful for example when placing popup windows. @@ -1050,8 +1050,8 @@ class View : public AcceleratorTarget { // set and gives an opportunity to subclasses to perform any extra focus steps // (for example native component set the native focus on their native // component). The default behavior is to set the native focus on the root - // view container, which is what is appropriate for views that have no native - // window associated with them (so the root view gets the keyboard messages). + // Widget, which is what is appropriate for views that have no native window + // associated with them (so the root view gets the keyboard messages). virtual void Focus(); // Invoked when a key is pressed before the key event is processed by the @@ -1171,7 +1171,7 @@ class View : public AcceleratorTarget { gfx::Point* point, bool try_other_direction); - // Propagates UpdateTooltip() to the TooltipManager for the Container. + // Propagates UpdateTooltip() to the TooltipManager for the Widget. // This must be invoked any time the View hierarchy changes in such a way // the view under the mouse differs. For example, if the bounds of a View is // changed, this is invoked. Similarly, as Views are added/removed, this diff --git a/chrome/views/view_unittest.cc b/chrome/views/view_unittest.cc index e7196a0..48499a3 100644 --- a/chrome/views/view_unittest.cc +++ b/chrome/views/view_unittest.cc @@ -285,7 +285,7 @@ TEST_F(ViewTest, MouseEvent) { TestView* v2 = new TestView(); v2->SetBounds (100, 100, 100, 100); - views::ContainerWin window; + views::WidgetWin window; window.set_delete_on_destroy(false); window.set_window_style(WS_OVERLAPPEDWINDOW); window.Init(NULL, gfx::Rect(50, 50, 650, 650), false); @@ -359,7 +359,7 @@ TEST_F(ViewTest, Painting) { RDW_UPDATENOW | RDW_INVALIDATE | RDW_ALLCHILDREN); bool empty_paint = paint_window.empty_paint(); - views::ContainerWin window; + views::WidgetWin window; window.set_delete_on_destroy(false); window.set_window_style(WS_OVERLAPPEDWINDOW); window.Init(NULL, gfx::Rect(50, 50, 650, 650), NULL); @@ -446,7 +446,7 @@ TEST_F(ViewTest, RemoveNotification) { NotificationService::current()->AddObserver( observer.get(), NOTIFY_VIEW_REMOVED, NotificationService::AllSources()); - views::ContainerWin* window = new views::ContainerWin; + views::WidgetWin* window = new views::WidgetWin; views::RootView* root_view = window->GetRootView(); View* v1 = new View; @@ -550,7 +550,7 @@ gfx::Point ConvertPointToView(views::View* view, const gfx::Point& p) { } TEST_F(ViewTest, HitTestMasks) { - views::ContainerWin window; + views::WidgetWin window; views::RootView* root_view = window.GetRootView(); root_view->SetBounds(0, 0, 500, 500); diff --git a/chrome/views/views.vcproj b/chrome/views/views.vcproj index 505186f..104f77b 100644 --- a/chrome/views/views.vcproj +++ b/chrome/views/views.vcproj @@ -258,18 +258,6 @@ > </File> <File - RelativePath=".\container.h" - > - </File> - <File - RelativePath=".\container_win.cc" - > - </File> - <File - RelativePath=".\container_win.h" - > - </File> - <File RelativePath=".\controller.h" > </File> @@ -589,10 +577,10 @@ RelativePath=".\tooltip_manager.h" > </File> - <File - RelativePath=".\tree_model.h" - > - </File> + <File + RelativePath=".\tree_model.h" + > + </File> <File RelativePath=".\tree_node_model.h" > @@ -634,6 +622,18 @@ > </File> <File + RelativePath=".\widget.h" + > + </File> + <File + RelativePath=".\widget_win.cc" + > + </File> + <File + RelativePath=".\widget_win.h" + > + </File> + <File RelativePath=".\window.cc" > </File> diff --git a/chrome/views/widget.h b/chrome/views/widget.h new file mode 100644 index 0000000..221919d --- /dev/null +++ b/chrome/views/widget.h @@ -0,0 +1,87 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_VIEWS_WIDGET_H_ +#define CHROME_VIEWS_WIDGET_H_ + +// TODO(maruel): Remove once HWND is abstracted. +#include <windows.h> + +namespace gfx { +class Rect; +} + +// TODO(maruel): Remove once gfx::Rect is used instead. +namespace WTL { +class CRect; +} +using WTL::CRect; + +namespace views { + +class RootView; +class TooltipManager; +class Accelerator; + +//////////////////////////////////////////////////////////////////////////////// +// +// Widget interface +// +// Widget is an abstract class that defines the API that should be implemented +// by a native window in order to host a view hierarchy. +// +// Widget wraps a hierarchy of View objects (see view.h) that implement +// painting and flexible layout within the bounds of the Widget's window. +// +// The Widget is responsible for handling various system events and forwarding +// them to the appropriate view. +// +///////////////////////////////////////////////////////////////////////////// + +class Widget { + public: + virtual ~Widget() { } + + // Returns the bounds of this Widget in the screen coordinate system. + // If the receiving Widget is a frame which is larger than its client area, + // this method returns the client area if including_frame is false and the + // frame bounds otherwise. If the receiving Widget is not a frame, + // including_frame is ignored. + virtual void GetBounds(CRect *out, bool including_frame) const = 0; + + // Moves this Widget to the front of the Z-Order If should_activate is TRUE, + // the window should also become the active window. + virtual void MoveToFront(bool should_activate) = 0; + + // Returns the Window HWND associated with this Widget. + virtual HWND GetHWND() const = 0; + + // Forces a paint of a specified rectangle immediately. + virtual void PaintNow(const gfx::Rect& update_rect) = 0; + + // Returns the RootView contained by this Widget. + virtual RootView* GetRootView() = 0; + + // Returns whether the Widget is visible to the user. + virtual bool IsVisible() = 0; + + // Returns whether the Widget is the currently active window. + virtual bool IsActive() = 0; + + // Returns the TooltipManager for this Widget. If this Widget does not support + // tooltips, NULL is returned. + virtual TooltipManager* GetTooltipManager() { + return NULL; + } + + // Returns the accelerator given a command id. Returns false if there is + // no accelerator associated with a given id, which is a common condition. + virtual bool GetAccelerator(int cmd_id, + Accelerator* accelerator) = 0; +}; + +} // namespace views + +#endif // CHROME_VIEWS_WIDGET_H_ + diff --git a/chrome/views/container_win.cc b/chrome/views/widget_win.cc index dc011742..cd0e913 100644 --- a/chrome/views/container_win.cc +++ b/chrome/views/widget_win.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/views/container_win.h" +#include "chrome/views/widget_win.h" #include "base/gfx/native_theme.h" #include "base/string_util.h" @@ -33,12 +33,12 @@ RootView* GetRootViewForHWND(HWND hwnd) { return reinterpret_cast<RootView*>(::GetProp(hwnd, kRootViewWindowProperty)); } -// Used to locate the ContainerWin issuing the current Create. Only valid for -// the life of Create. +// Used to locate the WidgetWin issuing the current Create. Only valid for the +// life of Create. // -// This obviously assumes we only create ContainerWins from the same thread, +// This obviously assumes we only create WidgetWins from the same thread, // which is currently the case. -static ContainerWin* instance_issuing_create = NULL; +static WidgetWin* instance_issuing_create = NULL; /////////////////////////////////////////////////////////////////////////////// // FillLayout @@ -66,8 +66,8 @@ gfx::Size FillLayout::GetPreferredSize(View* host) { // Window class tracking. // static -const wchar_t* const ContainerWin::kBaseClassName = - L"Chrome_ContainerWin_"; +const wchar_t* const WidgetWin::kBaseClassName = + L"Chrome_WidgetWin_"; // Window class information used for registering unique windows. struct ClassInfo { @@ -111,9 +111,9 @@ static RegisteredClasses* registered_classes = NULL; /////////////////////////////////////////////////////////////////////////////// -// ContainerWin, public +// WidgetWin, public -ContainerWin::ContainerWin() +WidgetWin::WidgetWin() : active_mouse_tracking_flags_(0), has_capture_(false), current_action_(FA_NONE), @@ -128,15 +128,15 @@ ContainerWin::ContainerWin() is_mouse_down_(false), class_style_(CS_DBLCLKS), hwnd_(NULL), - close_container_factory_(this) { + close_widget_factory_(this) { } -ContainerWin::~ContainerWin() { +WidgetWin::~WidgetWin() { MessageLoopForUI::current()->RemoveObserver(this); } -void ContainerWin::Init(HWND parent, const gfx::Rect& bounds, - bool has_own_focus_manager) { +void WidgetWin::Init(HWND parent, const gfx::Rect& bounds, + bool has_own_focus_manager) { toplevel_ = parent == NULL; if (window_style_ == 0) @@ -163,7 +163,7 @@ void ContainerWin::Init(HWND parent, const gfx::Rect& bounds, // The window procedure should have set the data for us. DCHECK(win_util::GetWindowUserData(hwnd_) == this); - root_view_->OnContainerCreated(); + root_view_->OnWidgetCreated(); if (has_own_focus_manager) { FocusManager::CreateFocusManager(hwnd_, GetRootView()); @@ -199,10 +199,10 @@ void ContainerWin::Init(HWND parent, const gfx::Rect& bounds, ::ImmAssociateContextEx(GetHWND(), NULL, 0); } -void ContainerWin::SetContentsView(View* view) { +void WidgetWin::SetContentsView(View* view) { DCHECK(view && hwnd_) << "Can't be called until after the HWND is created!"; // The ContentsView must be set up _after_ the window is created so that its - // Container pointer is valid. + // Widget pointer is valid. root_view_->SetLayoutManager(new FillLayout); if (root_view_->GetChildViewCount() != 0) root_view_->RemoveAllChildViews(true); @@ -215,9 +215,9 @@ void ContainerWin::SetContentsView(View* view) { } /////////////////////////////////////////////////////////////////////////////// -// Container implementation: +// Widget implementation: -void ContainerWin::GetBounds(CRect *out, bool including_frame) const { +void WidgetWin::GetBounds(CRect *out, bool including_frame) const { if (including_frame) { GetWindowRect(out); } else { @@ -233,7 +233,7 @@ void ContainerWin::GetBounds(CRect *out, bool including_frame) const { } } -void ContainerWin::MoveToFront(bool should_activate) { +void WidgetWin::MoveToFront(bool should_activate) { int flags = SWP_NOMOVE | SWP_NOSIZE; if (!should_activate) { flags |= SWP_NOACTIVATE; @@ -241,11 +241,11 @@ void ContainerWin::MoveToFront(bool should_activate) { SetWindowPos(HWND_NOTOPMOST, 0, 0, 0, 0, flags); } -HWND ContainerWin::GetHWND() const { +HWND WidgetWin::GetHWND() const { return hwnd_; } -void ContainerWin::PaintNow(const gfx::Rect& update_rect) { +void WidgetWin::PaintNow(const gfx::Rect& update_rect) { if (layered_) { PaintLayeredWindow(); } else if (root_view_->NeedsPainting(false) && IsWindow()) { @@ -274,7 +274,7 @@ void ContainerWin::PaintNow(const gfx::Rect& update_rect) { } } -RootView* ContainerWin::GetRootView() { +RootView* WidgetWin::GetRootView() { if (!root_view_.get()) { // First time the root view is being asked for, create it now. root_view_.reset(CreateRootView()); @@ -282,20 +282,20 @@ RootView* ContainerWin::GetRootView() { return root_view_.get(); } -bool ContainerWin::IsVisible() { +bool WidgetWin::IsVisible() { return !!::IsWindowVisible(GetHWND()); } -bool ContainerWin::IsActive() { +bool WidgetWin::IsActive() { return win_util::IsWindowActive(GetHWND()); } -TooltipManager* ContainerWin::GetTooltipManager() { +TooltipManager* WidgetWin::GetTooltipManager() { return tooltip_manager_.get(); } -void ContainerWin::SetLayeredAlpha(BYTE layered_alpha) { +void WidgetWin::SetLayeredAlpha(BYTE layered_alpha) { layered_alpha_ = layered_alpha; // if (hwnd_) @@ -313,7 +313,7 @@ static BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM l_param) { } // static -RootView* ContainerWin::FindRootView(HWND hwnd) { +RootView* WidgetWin::FindRootView(HWND hwnd) { RootView* root_view = reinterpret_cast<RootView*>(GetProp(hwnd, kRootViewWindowProperty)); if (root_view) @@ -325,21 +325,21 @@ RootView* ContainerWin::FindRootView(HWND hwnd) { return root_view; } -void ContainerWin::Close() { +void WidgetWin::Close() { // Let's hide ourselves right away. Hide(); - if (close_container_factory_.empty()) { + if (close_widget_factory_.empty()) { // And we delay the close so that if we are called from an ATL callback, // we don't destroy the window before the callback returned (as the caller // may delete ourselves on destroy and the ATL callback would still // dereference us when the callback returns). MessageLoop::current()->PostTask(FROM_HERE, - close_container_factory_.NewRunnableMethod( - &ContainerWin::CloseNow)); + close_widget_factory_.NewRunnableMethod( + &WidgetWin::CloseNow)); } } -void ContainerWin::Hide() { +void WidgetWin::Hide() { // NOTE: Be careful not to activate any windows here (for example, calling // ShowWindow(SW_HIDE) will automatically activate another window). This // code can be called while a window is being deactivated, and activating @@ -349,7 +349,7 @@ void ContainerWin::Hide() { SWP_NOREPOSITION | SWP_NOSIZE | SWP_NOZORDER); } -void ContainerWin::CloseNow() { +void WidgetWin::CloseNow() { // We may already have been destroyed if the selection resulted in a tab // switch which will have reactivated the browser window and closed us, so // we need to check to see if we're still a window before trying to destroy @@ -361,10 +361,10 @@ void ContainerWin::CloseNow() { /////////////////////////////////////////////////////////////////////////////// // MessageLoop::Observer -void ContainerWin::WillProcessMessage(const MSG& msg) { +void WidgetWin::WillProcessMessage(const MSG& msg) { } -void ContainerWin::DidProcessMessage(const MSG& msg) { +void WidgetWin::DidProcessMessage(const MSG& msg) { if (root_view_->NeedsPainting(true)) { PaintNow(root_view_->GetScheduledPaintRect()); } @@ -373,7 +373,7 @@ void ContainerWin::DidProcessMessage(const MSG& msg) { /////////////////////////////////////////////////////////////////////////////// // FocusTraversable -View* ContainerWin::FindNextFocusableView( +View* WidgetWin::FindNextFocusableView( View* starting_view, bool reverse, Direction direction, bool dont_loop, FocusTraversable** focus_traversable, View** focus_traversable_view) { return root_view_->FindNextFocusableView(starting_view, @@ -384,32 +384,32 @@ View* ContainerWin::FindNextFocusableView( focus_traversable_view); } -FocusTraversable* ContainerWin::GetFocusTraversableParent() { +FocusTraversable* WidgetWin::GetFocusTraversableParent() { // We are a proxy to the root view, so we should be bypassed when traversing // up and as a result this should not be called. NOTREACHED(); return NULL; } -void ContainerWin::SetFocusTraversableParent(FocusTraversable* parent) { +void WidgetWin::SetFocusTraversableParent(FocusTraversable* parent) { root_view_->SetFocusTraversableParent(parent); } -View* ContainerWin::GetFocusTraversableParentView() { +View* WidgetWin::GetFocusTraversableParentView() { // We are a proxy to the root view, so we should be bypassed when traversing // up and as a result this should not be called. NOTREACHED(); return NULL; } -void ContainerWin::SetFocusTraversableParentView(View* parent_view) { +void WidgetWin::SetFocusTraversableParentView(View* parent_view) { root_view_->SetFocusTraversableParentView(parent_view); } /////////////////////////////////////////////////////////////////////////////// // Message handlers -void ContainerWin::OnCaptureChanged(HWND hwnd) { +void WidgetWin::OnCaptureChanged(HWND hwnd) { if (has_capture_) { if (is_mouse_down_) root_view_->ProcessMouseDragCanceled(); @@ -418,11 +418,9 @@ void ContainerWin::OnCaptureChanged(HWND hwnd) { } } -void ContainerWin::OnClose() { - // WARNING: this method is NOT called for all ContainerWins. If you need to - // do cleanup code before ContainerWin is destroyed, put it in - // OnDestroy. - +void WidgetWin::OnClose() { + // WARNING: this method is NOT called for all WidgetWins. If you need to do + // cleanup code before WidgetWin is destroyed, put it in OnDestroy. NotificationService::current()->Notify( NOTIFY_WINDOW_CLOSED, Source<HWND>(hwnd_), NotificationService::NoDetails()); @@ -430,18 +428,18 @@ void ContainerWin::OnClose() { Close(); } -void ContainerWin::OnDestroy() { - root_view_->OnContainerDestroyed(); +void WidgetWin::OnDestroy() { + root_view_->OnWidgetDestroyed(); RemoveProp(hwnd_, kRootViewWindowProperty); } -LRESULT ContainerWin::OnEraseBkgnd(HDC dc) { +LRESULT WidgetWin::OnEraseBkgnd(HDC dc) { // This is needed for magical win32 flicker ju-ju return 1; } -LRESULT ContainerWin::OnGetObject(UINT uMsg, WPARAM w_param, LPARAM l_param) { +LRESULT WidgetWin::OnGetObject(UINT uMsg, WPARAM w_param, LPARAM l_param) { LRESULT reference_result = static_cast<LRESULT>(0L); // Accessibility readers will send an OBJID_CLIENT message @@ -487,58 +485,58 @@ LRESULT ContainerWin::OnGetObject(UINT uMsg, WPARAM w_param, LPARAM l_param) { return reference_result; } -void ContainerWin::OnKeyDown(TCHAR c, UINT rep_cnt, UINT flags) { +void WidgetWin::OnKeyDown(TCHAR c, UINT rep_cnt, UINT flags) { KeyEvent event(Event::ET_KEY_PRESSED, c, rep_cnt, flags); root_view_->ProcessKeyEvent(event); } -void ContainerWin::OnKeyUp(TCHAR c, UINT rep_cnt, UINT flags) { +void WidgetWin::OnKeyUp(TCHAR c, UINT rep_cnt, UINT flags) { KeyEvent event(Event::ET_KEY_RELEASED, c, rep_cnt, flags); root_view_->ProcessKeyEvent(event); } -void ContainerWin::OnLButtonDown(UINT flags, const CPoint& point) { +void WidgetWin::OnLButtonDown(UINT flags, const CPoint& point) { ProcessMousePressed(point, flags | MK_LBUTTON, false); } -void ContainerWin::OnLButtonUp(UINT flags, const CPoint& point) { +void WidgetWin::OnLButtonUp(UINT flags, const CPoint& point) { ProcessMouseReleased(point, flags | MK_LBUTTON); } -void ContainerWin::OnLButtonDblClk(UINT flags, const CPoint& point) { +void WidgetWin::OnLButtonDblClk(UINT flags, const CPoint& point) { ProcessMousePressed(point, flags | MK_LBUTTON, true); } -void ContainerWin::OnMButtonDown(UINT flags, const CPoint& point) { +void WidgetWin::OnMButtonDown(UINT flags, const CPoint& point) { ProcessMousePressed(point, flags | MK_MBUTTON, false); } -void ContainerWin::OnMButtonUp(UINT flags, const CPoint& point) { +void WidgetWin::OnMButtonUp(UINT flags, const CPoint& point) { ProcessMouseReleased(point, flags | MK_MBUTTON); } -void ContainerWin::OnMButtonDblClk(UINT flags, const CPoint& point) { +void WidgetWin::OnMButtonDblClk(UINT flags, const CPoint& point) { ProcessMousePressed(point, flags | MK_MBUTTON, true); } -LRESULT ContainerWin::OnMouseActivate(HWND window, UINT hittest_code, - UINT message) { +LRESULT WidgetWin::OnMouseActivate(HWND window, UINT hittest_code, + UINT message) { SetMsgHandled(FALSE); return MA_ACTIVATE; } -void ContainerWin::OnMouseMove(UINT flags, const CPoint& point) { +void WidgetWin::OnMouseMove(UINT flags, const CPoint& point) { ProcessMouseMoved(point, flags, false); } -LRESULT ContainerWin::OnMouseLeave(UINT uMsg, WPARAM w_param, LPARAM l_param) { +LRESULT WidgetWin::OnMouseLeave(UINT uMsg, WPARAM w_param, LPARAM l_param) { tooltip_manager_->OnMouseLeave(); ProcessMouseExited(); return 0; } -LRESULT ContainerWin::OnMouseWheel(UINT flags, short distance, - const CPoint& point) { +LRESULT WidgetWin::OnMouseWheel(UINT flags, short distance, + const CPoint& point) { MouseWheelEvent e(distance, point.x, point.y, @@ -546,43 +544,42 @@ LRESULT ContainerWin::OnMouseWheel(UINT flags, short distance, return root_view_->ProcessMouseWheelEvent(e) ? 0 : 1; } -LRESULT ContainerWin::OnMouseRange(UINT msg, WPARAM w_param, LPARAM l_param) { +LRESULT WidgetWin::OnMouseRange(UINT msg, WPARAM w_param, LPARAM l_param) { tooltip_manager_->OnMouse(msg, w_param, l_param); SetMsgHandled(FALSE); return 0; } -void ContainerWin::OnNCLButtonDblClk(UINT flags, const CPoint& point) { +void WidgetWin::OnNCLButtonDblClk(UINT flags, const CPoint& point) { SetMsgHandled(FALSE); } -void ContainerWin::OnNCLButtonDown(UINT flags, const CPoint& point) { +void WidgetWin::OnNCLButtonDown(UINT flags, const CPoint& point) { SetMsgHandled(FALSE); } -void ContainerWin::OnNCLButtonUp(UINT flags, const CPoint& point) { +void WidgetWin::OnNCLButtonUp(UINT flags, const CPoint& point) { SetMsgHandled(FALSE); } -void ContainerWin::OnNCMButtonDblClk(UINT flags, const CPoint& point) { +void WidgetWin::OnNCMButtonDblClk(UINT flags, const CPoint& point) { SetMsgHandled(FALSE); } -void ContainerWin::OnNCMButtonDown(UINT flags, const CPoint& point) { +void WidgetWin::OnNCMButtonDown(UINT flags, const CPoint& point) { SetMsgHandled(FALSE); } -void ContainerWin::OnNCMButtonUp(UINT flags, const CPoint& point) { +void WidgetWin::OnNCMButtonUp(UINT flags, const CPoint& point) { SetMsgHandled(FALSE); } -LRESULT ContainerWin::OnNCMouseLeave(UINT uMsg, WPARAM w_param, - LPARAM l_param) { +LRESULT WidgetWin::OnNCMouseLeave(UINT uMsg, WPARAM w_param, LPARAM l_param) { ProcessMouseExited(); return 0; } -LRESULT ContainerWin::OnNCMouseMove(UINT flags, const CPoint& point) { +LRESULT WidgetWin::OnNCMouseMove(UINT flags, const CPoint& point) { // NC points are in screen coordinates. CPoint temp = point; MapWindowPoints(HWND_DESKTOP, GetHWND(), &temp, 1); @@ -594,19 +591,19 @@ LRESULT ContainerWin::OnNCMouseMove(UINT flags, const CPoint& point) { return 0; } -void ContainerWin::OnNCRButtonDblClk(UINT flags, const CPoint& point) { +void WidgetWin::OnNCRButtonDblClk(UINT flags, const CPoint& point) { SetMsgHandled(FALSE); } -void ContainerWin::OnNCRButtonDown(UINT flags, const CPoint& point) { +void WidgetWin::OnNCRButtonDown(UINT flags, const CPoint& point) { SetMsgHandled(FALSE); } -void ContainerWin::OnNCRButtonUp(UINT flags, const CPoint& point) { +void WidgetWin::OnNCRButtonUp(UINT flags, const CPoint& point) { SetMsgHandled(FALSE); } -LRESULT ContainerWin::OnNotify(int w_param, NMHDR* l_param) { +LRESULT WidgetWin::OnNotify(int w_param, NMHDR* l_param) { // We can be sent this message before the tooltip manager is created, if a // subclass overrides OnCreate and creates some kind of Windows control there // that sends WM_NOTIFY messages. @@ -620,24 +617,23 @@ LRESULT ContainerWin::OnNotify(int w_param, NMHDR* l_param) { return 0; } -void ContainerWin::OnPaint(HDC dc) { +void WidgetWin::OnPaint(HDC dc) { root_view_->OnPaint(GetHWND()); } -void ContainerWin::OnRButtonDown(UINT flags, const CPoint& point) { +void WidgetWin::OnRButtonDown(UINT flags, const CPoint& point) { ProcessMousePressed(point, flags | MK_RBUTTON, false); } -void ContainerWin::OnRButtonUp(UINT flags, const CPoint& point) { +void WidgetWin::OnRButtonUp(UINT flags, const CPoint& point) { ProcessMouseReleased(point, flags | MK_RBUTTON); } -void ContainerWin::OnRButtonDblClk(UINT flags, const CPoint& point) { +void WidgetWin::OnRButtonDblClk(UINT flags, const CPoint& point) { ProcessMousePressed(point, flags | MK_RBUTTON, true); } -LRESULT ContainerWin::OnSettingChange(UINT msg, WPARAM w_param, - LPARAM l_param) { +LRESULT WidgetWin::OnSettingChange(UINT msg, WPARAM w_param, LPARAM l_param) { if (toplevel_) { SetMsgHandled(FALSE); if (w_param != SPI_SETWORKAREA) @@ -650,24 +646,24 @@ LRESULT ContainerWin::OnSettingChange(UINT msg, WPARAM w_param, return 0; } -void ContainerWin::OnSize(UINT param, const CSize& size) { +void WidgetWin::OnSize(UINT param, const CSize& size) { ChangeSize(param, size); } -void ContainerWin::OnThemeChanged() { +void WidgetWin::OnThemeChanged() { // Notify NativeTheme. gfx::NativeTheme::instance()->CloseHandles(); } -void ContainerWin::OnFinalMessage(HWND window) { +void WidgetWin::OnFinalMessage(HWND window) { if (delete_on_destroy_) delete this; } /////////////////////////////////////////////////////////////////////////////// -// ContainerWin, protected: +// WidgetWin, protected: -void ContainerWin::TrackMouseEvents(DWORD mouse_tracking_flags) { +void WidgetWin::TrackMouseEvents(DWORD mouse_tracking_flags) { // Begin tracking mouse events for this HWND so that we get WM_MOUSELEAVE // when the user moves the mouse outside this HWND's bounds. if (active_mouse_tracking_flags_ == 0 || mouse_tracking_flags & TME_CANCEL) { @@ -691,8 +687,8 @@ void ContainerWin::TrackMouseEvents(DWORD mouse_tracking_flags) { } } -bool ContainerWin::ProcessMousePressed(const CPoint& point, UINT flags, - bool dbl_click) { +bool WidgetWin::ProcessMousePressed(const CPoint& point, UINT flags, + bool dbl_click) { last_mouse_event_was_move_ = false; MouseEvent mouse_pressed(Event::ET_MOUSE_PRESSED, point.x, @@ -711,7 +707,7 @@ bool ContainerWin::ProcessMousePressed(const CPoint& point, UINT flags, return false; } -void ContainerWin::ProcessMouseDragged(const CPoint& point, UINT flags) { +void WidgetWin::ProcessMouseDragged(const CPoint& point, UINT flags) { last_mouse_event_was_move_ = false; MouseEvent mouse_drag(Event::ET_MOUSE_DRAGGED, point.x, @@ -720,7 +716,7 @@ void ContainerWin::ProcessMouseDragged(const CPoint& point, UINT flags) { root_view_->OnMouseDragged(mouse_drag); } -void ContainerWin::ProcessMouseReleased(const CPoint& point, UINT flags) { +void WidgetWin::ProcessMouseReleased(const CPoint& point, UINT flags) { last_mouse_event_was_move_ = false; MouseEvent mouse_up(Event::ET_MOUSE_RELEASED, point.x, @@ -737,8 +733,8 @@ void ContainerWin::ProcessMouseReleased(const CPoint& point, UINT flags) { root_view_->OnMouseReleased(mouse_up, false); } -void ContainerWin::ProcessMouseMoved(const CPoint &point, UINT flags, - bool is_nonclient) { +void WidgetWin::ProcessMouseMoved(const CPoint &point, UINT flags, + bool is_nonclient) { // Windows only fires WM_MOUSELEAVE events if the application begins // "tracking" mouse events for a given HWND during WM_MOUSEMOVE events. // We need to call |TrackMouseEvents| to listen for WM_MOUSELEAVE. @@ -765,15 +761,15 @@ void ContainerWin::ProcessMouseMoved(const CPoint &point, UINT flags, } } -void ContainerWin::ProcessMouseExited() { +void WidgetWin::ProcessMouseExited() { last_mouse_event_was_move_ = false; root_view_->ProcessOnMouseExited(); - // Reset our tracking flag so that future mouse movement over this - // ContainerWin results in a new tracking session. + // Reset our tracking flag so that future mouse movement over this WidgetWin + // results in a new tracking session. active_mouse_tracking_flags_ = 0; } -void ContainerWin::AdjustWindowToFitScreenSize() { +void WidgetWin::AdjustWindowToFitScreenSize() { // Desktop size has changed. Make sure we're still on screen. CRect wr; GetWindowRect(&wr); @@ -801,7 +797,7 @@ void ContainerWin::AdjustWindowToFitScreenSize() { } } -void ContainerWin::ChangeSize(UINT size_param, const CSize& size) { +void WidgetWin::ChangeSize(UINT size_param, const CSize& size) { CRect rect; if (layered_) { GetWindowRect(&rect); @@ -820,20 +816,20 @@ void ContainerWin::ChangeSize(UINT size_param, const CSize& size) { PaintNow(gfx::Rect(rect)); } -RootView* ContainerWin::CreateRootView() { +RootView* WidgetWin::CreateRootView() { return new RootView(this); } /////////////////////////////////////////////////////////////////////////////// -// ContainerWin, private: +// WidgetWin, private: -void ContainerWin::SizeContents(const CRect& window_rect) { +void WidgetWin::SizeContents(const CRect& window_rect) { contents_.reset(new ChromeCanvas(window_rect.Width(), window_rect.Height(), false)); } -void ContainerWin::PaintLayeredWindow() { +void WidgetWin::PaintLayeredWindow() { // Painting monkeys with our cliprect, so we need to save it so that the // call to UpdateLayeredWindow updates the entire window, not just the // cliprect. @@ -847,7 +843,7 @@ void ContainerWin::PaintLayeredWindow() { UpdateWindowFromContents(contents_->getTopPlatformDevice().getBitmapDC()); } -void ContainerWin::UpdateWindowFromContents(HDC dib_dc) { +void WidgetWin::UpdateWindowFromContents(HDC dib_dc) { DCHECK(layered_); if (can_update_layered_window_) { CRect wr; @@ -863,7 +859,7 @@ void ContainerWin::UpdateWindowFromContents(HDC dib_dc) { } } -std::wstring ContainerWin::GetWindowClassName() { +std::wstring WidgetWin::GetWindowClassName() { if (!registered_classes) registered_classes = new RegisteredClasses(); ClassInfo class_info(initial_class_style()); @@ -880,7 +876,7 @@ std::wstring ContainerWin::GetWindowClassName() { WNDCLASSEX class_ex; class_ex.cbSize = sizeof(WNDCLASSEX); class_ex.style = class_info.style; - class_ex.lpfnWndProc = &ContainerWin::WndProc; + class_ex.lpfnWndProc = &WidgetWin::WndProc; class_ex.cbClsExtra = 0; class_ex.cbWndExtra = 0; class_ex.hInstance = NULL; @@ -899,27 +895,26 @@ std::wstring ContainerWin::GetWindowClassName() { } // static -LRESULT CALLBACK ContainerWin::WndProc(HWND window, UINT message, - WPARAM w_param, LPARAM l_param) { +LRESULT CALLBACK WidgetWin::WndProc(HWND window, UINT message, + WPARAM w_param, LPARAM l_param) { if (message == WM_NCCREATE) { CREATESTRUCT* cs = reinterpret_cast<CREATESTRUCT*>(l_param); - ContainerWin* vc = - reinterpret_cast<ContainerWin*>(cs->lpCreateParams); - DCHECK(vc); - win_util::SetWindowUserData(window, vc); - vc->hwnd_ = window; + WidgetWin* widget = reinterpret_cast<WidgetWin*>(cs->lpCreateParams); + DCHECK(widget); + win_util::SetWindowUserData(window, widget); + widget->hwnd_ = window; return TRUE; } - ContainerWin* vc = reinterpret_cast<ContainerWin*>( + WidgetWin* widget = reinterpret_cast<WidgetWin*>( win_util::GetWindowUserData(window)); - if (!vc) + if (!widget) return 0; LRESULT result = 0; - if (!vc->ProcessWindowMessage(window, message, w_param, l_param, result)) + if (!widget->ProcessWindowMessage(window, message, w_param, l_param, result)) result = DefWindowProc(window, message, w_param, l_param); if (message == WM_NCDESTROY) { - vc->hwnd_ = NULL; - vc->OnFinalMessage(window); + widget->hwnd_ = NULL; + widget->OnFinalMessage(window); } return result; } diff --git a/chrome/views/container_win.h b/chrome/views/widget_win.h index 84309b9..9e402e8 100644 --- a/chrome/views/container_win.h +++ b/chrome/views/widget_win.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_VIEWS_CONTAINER_WIN_H_ -#define CHROME_VIEWS_CONTAINER_WIN_H_ +#ifndef CHROME_VIEWS_WIDGET_WIN_H_ +#define CHROME_VIEWS_WIDGET_WIN_H_ #include <atlbase.h> #include <atlcrack.h> @@ -11,7 +11,7 @@ #include "base/message_loop.h" #include "chrome/views/focus_manager.h" #include "chrome/views/layout_manager.h" -#include "chrome/views/container.h" +#include "chrome/views/widget.h" class ChromeCanvas; @@ -68,34 +68,28 @@ class FillLayout : public LayoutManager { /////////////////////////////////////////////////////////////////////////////// // -// ContainerWin -// A container for a views hierarchy used to represent anything that can be +// WidgetWin +// A Widget for a views hierarchy used to represent anything that can be // contained within an HWND, e.g. a control, a window, etc. Specializations // suitable for specific tasks, e.g. top level window, are derived from this. // -// This Container contains a RootView which owns the hierarchy of views -// within it. As long as views are part of this tree, they will be deleted -// automatically when the RootView is destroyed. If you remove a view from the -// tree, you are then responsible for cleaning up after it. -// -// Note: We try and keep this API platform-neutral, since to some extent we -// consider this the boundary between the platform and potentially cross -// platform views code. In some cases this isn't true, primarily -// because of other code that has not yet been refactored to maintain -// this <controller>-<view>-<platform-specific-view> separation. +// This Widget contains a RootView which owns the hierarchy of views within it. +// As long as views are part of this tree, they will be deleted automatically +// when the RootView is destroyed. If you remove a view from the tree, you are +// then responsible for cleaning up after it. // /////////////////////////////////////////////////////////////////////////////// -class ContainerWin : public Container, - public MessageLoopForUI::Observer, - public FocusTraversable, - public AcceleratorTarget { +class WidgetWin : public Widget, + public MessageLoopForUI::Observer, + public FocusTraversable, + public AcceleratorTarget { public: - ContainerWin(); - virtual ~ContainerWin(); + WidgetWin(); + virtual ~WidgetWin(); - // Initialize the container with a parent and an initial desired size. + // Initialize the Widget with a parent and an initial desired size. // |contents_view| is the view that will be the single child of RootView - // within this Container. As contents_view is inserted into RootView's tree, + // within this Widget. As contents_view is inserted into RootView's tree, // RootView assumes ownership of this view and cleaning it up. If you remove // this view, you are responsible for its destruction. If this value is NULL, // the caller is responsible for populating the RootView, and sizing its @@ -106,10 +100,10 @@ class ContainerWin : public Container, const gfx::Rect& bounds, bool has_own_focus_manager); - // Sets the specified view as the contents of this Container. There can only - // be one contnets view child of this Container's RootView. This view is - // sized to fit the entire size of the RootView. The RootView takes ownership - // of this View, unless it is set as not being parent-owned. + // Sets the specified view as the contents of this Widget. There can only + // be one contnets view child of this Widget's RootView. This view is sized to + // fit the entire size of the RootView. The RootView takes ownership of this + // View, unless it is set as not being parent-owned. virtual void SetContentsView(View* view); // Sets the window styles. This is ONLY used when the window is created. @@ -155,11 +149,11 @@ class ContainerWin : public Container, virtual void Hide(); // Closes the window synchronously. Note that this should not be called from - // an ATL message callback as it deletes the ContainerWin and ATL will + // an ATL message callback as it deletes the WidgetWin and ATL will // dereference it after the callback is processed. void CloseNow(); - // All classes registered by ContainerWin start with this name. + // All classes registered by WidgetWin start with this name. static const wchar_t* const kBaseClassName; BEGIN_MSG_MAP_EX(0) @@ -242,7 +236,7 @@ class ContainerWin : public Container, MSG_WM_WINDOWPOSCHANGED(OnWindowPosChanged) END_MSG_MAP() - // Overridden from Container: + // Overridden from Widget: virtual void GetBounds(CRect *out, bool including_frame) const; virtual void MoveToFront(bool should_activate); virtual HWND GetHWND() const; @@ -338,8 +332,8 @@ class ContainerWin : public Container, } // Message Handlers - // These are all virtual so that specialized view containers can modify or - // augment processing. + // These are all virtual so that specialized Widgets can modify or augment + // processing. // This list is in _ALPHABETICAL_ order! // Note: in the base class these functions must do nothing but convert point // coordinates to client coordinates (if necessary) and forward the @@ -485,7 +479,7 @@ class ContainerWin : public Container, virtual RootView* CreateRootView(); - // Returns true if this ContainerWin is opaque. + // Returns true if this WidgetWin is opaque. bool opaque() const { return opaque_; } // The root of the View hierarchy attached to this window. @@ -518,7 +512,7 @@ class ContainerWin : public Container, // so that subclasses can do any cleanup they need to. void OnDestroyImpl(); - // The windows procedure used by all ContainerWins. + // The windows procedure used by all WidgetWins. static LRESULT CALLBACK WndProc(HWND window, UINT message, WPARAM w_param, @@ -528,9 +522,9 @@ class ContainerWin : public Container, // If necessary, this registers the window class. std::wstring GetWindowClassName(); - // The following factory is used for calls to close the ContainerWin + // The following factory is used for calls to close the WidgetWin // instance. - ScopedRunnableMethodFactory<ContainerWin> close_container_factory_; + ScopedRunnableMethodFactory<WidgetWin> close_widget_factory_; // The flags currently being used with TrackMouseEvent to track mouse // messages. 0 if there is no active tracking. The value of this member is @@ -589,5 +583,5 @@ class ContainerWin : public Container, } // namespace views -#endif // #ifndef CHROME_VIEWS_CONTAINER_WIN_H_ +#endif // #ifndef CHROME_VIEWS_WIDGET_WIN_H_ diff --git a/chrome/views/window.cc b/chrome/views/window.cc index e5726c8..6c61ff0 100644 --- a/chrome/views/window.cc +++ b/chrome/views/window.cc @@ -129,7 +129,7 @@ void Window::Close() { if (client_view_->CanClose()) { SaveWindowPosition(); RestoreEnabledIfNecessary(); - ContainerWin::Close(); + WidgetWin::Close(); // If the user activates another app after opening us, then comes back and // 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 @@ -221,7 +221,7 @@ gfx::Size Window::GetLocalizedContentsSize(int col_resource_id, // Window, protected: Window::Window(WindowDelegate* window_delegate) - : ContainerWin(), + : WidgetWin(), focus_on_creation_(true), window_delegate_(window_delegate), non_client_view_(NULL), @@ -249,7 +249,7 @@ void Window::Init(HWND parent, const gfx::Rect& bounds) { // return NULL. owning_hwnd_ = parent; // We call this after initializing our members since our implementations of - // assorted ContainerWin functions may be called during initialization. + // assorted WidgetWin functions may be called during initialization. is_modal_ = window_delegate_->IsModal(); if (is_modal_) BecomeModal(); @@ -260,7 +260,7 @@ void Window::Init(HWND parent, const gfx::Rect& bounds) { if (window_ex_style() == 0) set_window_ex_style(CalculateWindowExStyle()); - ContainerWin::Init(parent, bounds, true); + WidgetWin::Init(parent, bounds, true); win_util::SetWindowUserData(GetHWND(), this); std::wstring window_title = window_delegate_->GetWindowTitle(); @@ -279,9 +279,9 @@ void Window::SetClientView(ClientView* client_view) { client_view_ = client_view; if (non_client_view_) { // This will trigger the ClientView to be added by the non-client view. - ContainerWin::SetContentsView(non_client_view_); + WidgetWin::SetContentsView(non_client_view_); } else { - ContainerWin::SetContentsView(client_view_); + WidgetWin::SetContentsView(client_view_); } } @@ -313,7 +313,7 @@ void Window::RunSystemMenu(const CPoint& point) { } /////////////////////////////////////////////////////////////////////////////// -// Window, ContainerWin overrides: +// Window, WidgetWin overrides: void Window::OnActivate(UINT action, BOOL minimized, HWND window) { if (action == WA_INACTIVE) @@ -325,13 +325,13 @@ LRESULT Window::OnAppCommand(HWND window, short app_command, WORD device, // We treat APPCOMMAND ids as an extension of our command namespace, and just // let the delegate figure out what to do... if (!window_delegate_->ExecuteWindowsCommand(app_command)) - return ContainerWin::OnAppCommand(window, app_command, device, keystate); + return WidgetWin::OnAppCommand(window, app_command, device, keystate); return 0; } void Window::OnCommand(UINT notification_code, int command_id, HWND window) { if (!window_delegate_->ExecuteWindowsCommand(command_id)) - ContainerWin::OnCommand(notification_code, command_id, window); + WidgetWin::OnCommand(notification_code, command_id, window); } void Window::OnDestroy() { @@ -340,7 +340,7 @@ void Window::OnDestroy() { window_delegate_ = NULL; } RestoreEnabledIfNecessary(); - ContainerWin::OnDestroy(); + WidgetWin::OnDestroy(); } LRESULT Window::OnNCActivate(BOOL active) { @@ -349,7 +349,7 @@ LRESULT Window::OnNCActivate(BOOL active) { return DefWindowProc(GetHWND(), WM_NCACTIVATE, TRUE, 0); } // Otherwise just do the default thing. - return ContainerWin::OnNCActivate(active); + return WidgetWin::OnNCActivate(active); } LRESULT Window::OnNCHitTest(const CPoint& point) { @@ -375,14 +375,14 @@ LRESULT Window::OnNCHitTest(const CPoint& point) { void Window::OnNCLButtonDown(UINT ht_component, const CPoint& point) { if (non_client_view_ && ht_component == HTSYSMENU) RunSystemMenu(non_client_view_->GetSystemMenuPoint()); - ContainerWin::OnNCLButtonDown(ht_component, point); + WidgetWin::OnNCLButtonDown(ht_component, point); } void Window::OnNCRButtonDown(UINT ht_component, const CPoint& point) { if (ht_component == HTCAPTION || ht_component == HTSYSMENU) { RunSystemMenu(point); } else { - ContainerWin::OnNCRButtonDown(ht_component, point); + WidgetWin::OnNCRButtonDown(ht_component, point); } } diff --git a/chrome/views/window.h b/chrome/views/window.h index 9758f9f..3a3ae7b 100644 --- a/chrome/views/window.h +++ b/chrome/views/window.h @@ -5,7 +5,7 @@ #ifndef CHROME_VIEWS_WINDOW_H__ #define CHROME_VIEWS_WINDOW_H__ -#include "chrome/views/container_win.h" +#include "chrome/views/widget_win.h" namespace gfx { class Size; @@ -26,11 +26,11 @@ class WindowDelegate; // // Window // -// A Window is a ContainerWin that has a caption and a border. The frame is +// A Window is a WidgetWIn that has a caption and a border. The frame is // rendered by the operating system. // /////////////////////////////////////////////////////////////////////////////// -class Window : public ContainerWin { +class Window : public WidgetWin { public: virtual ~Window(); @@ -146,7 +146,7 @@ class Window : public ContainerWin { // Shows the system menu at the specified screen point. void RunSystemMenu(const CPoint& point); - // Overridden from ContainerWin: + // Overridden from WidgetWin: virtual void OnActivate(UINT action, BOOL minimized, HWND window); virtual LRESULT OnAppCommand(HWND window, short app_command, WORD device, int keystate); |