diff options
116 files changed, 553 insertions, 580 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index c7bb3d5..e4b4bf6 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -1143,7 +1143,7 @@ void AutomationProvider::WindowGetViewBounds(const IPC::Message& message, if (window_tracker_->ContainsHandle(handle)) { HWND hwnd = window_tracker_->GetResource(handle); ChromeViews::RootView* root_view = - ChromeViews::HWNDViewContainer::FindRootView(hwnd); + ChromeViews::ContainerWin::FindRootView(hwnd); if (root_view) { ChromeViews::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 ab5f572..f87490e 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( ChromeViews::View* view, MouseButton button, int state, Task* task) { DCHECK(view); - DCHECK(view->GetViewContainer()); + DCHECK(view->GetContainer()); gfx::Point view_center(view->width() / 2, view->height() / 2); ChromeViews::View::ConvertPointToScreen(view, &view_center); SendMouseMove(view_center.x(), view_center.y()); diff --git a/chrome/browser/bookmark_bar_context_menu_controller.cc b/chrome/browser/bookmark_bar_context_menu_controller.cc index d7c1010d..75d33b8 100644 --- a/chrome/browser/bookmark_bar_context_menu_controller.cc +++ b/chrome/browser/bookmark_bar_context_menu_controller.cc @@ -16,7 +16,7 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/views/view_container.h" +#include "chrome/views/container.h" #include "chrome/views/window.h" #include "chromium_strings.h" @@ -121,7 +121,7 @@ class EditFolderController : public InputWindowDelegate, visual_order_(visual_order), is_new_(is_new) { DCHECK(is_new_ || node); - window_ = CreateInputWindow(view->GetViewContainer()->GetHWND(), this); + window_ = CreateInputWindow(view->GetContainer()->GetHWND(), this); view_->SetModelChangedListener(this); } @@ -274,7 +274,7 @@ void BookmarkBarContextMenuController::RunMenuAt(int x, int y) { view_->SetModelChangedListener(this); // width/height don't matter here. - menu_.RunMenuAt(view_->GetViewContainer()->GetHWND(), gfx::Rect(x, y, 0, 0), + menu_.RunMenuAt(view_->GetContainer()->GetHWND(), gfx::Rect(x, y, 0, 0), ChromeViews::MenuItemView::TOPLEFT, true); if (view_->GetModelChangedListener() == this) @@ -328,9 +328,9 @@ void BookmarkBarContextMenuController::ExecuteCommand(int id) { else initial_disposition = CURRENT_TAB; - // GetViewContainer is NULL during testing. - HWND parent_hwnd = view_->GetViewContainer() ? - view_->GetViewContainer()->GetHWND() : 0; + // GetContainer is NULL during testing. + HWND parent_hwnd = view_->GetContainer() ? + view_->GetContainer()->GetHWND() : 0; OpenAll(parent_hwnd, view_->GetPageNavigator(), node_, initial_disposition); @@ -341,7 +341,7 @@ void BookmarkBarContextMenuController::ExecuteCommand(int id) { UserMetrics::RecordAction(L"BookmarkBar_ContextMenu_Edit", profile); if (node_->GetType() == history::StarredEntry::URL) { - BookmarkEditorView::Show(view_->GetViewContainer()->GetHWND(), + BookmarkEditorView::Show(view_->GetContainer()->GetHWND(), view_->GetProfile(), NULL, node_); } else { // Controller deletes itself when done. @@ -362,7 +362,7 @@ void BookmarkBarContextMenuController::ExecuteCommand(int id) { case add_bookmark_id: { UserMetrics::RecordAction(L"BookmarkBar_ContextMenu_Add", profile); - BookmarkEditorView::Show(view_->GetViewContainer()->GetHWND(), + BookmarkEditorView::Show(view_->GetContainer()->GetHWND(), view_->GetProfile(), node_, NULL); break; } diff --git a/chrome/browser/browser_commands.cc b/chrome/browser/browser_commands.cc index cca8754..eb1d405 100644 --- a/chrome/browser/browser_commands.cc +++ b/chrome/browser/browser_commands.cc @@ -1027,8 +1027,8 @@ void Browser::DuplicateContentsAt(int index) { Browser* new_browser = new Browser(gfx::Rect(), SW_SHOWNORMAL, profile(), BrowserType::APPLICATION, app_name_); - // We need to show the browser now. Otherwise HWNDViewContainer assumes - // the tab contents is invisible and won't size it. + // We need to show the browser now. Otherwise ContainerWin assumes the + // TabContents is invisible and won't size it. new_browser->Show(); // The page transition below is only for the purpose of inserting the tab. diff --git a/chrome/browser/browser_uitest.cc b/chrome/browser/browser_uitest.cc index 842b7d8..f564d4f 100644 --- a/chrome/browser/browser_uitest.cc +++ b/chrome/browser/browser_uitest.cc @@ -12,7 +12,7 @@ #include "chrome/test/automation/tab_proxy.h" #include "chrome/test/automation/window_proxy.h" #include "chrome/test/ui/ui_test.h" -#include "chrome/views/view_container.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 34b4de5..f6cac90 100644 --- a/chrome/browser/debugger/debugger_view.cc +++ b/chrome/browser/debugger/debugger_view.cc @@ -55,7 +55,7 @@ void DebuggerView::ViewHierarchyChanged(bool is_add, ChromeViews::View* parent, ChromeViews::View* child) { if (is_add && child == this) { - DCHECK(GetViewContainer()); + DCHECK(GetContainer()); OnInit(); } } diff --git a/chrome/browser/external_tab_container.cc b/chrome/browser/external_tab_container.cc index c6188c3..abf033f 100644 --- a/chrome/browser/external_tab_container.cc +++ b/chrome/browser/external_tab_container.cc @@ -13,7 +13,8 @@ #include "chrome/browser/web_contents.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/win_util.h" -#include "chrome/views/hwnd_view_container.h" +// Included for SetRootViewForHWND. +#include "chrome/views/container_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 b0f4909..2e3d589 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/view_container.h" class AutomationProvider; class TabContents; @@ -27,10 +27,10 @@ class TabContentsContainerView; // An external tab is a Chrome tab that is meant to displayed in an // external process. This class provides the FocusManger needed by the // TabContents as well as an implementation of TabContentsDelagate. -// It also implements ViewContainer +// It also implements Container class ExternalTabContainer : public TabContentsDelegate, public NotificationObserver, - public ChromeViews::ViewContainer, + public ChromeViews::Container, public ChromeViews::KeystrokeListener, public CWindowImpl<ExternalTabContainer, CWindow, @@ -88,7 +88,7 @@ class ExternalTabContainer : public TabContentsDelegate, const NotificationDetails& details); //////////////////////////////////////////////////////////////////////////////// - // ChromeViews::ViewContainer + // ChromeViews::Container //////////////////////////////////////////////////////////////////////////////// virtual void GetBounds(CRect *out, bool including_frame) const; virtual void MoveToFront(bool should_activate); diff --git a/chrome/browser/find_in_page_controller.cc b/chrome/browser/find_in_page_controller.cc index 86f7e84..0646ced 100644 --- a/chrome/browser/find_in_page_controller.cc +++ b/chrome/browser/find_in_page_controller.cc @@ -11,8 +11,8 @@ #include "chrome/browser/tab_contents.h" #include "chrome/browser/view_ids.h" #include "chrome/browser/views/bookmark_bar_view.h" +#include "chrome/views/container_win.h" #include "chrome/views/external_focus_tracker.h" -#include "chrome/views/hwnd_view_container.h" #include "chrome/views/native_scroll_bar.h" #include "chrome/views/root_view.h" #include "chrome/views/view_storage.h" @@ -41,9 +41,9 @@ FindInPageController::FindInPageController(TabContents* parent_tab, // own handler for Escape. SetFocusChangeListener(parent_hwnd); - // Don't let HWNDViewContainer manage our lifetime. We want our lifetime to + // Don't let ContainerWin manage our lifetime. We want our lifetime to // coincide with WebContents. - HWNDViewContainer::set_delete_on_destroy(false); + ContainerWin::set_delete_on_destroy(false); view_ = new FindInPageView(this); @@ -60,7 +60,7 @@ FindInPageController::FindInPageController(TabContents* parent_tab, gfx::Rect find_dlg_rect = GetDialogPosition(gfx::Rect()); set_window_style(WS_CHILD | WS_CLIPCHILDREN); set_window_ex_style(WS_EX_TOPMOST); - HWNDViewContainer::Init(parent_hwnd, find_dlg_rect, false); + ContainerWin::Init(parent_hwnd, find_dlg_rect, false); SetContentsView(view_); // Start the process of animating the opening of the window. @@ -326,7 +326,7 @@ void FindInPageController::SetParent(HWND new_parent) { } //////////////////////////////////////////////////////////////////////////////// -// FindInPageController, ChromeViews::HWNDViewContainer implementation: +// FindInPageController, ChromeViews::ContainerWin implementation: void FindInPageController::OnFinalMessage(HWND window) { // We are exiting, so we no longer need to monitor focus changes. @@ -487,12 +487,12 @@ void FindInPageController::GetDialogBounds(gfx::Rect* bounds) { toolbar->GetLocalBounds(&local_bounds, false); toolbar_bounds = gfx::Rect(local_bounds); } - // Need to convert toolbar bounds into ViewContainer 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. + // Need to convert toolbar bounds into Container 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; - ChromeViews::View::ConvertPointToViewContainer(toolbar, &topleft); + ChromeViews::View::ConvertPointToContainer(toolbar, &topleft); toolbar_bounds.Offset(topleft.x(), topleft.y()); } diff --git a/chrome/browser/find_in_page_controller.h b/chrome/browser/find_in_page_controller.h index 5ddef23..733d068 100644 --- a/chrome/browser/find_in_page_controller.h +++ b/chrome/browser/find_in_page_controller.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/hwnd_view_container.h" +#include "chrome/views/container_win.h" class FindInPageView; class SlideAnimation; @@ -34,7 +34,7 @@ namespace ChromeViews { //////////////////////////////////////////////////////////////////////////////// class FindInPageController : public RenderViewHostDelegate::FindInPage, public ChromeViews::FocusChangeListener, - public ChromeViews::HWNDViewContainer, + public ChromeViews::ContainerWin, public AnimationDelegate { public: FindInPageController(TabContents* parent_tab, @@ -107,7 +107,7 @@ class FindInPageController : public RenderViewHostDelegate::FindInPage, find_string_ = find_string; } - // Overridden from ChromeViews::HWNDViewContainer: + // Overridden from ChromeViews::ContainerWin: virtual void OnFinalMessage(HWND window); // Overridden from ChromeViews::FocusChangeListener: diff --git a/chrome/browser/find_in_page_view.cc b/chrome/browser/find_in_page_view.cc index 813dc10..da14afe 100644 --- a/chrome/browser/find_in_page_view.cc +++ b/chrome/browser/find_in_page_view.cc @@ -13,7 +13,6 @@ #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/resource_bundle.h" #include "chrome/views/background.h" -#include "chrome/views/hwnd_view_container.h" #include "chrome/views/label.h" #include "skia/include/SkGradientShader.h" diff --git a/chrome/browser/history_view.cc b/chrome/browser/history_view.cc index 6cac8f1..ef439eb 100644 --- a/chrome/browser/history_view.cc +++ b/chrome/browser/history_view.cc @@ -22,6 +22,7 @@ #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 "generated_resources.h" @@ -562,7 +563,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 = GetViewContainer()->GetHWND(); + HWND parent = GetContainer()->GetHWND(); Profile* profile = model_->profile(); GURL url = model_->GetURL(model_index_); @@ -835,7 +836,7 @@ ChromeViews::VariableRowHeightScrollHelper::RowInfo } bool HistoryView::IsVisible() { - ChromeViews::ViewContainer* vc = GetViewContainer(); + ChromeViews::Container* vc = GetContainer(); return vc && vc->IsVisible(); } @@ -1242,7 +1243,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(GetViewContainer()->GetHWND(), + if (win_util::MessageBox(GetContainer()->GetHWND(), text, caption, flags) != IDOK) { return; } diff --git a/chrome/browser/native_ui_contents.cc b/chrome/browser/native_ui_contents.cc index ef81dbd..785ca8a 100644 --- a/chrome/browser/native_ui_contents.cc +++ b/chrome/browser/native_ui_contents.cc @@ -16,8 +16,8 @@ #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/hwnd_view_container.h" #include "chrome/views/image_view.h" #include "chrome/views/root_view.h" #include "chrome/views/scroll_view.h" @@ -151,7 +151,7 @@ NativeUIContents::~NativeUIContents() { void NativeUIContents::CreateView(HWND parent_hwnd, const gfx::Rect& initial_bounds) { set_delete_on_destroy(false); - HWNDViewContainer::Init(parent_hwnd, initial_bounds, false); + ContainerWin::Init(parent_hwnd, initial_bounds, false); } LRESULT NativeUIContents::OnCreate(LPCREATESTRUCT create_struct) { diff --git a/chrome/browser/native_ui_contents.h b/chrome/browser/native_ui_contents.h index 443e3be..d333fcf 100644 --- a/chrome/browser/native_ui_contents.h +++ b/chrome/browser/native_ui_contents.h @@ -8,7 +8,7 @@ #include "chrome/browser/page_state.h" #include "chrome/browser/tab_contents.h" #include "chrome/views/background.h" -#include "chrome/views/hwnd_view_container.h" +#include "chrome/views/container_win.h" #include "chrome/views/link.h" #include "chrome/views/native_button.h" #include "chrome/views/text_field.h" @@ -33,7 +33,7 @@ class NativeUI; // //////////////////////////////////////////////////////////////////////////////// class NativeUIContents : public TabContents, - public ChromeViews::HWNDViewContainer { + public ChromeViews::ContainerWin { public: explicit NativeUIContents(Profile* profile); diff --git a/chrome/browser/network_status_view.cc b/chrome/browser/network_status_view.cc index 4a0e57c..74fff7f 100644 --- a/chrome/browser/network_status_view.cc +++ b/chrome/browser/network_status_view.cc @@ -11,7 +11,6 @@ #include "chrome/browser/browser.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/tab_contents_delegate.h" -#include "chrome/views/hwnd_view_container.h" #include "chrome/views/root_view.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_job.h" diff --git a/chrome/browser/network_status_view.h b/chrome/browser/network_status_view.h index bae43fa..2170f73 100644 --- a/chrome/browser/network_status_view.h +++ b/chrome/browser/network_status_view.h @@ -16,9 +16,6 @@ class MessageLoop; class RenderProcessHost; class NavigationPerformanceViewer; class PageLoadView; -namespace ChromeViews { -class HWNDViewContainer; -} class NetworkStatusView : public StatusView { public: diff --git a/chrome/browser/render_widget_host_view_win.cc b/chrome/browser/render_widget_host_view_win.cc index bc9c283..d32e658 100644 --- a/chrome/browser/render_widget_host_view_win.cc +++ b/chrome/browser/render_widget_host_view_win.cc @@ -21,7 +21,9 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/plugin_messages.h" #include "chrome/common/win_util.h" -#include "chrome/views/hwnd_view_container.h" +// Included for ChromeViews::kReflectedMessage - TODO(beng): move this to +// win_util.h! +#include "chrome/views/container_win.h" #include "webkit/glue/webcursor.h" namespace { diff --git a/chrome/browser/tab_contents.cc b/chrome/browser/tab_contents.cc index 2deb196..77a55f7 100644 --- a/chrome/browser/tab_contents.cc +++ b/chrome/browser/tab_contents.cc @@ -13,7 +13,7 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/views/hwnd_view_container.h" +#include "chrome/views/container.h" #include "chrome/views/native_scroll_bar.h" #include "chrome/views/root_view.h" #include "chrome/views/view.h" @@ -26,8 +26,8 @@ static size_t kMaxNumberOfConstrainedPopups = 20; namespace { BOOL CALLBACK InvalidateWindow(HWND hwnd, LPARAM lparam) { - // Note: erase is required to properly paint some widgets borders. This can be - // seen with textfields. + // Note: erase is required to properly paint some widgets borders. This can + // be seen with textfields. InvalidateRect(hwnd, NULL, TRUE); return TRUE; } @@ -365,7 +365,7 @@ void TabContents::StoreFocus() { if (container_hwnd) { ChromeViews::View* focused_view = focus_manager->GetFocusedView(); if (focused_view) { - HWND hwnd = focused_view->GetRootView()->GetViewContainer()->GetHWND(); + HWND hwnd = focused_view->GetRootView()->GetContainer()->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 82afafc..0f593b1 100644 --- a/chrome/browser/task_manager.cc +++ b/chrome/browser/task_manager.cc @@ -937,7 +937,7 @@ void TaskManagerContents::ShowContextMenu(ChromeViews::View* source, int y, bool is_mouse_gesture) { UpdateStatsCounters(); - Menu menu(this, Menu::TOPLEFT, source->GetViewContainer()->GetHWND()); + Menu menu(this, Menu::TOPLEFT, source->GetContainer()->GetHWND()); for (std::vector<ChromeViews::TableColumn>::iterator i = columns_.begin(); i != columns_.end(); ++i) { menu.AppendMenuItem(i->id, i->title, Menu::CHECKBOX); diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc index dce6d08..ca3267b 100644 --- a/chrome/browser/views/bookmark_bar_view.cc +++ b/chrome/browser/views/bookmark_bar_view.cc @@ -40,9 +40,9 @@ #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_container.h" #include "chrome/views/window.h" #include "generated_resources.h" @@ -1408,7 +1408,7 @@ void BookmarkBarView::RunMenu(ChromeViews::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 = GetViewContainer()->GetHWND(); + HWND parent_hwnd = GetContainer()->GetHWND(); menu_runner_->RunMenuAt(parent_hwnd, gfx::Rect(screen_loc.x(), screen_loc.y(), view->width(), bar_height), @@ -1433,7 +1433,7 @@ void BookmarkBarView::ButtonPressed(ChromeViews::BaseButton* sender) { PageTransition::AUTO_BOOKMARK); } else { BookmarkBarContextMenuController::OpenAll( - GetViewContainer()->GetHWND(), GetPageNavigator(), node, + GetContainer()->GetHWND(), GetPageNavigator(), node, event_utils::DispositionFromEventFlags(sender->mouse_event_flags())); } UserMetrics::RecordAction(L"ClickedBookmarkBarURLButton", profile_); @@ -1591,7 +1591,7 @@ void BookmarkBarView::ShowDropFolderForNode(BookmarkNode* node) { gfx::Point screen_loc; View::ConvertPointToScreen(view_to_position_menu_from, &screen_loc); drop_menu_runner_->RunMenuAt( - GetViewContainer()->GetHWND(), + GetContainer()->GetHWND(), gfx::Rect(screen_loc.x(), screen_loc.y(), view_to_position_menu_from->width(), view_to_position_menu_from->height()), @@ -1828,7 +1828,7 @@ void BookmarkBarView::StartThrobbing() { if (bubble_url_.is_empty()) return; // Bubble isn't showing; nothing to throb. - if (!GetViewContainer()) + if (!GetContainer()) 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 ffb9817..f6021ef 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 CRect& previous, } void BookmarkBubbleView::BubbleShown() { - DCHECK(GetViewContainer()); + DCHECK(GetContainer()); ChromeViews::FocusManager* focus_manager = - ChromeViews::FocusManager::GetFocusManager(GetViewContainer()->GetHWND()); + ChromeViews::FocusManager::GetFocusManager(GetContainer()->GetHWND()); focus_manager->RegisterAccelerator( ChromeViews::Accelerator(VK_RETURN, false, false, false), this); @@ -316,7 +316,7 @@ bool BookmarkBubbleView::CloseOnEscape() { } void BookmarkBubbleView::Close() { - static_cast<InfoBubble*>(GetViewContainer())->Close(); + static_cast<InfoBubble*>(GetContainer())->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(GetViewContainer()->GetHWND(), GA_ROOTOWNER); + HWND parent = GetAncestor(GetContainer()->GetHWND(), GA_ROOTOWNER); // We're about to show the bookmark editor. When the bookmark editor closes - // we want the browser to become active. HWNDViewContainer::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(GetViewContainer()->GetHWND(), SW_HIDE); + // we want the browser to become active. ContainerWin::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); // 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 f73b4dd..b93e8a6 100644 --- a/chrome/browser/views/bookmark_editor_view.cc +++ b/chrome/browser/views/bookmark_editor_view.cc @@ -210,7 +210,7 @@ void BookmarkEditorView::ShowContextMenu(View* source, (tree_model_->GetParent(tree_view_.GetSelectedNode()) == tree_model_->GetRoot()); context_menu_.reset(new Menu(this, Menu::TOPLEFT, - GetViewContainer()->GetHWND())); + GetContainer()->GetHWND())); context_menu_->AppendMenuItemWithLabel(IDS_EDIT, l10n_util::GetString(IDS_EDIT)); context_menu_->AppendMenuItemWithLabel( diff --git a/chrome/browser/views/constrained_window_impl.cc b/chrome/browser/views/constrained_window_impl.cc index 4666e1f..11f635a 100644 --- a/chrome/browser/views/constrained_window_impl.cc +++ b/chrome/browser/views/constrained_window_impl.cc @@ -627,11 +627,10 @@ gfx::Size ConstrainedWindowNonClientView::GetPreferredSize() { void ConstrainedWindowNonClientView::ViewHierarchyChanged(bool is_add, View *parent, View *child) { - if (is_add && GetViewContainer()) { - // Add our Client View as we are added to the ViewContainer so that if we - // are subsequently resized all the parent-child relationships are - // established. - if (is_add && GetViewContainer() && child == this) + if (is_add && GetContainer()) { + // 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) AddChildView(container_->client_view()); if (location_bar_ && !location_bar_->IsInitialized()) location_bar_->Init(); @@ -1241,7 +1240,7 @@ void ConstrainedWindowImpl::UpdateUI(unsigned int changed_flags) { } //////////////////////////////////////////////////////////////////////////////// -// ConstrainedWindowImpl, ChromeViews::HWNDViewContainer overrides: +// ConstrainedWindowImpl, ChromeViews::ContainerWin overrides: void ConstrainedWindowImpl::OnDestroy() { // We do this here, rather than |Close|, since the window may be destroyed in @@ -1291,7 +1290,7 @@ void ConstrainedWindowImpl::OnFinalMessage(HWND window) { constrained_contents_ = NULL; } - HWNDViewContainer::OnFinalMessage(window); + ContainerWin::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 c97b605..24f6f5b 100644 --- a/chrome/browser/views/dom_view.cc +++ b/chrome/browser/views/dom_view.cc @@ -5,7 +5,7 @@ #include "chrome/browser/views/dom_view.h" #include "chrome/browser/dom_ui/dom_ui_host.h" -#include "chrome/views/hwnd_view_container.h" +#include "chrome/views/container.h" DOMView::DOMView(const GURL& contents) : contents_(contents), initialized_(false), host_(NULL) { @@ -29,7 +29,7 @@ bool DOMView::Init(Profile* profile, SiteInstance* instance) { // should only be associated with instances of DOMUIHost. TabContentsType type = TabContents::TypeForURL(&contents_); TabContents* tab_contents = TabContents::CreateWithType(type, - GetViewContainer()->GetHWND(), profile, instance); + GetContainer()->GetHWND(), profile, instance); host_ = tab_contents->AsDOMUIHost(); DCHECK(host_); diff --git a/chrome/browser/views/download_item_view.cc b/chrome/browser/views/download_item_view.cc index 1738463..66f4c55 100644 --- a/chrome/browser/views/download_item_view.cc +++ b/chrome/browser/views/download_item_view.cc @@ -16,9 +16,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/view_container.h" #include "generated_resources.h" @@ -630,7 +630,7 @@ bool DownloadItemView::OnMousePressed(const ChromeViews::MouseEvent& event) { ChromeViews::View::ConvertPointToScreen(this, &point); download_util::DownloadShelfContextMenu menu(download_, - GetViewContainer()->GetHWND(), + GetContainer()->GetHWND(), model_.get(), point.ToPOINT()); drop_down_pressed_ = false; diff --git a/chrome/browser/views/download_started_animation.cc b/chrome/browser/views/download_started_animation.cc index f95b13c..d3e04c6 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/hwnd_view_container.h" +#include "chrome/views/container_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 ChromeViews::HWNDViewContainer; + popup_ = new ChromeViews::ContainerWin; 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 5cff47fe..6934fc5 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 ChromeViews { - class HWNDViewContainer; +class ContainerWin; }; 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. - ChromeViews::HWNDViewContainer* popup_; + ChromeViews::ContainerWin* 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 1deaf60..61f5164 100644 --- a/chrome/browser/views/download_tab_view.cc +++ b/chrome/browser/views/download_tab_view.cc @@ -702,7 +702,7 @@ bool DownloadItemTabView::OnMousePressed(const ChromeViews::MouseEvent& event) { ChromeViews::View::ConvertPointToScreen(this, &point); download_util::DownloadDestinationContextMenu menu( - model_, GetViewContainer()->GetHWND(), point.ToPOINT()); + model_, GetContainer()->GetHWND(), point.ToPOINT()); } } else { parent_->ItemBecameSelected(NULL); @@ -743,7 +743,7 @@ void DownloadItemTabView::LinkActivated(ChromeViews::Link* source, int event_flags) { // There are several links in our view that could have been clicked: if (source == file_name_) { - ChromeViews::ViewContainer* container = this->GetViewContainer(); + ChromeViews::Container* container = this->GetContainer(); HWND parent_window = container ? container->GetHWND() : NULL; model_->manager()->OpenDownloadInShell(model_, parent_window); } else if (source == pause_) { diff --git a/chrome/browser/views/frame/aero_glass_frame.cc b/chrome/browser/views/frame/aero_glass_frame.cc index cb86728..7810cac 100644 --- a/chrome/browser/views/frame/aero_glass_frame.cc +++ b/chrome/browser/views/frame/aero_glass_frame.cc @@ -91,7 +91,7 @@ ChromeViews::Window* AeroGlassFrame::GetWindow() { } /////////////////////////////////////////////////////////////////////////////// -// AeroGlassFrame, ChromeViews::HWNDViewContainer implementation: +// AeroGlassFrame, ChromeViews::ContainerWin implementation: void AeroGlassFrame::OnInitMenuPopup(HMENU menu, UINT position, BOOL is_system_menu) { @@ -183,7 +183,7 @@ LRESULT AeroGlassFrame::OnNCHitTest(const CPoint& pt) { } /////////////////////////////////////////////////////////////////////////////// -// AeroGlassFrame, ChromeViews::HWNDViewContainer overrides: +// AeroGlassFrame, ChromeViews::ContainerWin overrides: bool AeroGlassFrame::AcceleratorPressed( ChromeViews::Accelerator* accelerator) { diff --git a/chrome/browser/views/frame/aero_glass_frame.h b/chrome/browser/views/frame/aero_glass_frame.h index a649eef..ccdec53 100644 --- a/chrome/browser/views/frame/aero_glass_frame.h +++ b/chrome/browser/views/frame/aero_glass_frame.h @@ -38,13 +38,13 @@ class AeroGlassFrame : public BrowserFrame, virtual void UpdateThrobber(bool running); virtual ChromeViews::Window* GetWindow(); - // Overridden from ChromeViews::HWNDViewContainer: + // Overridden from ChromeViews::ContainerWin: virtual bool AcceleratorPressed(ChromeViews::Accelerator* accelerator); virtual bool GetAccelerator(int cmd_id, ChromeViews::Accelerator* accelerator); protected: - // Overridden from ChromeViews::HWNDViewContainer: + // Overridden from ChromeViews::ContainerWin: virtual void OnInitMenuPopup(HMENU menu, UINT position, BOOL is_system_menu); virtual void OnEndSession(BOOL ending, UINT logoff); virtual void OnExitMenuLoop(bool is_track_popup_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 74de8bb..5155634 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(GetViewContainer()->GetHWND(), HWND_DESKTOP, &offset, 1); + MapWindowPoints(GetContainer()->GetHWND(), HWND_DESKTOP, &offset, 1); return offset; } @@ -259,7 +259,7 @@ void AeroGlassNonClientView::ViewHierarchyChanged(bool is_add, ChromeViews::View* parent, ChromeViews::View* child) { if (is_add && child == this) { - DCHECK(GetViewContainer()); + DCHECK(GetContainer()); 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 71b82c4..5a8b495 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -61,7 +61,7 @@ void BrowserView::Init() { toolbar_->Init(browser_->profile()); toolbar_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_TOOLBAR)); - status_bubble_.reset(new StatusBubble(GetViewContainer())); + status_bubble_.reset(new StatusBubble(GetContainer())); } void BrowserView::Show(int command, bool adjust_to_fit) { @@ -228,10 +228,10 @@ void BrowserView::DidChangeBounds(const CRect& previous, void BrowserView::ViewHierarchyChanged(bool is_add, ChromeViews::View* parent, ChromeViews::View* child) { - if (is_add && child == this && GetViewContainer() && !initialized_) { + if (is_add && child == this && GetContainer() && !initialized_) { Init(); // Make sure not to call Init() twice if we get inserted into a different - // ViewContainer. + // Container. initialized_ = true; } } diff --git a/chrome/browser/views/frame/browser_view2.cc b/chrome/browser/views/frame/browser_view2.cc index b5c4ee7..7ee9567 100644 --- a/chrome/browser/views/frame/browser_view2.cc +++ b/chrome/browser/views/frame/browser_view2.cc @@ -272,7 +272,7 @@ unsigned int BrowserView2::FeaturesForBrowserType(BrowserType::Type type) { void BrowserView2::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(GetViewContainer()->GetHWND(), kBrowserWindowKey, this); + SetProp(GetContainer()->GetHWND(), kBrowserWindowKey, this); LoadAccelerators(); SetAccessibleName(l10n_util::GetString(IDS_PRODUCT_NAME)); @@ -291,7 +291,7 @@ void BrowserView2::Init() { set_contents_view(contents_container_); AddChildView(contents_container_); - status_bubble_.reset(new StatusBubble(GetViewContainer())); + status_bubble_.reset(new StatusBubble(GetContainer())); #ifdef CHROME_PERSONALIZATION EnablePersonalization(CommandLine().HasSwitch(switches::kEnableP13n)); @@ -311,7 +311,7 @@ void BrowserView2::Close() { } void* BrowserView2::GetPlatformID() { - return GetViewContainer()->GetHWND(); + return GetContainer()->GetHWND(); } TabStrip* BrowserView2::GetTabStrip() const { @@ -356,7 +356,7 @@ void BrowserView2::FlashFrame() { void BrowserView2::ContinueDetachConstrainedWindowDrag( const gfx::Point& mouse_point, int frame_component) { - HWND vc_hwnd = GetViewContainer()->GetHWND(); + HWND vc_hwnd = GetContainer()->GetHWND(); if (frame_component == HTCLIENT) { // If the user's mouse was over the content area of the popup when they // clicked down, we need to re-play the mouse down event so as to actually @@ -789,7 +789,7 @@ void BrowserView2::DidChangeBounds(const CRect& previous, void BrowserView2::ViewHierarchyChanged(bool is_add, ChromeViews::View* parent, ChromeViews::View* child) { - if (is_add && child == this && GetViewContainer() && !initialized_) { + if (is_add && child == this && GetContainer() && !initialized_) { Init(); initialized_ = true; } @@ -1072,7 +1072,7 @@ void BrowserView2::LoadAccelerators() { CopyAcceleratorTable(accelerator_table, accelerators, count); ChromeViews::FocusManager* focus_manager = - ChromeViews::FocusManager::GetFocusManager(GetViewContainer()->GetHWND()); + ChromeViews::FocusManager::GetFocusManager(GetContainer()->GetHWND()); DCHECK(focus_manager); // Let's build our own accelerator table. diff --git a/chrome/browser/views/frame/opaque_frame.cc b/chrome/browser/views/frame/opaque_frame.cc index 97b9566..9bf52a3 100644 --- a/chrome/browser/views/frame/opaque_frame.cc +++ b/chrome/browser/views/frame/opaque_frame.cc @@ -63,7 +63,7 @@ void OpaqueFrame::UpdateWindowIcon() { } /////////////////////////////////////////////////////////////////////////////// -// OpaqueFrame, ChromeViews::HWNDViewContainer overrides: +// OpaqueFrame, ChromeViews::ContainerWin overrides: bool OpaqueFrame::AcceleratorPressed(ChromeViews::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 a30b855..f40f1a8 100644 --- a/chrome/browser/views/frame/opaque_frame.h +++ b/chrome/browser/views/frame/opaque_frame.h @@ -41,7 +41,7 @@ class OpaqueFrame : public BrowserFrame, // Overridden from ChromeViews::CustomFrameWindow: virtual void UpdateWindowIcon(); - // Overridden from ChromeViews::HWNDViewContainer: + // Overridden from ChromeViews::ContainerWin: virtual bool AcceleratorPressed(ChromeViews::Accelerator* accelerator); virtual bool GetAccelerator(int cmd_id, ChromeViews::Accelerator* accelerator); diff --git a/chrome/browser/views/frame/opaque_non_client_view.cc b/chrome/browser/views/frame/opaque_non_client_view.cc index 1bbbbfd..72b2215 100644 --- a/chrome/browser/views/frame/opaque_non_client_view.cc +++ b/chrome/browser/views/frame/opaque_non_client_view.cc @@ -660,7 +660,7 @@ void OpaqueNonClientView::ViewHierarchyChanged(bool is_add, ChromeViews::View* parent, ChromeViews::View* child) { if (is_add && child == this) { - DCHECK(GetViewContainer()); + DCHECK(GetContainer()); 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 edba957..bd0c289 100644 --- a/chrome/browser/views/hung_renderer_view.cc +++ b/chrome/browser/views/hung_renderer_view.cc @@ -321,7 +321,7 @@ void HungRendererWarningView::ButtonPressed( void HungRendererWarningView::ViewHierarchyChanged(bool is_add, ChromeViews::View* parent, ChromeViews::View* child) { - if (!initialized_ && is_add && child == this && GetViewContainer()) + if (!initialized_ && is_add && child == this && GetContainer()) Init(); } diff --git a/chrome/browser/views/hwnd_html_view.cc b/chrome/browser/views/hwnd_html_view.cc index 026ebe0..11a7225 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/view_container.h" +#include "chrome/views/container.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 && GetViewContainer() && !initialized_) - Init(GetViewContainer()->GetHWND()); + if (is_add && GetContainer() && !initialized_) + Init(GetContainer()->GetHWND()); } diff --git a/chrome/browser/views/info_bar_item_view.cc b/chrome/browser/views/info_bar_item_view.cc index 1f1d2ab..b7c0d3b 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/view_container.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->GetViewContainer()->GetHWND(); + root_hwnd = root_view->GetContainer()->GetHWND(); if (root_hwnd) { focus_tracker_.reset(new ChromeViews::ExternalFocusTracker( diff --git a/chrome/browser/views/info_bubble.cc b/chrome/browser/views/info_bubble.cc index 938ac49..d059af4 100644 --- a/chrome/browser/views/info_bubble.cc +++ b/chrome/browser/views/info_bubble.cc @@ -107,7 +107,7 @@ void InfoBubble::Init(HWND parent_hwnd, (win_util::GetWinVersion() < win_util::WINVERSION_XP) ? 0 : CS_DROPSHADOW); - HWNDViewContainer::Init(parent_hwnd, bounds, true); + ContainerWin::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. @@ -146,7 +146,7 @@ void InfoBubble::Close() { delegate_->InfoBubbleClosing(this); if (frame) frame->InfoBubbleClosing(); - HWNDViewContainer::Close(); + ContainerWin::Close(); } void InfoBubble::AnimationProgressed(const Animation* animation) { diff --git a/chrome/browser/views/info_bubble.h b/chrome/browser/views/info_bubble.h index e237660..bb8933b 100644 --- a/chrome/browser/views/info_bubble.h +++ b/chrome/browser/views/info_bubble.h @@ -6,7 +6,7 @@ #define CHROME_BROWSER_VIEWS_INFO_BUBBLE_H_ #include "chrome/common/slide_animation.h" -#include "chrome/views/hwnd_view_container.h" +#include "chrome/views/container_win.h" #include "chrome/views/view.h" // InfoBubble is used to display an arbitrary view above all other windows. @@ -30,7 +30,7 @@ class InfoBubbleDelegate { virtual bool CloseOnEscape() = 0; }; -class InfoBubble : public ChromeViews::HWNDViewContainer, +class InfoBubble : public ChromeViews::ContainerWin, 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 fb1fd8e..a49801a 100644 --- a/chrome/browser/views/keyword_editor_view.cc +++ b/chrome/browser/views/keyword_editor_view.cc @@ -585,7 +585,7 @@ void KeywordEditorView::OnDoubleClick() { void KeywordEditorView::ButtonPressed(ChromeViews::NativeButton* sender) { if (sender == add_button_) { EditKeywordController* controller = - new EditKeywordController(GetViewContainer()->GetHWND(), NULL, this, + new EditKeywordController(GetContainer()->GetHWND(), NULL, this, profile_); controller->Show(); } else if (sender == remove_button_) { @@ -625,7 +625,7 @@ void KeywordEditorView::ButtonPressed(ChromeViews::NativeButton* sender) { const TemplateURL* template_url = &table_model_->GetTemplateURL(selected_row); EditKeywordController* controller = - new EditKeywordController(GetViewContainer()->GetHWND(), template_url, + new EditKeywordController(GetContainer()->GetHWND(), template_url, this, profile_); controller->Show(); } else if (sender == enable_suggest_checkbox_) { diff --git a/chrome/browser/views/location_bar_view.cc b/chrome/browser/views/location_bar_view.cc index 8e3a2c5..51081bd 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/view_container.h" #include "generated_resources.h" using ChromeViews::View; @@ -123,7 +123,7 @@ void LocationBarView::Init() { } // URL edit field. - ChromeViews::ViewContainer* vc = GetViewContainer(); + ChromeViews::Container* vc = GetContainer(); DCHECK(vc) << "LocationBarView::Init - vc is NULL!"; location_entry_.reset(new AutocompleteEditView(font_, this, model_, this, vc->GetHWND(), @@ -843,7 +843,7 @@ void LocationBarView::ShowInfoBubbleTask::Run() { if (cancelled_) return; - if (!image_view_->GetViewContainer()->IsActive()) { + if (!image_view_->GetContainer()->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 @@ -864,7 +864,7 @@ void LocationBarView::ShowInfoBubbleTask::Cancel() { void LocationBarView::ShowFirstRunBubbleInternal() { if (!location_entry_view_) return; - if (!location_entry_view_->GetViewContainer()->IsActive()) { + if (!location_entry_view_->GetContainer()->IsActive()) { // The browser is no longer active. Let's not show the info bubble, this // would make the browser the active window again. return; @@ -889,7 +889,7 @@ void LocationBarView::ShowFirstRunBubbleInternal() { bounds.set_x(location.x() - 20); FirstRunBubble::Show( - location_entry_view_->GetRootView()->GetViewContainer()->GetHWND(), + location_entry_view_->GetRootView()->GetContainer()->GetHWND(), bounds); } @@ -962,7 +962,7 @@ void LocationBarView::SecurityImageView::ShowInfoBubble() { label->SetHorizontalAlignment(ChromeViews::Label::ALIGN_LEFT); label->SizeToFit(0); DCHECK(info_bubble_ == NULL); - info_bubble_ = InfoBubble::Show(GetRootView()->GetViewContainer()->GetHWND(), + info_bubble_ = InfoBubble::Show(GetRootView()->GetContainer()->GetHWND(), bounds, label, this); show_info_bubble_task_ = NULL; } @@ -1006,7 +1006,7 @@ bool LocationBarView::SecurityImageView::OnMousePressed( } PageInfoWindow::CreatePageInfo(profile_, nav_entry, - GetRootView()->GetViewContainer()->GetHWND(), + GetRootView()->GetContainer()->GetHWND(), PageInfoWindow::SECURITY); return true; } diff --git a/chrome/browser/views/old_frames/vista_frame.cc b/chrome/browser/views/old_frames/vista_frame.cc index fb934ad..fe1f0b4 100644 --- a/chrome/browser/views/old_frames/vista_frame.cc +++ b/chrome/browser/views/old_frames/vista_frame.cc @@ -38,7 +38,6 @@ #include "chrome/views/aero_tooltip_manager.h" #include "chrome/views/background.h" #include "chrome/views/event.h" -#include "chrome/views/hwnd_view_container.h" #include "chrome/views/hwnd_notification_source.h" #include "chromium_strings.h" @@ -468,7 +467,7 @@ void VistaFrame::Init() { FrameUtil::LoadAccelerators(this, accelerators_table, this); ShelfVisibilityChanged(); - root_view_.OnViewContainerCreated(); + root_view_.OnContainerCreated(); Layout(); } @@ -522,7 +521,7 @@ void VistaFrame::Close() { browser_->OnWindowClosing(); } else { // Empty tab strip, it's now safe to clean-up. - root_view_.OnViewContainerDestroyed(); + root_view_.OnContainerDestroyed(); NotificationService::current()->Notify( NOTIFY_WINDOW_CLOSED, Source<HWND>(m_hWnd), @@ -588,7 +587,7 @@ gfx::Rect VistaFrame::GetBoundsForContentBounds(const gfx::Rect content_rect) { } gfx::Point p; - ChromeViews::View::ConvertPointToViewContainer(tab_contents_container_, &p); + ChromeViews::View::ConvertPointToContainer(tab_contents_container_, &p); CRect bounds; GetBounds(&bounds, true); @@ -1173,7 +1172,7 @@ void VistaFrame::ProcessMouseExited() { //////////////////////////////////////////////////////////////////////////////// // -// ChromeViews::ViewContainer +// ChromeViews::Container // //////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/views/old_frames/vista_frame.h b/chrome/browser/views/old_frames/vista_frame.h index b812db1..5858436 100644 --- a/chrome/browser/views/old_frames/vista_frame.h +++ b/chrome/browser/views/old_frames/vista_frame.h @@ -16,7 +16,7 @@ #include "chrome/browser/browser_window.h" #include "chrome/browser/views/old_frames/frame_view.h" #include "chrome/browser/views/status_bubble.h" -#include "chrome/views/view_container.h" +#include "chrome/views/container.h" #include "chrome/views/root_view.h" #include "chrome/views/hwnd_view.h" #include "chrome/views/image_view.h" @@ -44,7 +44,7 @@ class VistaFrame : public BrowserWindow, CWindow, CWinTraits<WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN>>, - public ChromeViews::ViewContainer, + public ChromeViews::Container, public ChromeViews::AcceleratorTarget { public: // Create a new VistaFrame given the bounds and provided browser. @@ -187,7 +187,7 @@ class VistaFrame : public BrowserWindow, virtual bool IsBookmarkBarVisible() const; //////////////////////////////////////////////////////////////////////////////// - // ChromeViews::ViewContainer + // ChromeViews::Container //////////////////////////////////////////////////////////////////////////////// virtual void GetBounds(CRect *out, bool including_frame) const; diff --git a/chrome/browser/views/old_frames/xp_frame.cc b/chrome/browser/views/old_frames/xp_frame.cc index 2512f63..24f614d 100644 --- a/chrome/browser/views/old_frames/xp_frame.cc +++ b/chrome/browser/views/old_frames/xp_frame.cc @@ -37,7 +37,6 @@ #include "chrome/views/background.h" #include "chrome/views/event.h" #include "chrome/views/focus_manager.h" -#include "chrome/views/hwnd_view_container.h" #include "chrome/views/hwnd_notification_source.h" #include "chrome/views/tooltip_manager.h" #include "chrome/views/view.h" @@ -540,7 +539,7 @@ void XPFrame::Init() { FrameUtil::LoadAccelerators(this, accelerators_table, this); ShelfVisibilityChanged(); - root_view_.OnViewContainerCreated(); + root_view_.OnContainerCreated(); } TabStrip* XPFrame::CreateTabStrip(Browser* browser) { @@ -879,7 +878,7 @@ void XPFrame::Close() { } else { // Empty tab strip, it's now safe to do the final clean-up. - root_view_.OnViewContainerDestroyed(); + root_view_.OnContainerDestroyed(); NotificationService::current()->Notify( NOTIFY_WINDOW_CLOSED, Source<HWND>(m_hWnd), @@ -1794,7 +1793,7 @@ void XPFrame::SetResizeCursor(ResizeMode r_mode) { //////////////////////////////////////////////////////////////////////////////// // -// ViewContainer +// Container // //////////////////////////////////////////////////////////////////////////////// @@ -1814,7 +1813,7 @@ gfx::Rect XPFrame::GetBoundsForContentBounds(const gfx::Rect content_rect) { } gfx::Point p; - ChromeViews::View::ConvertPointToViewContainer(tab_contents_container_, &p); + ChromeViews::View::ConvertPointToContainer(tab_contents_container_, &p); CRect bounds; GetBounds(&bounds, true); diff --git a/chrome/browser/views/old_frames/xp_frame.h b/chrome/browser/views/old_frames/xp_frame.h index 89df94c..b0bb8c9 100644 --- a/chrome/browser/views/old_frames/xp_frame.h +++ b/chrome/browser/views/old_frames/xp_frame.h @@ -16,8 +16,8 @@ #include "chrome/browser/browser_window.h" #include "chrome/browser/views/old_frames/frame_view.h" #include "chrome/browser/views/status_bubble.h" -#include "chrome/views/view_container.h" #include "chrome/views/button.h" +#include "chrome/views/container.h" #include "chrome/views/hwnd_view.h" #include "chrome/views/root_view.h" #include "chrome/views/image_view.h" @@ -52,7 +52,7 @@ class XPFrame : public BrowserWindow, WS_MAXIMIZEBOX | WS_CLIPCHILDREN>>, public ChromeViews::BaseButton::ButtonListener, - public ChromeViews::ViewContainer, + public ChromeViews::Container, public ChromeViews::AcceleratorTarget { public: @@ -156,7 +156,7 @@ class XPFrame : public BrowserWindow, void ButtonPressed(ChromeViews::BaseButton *sender); // - // ViewContainer + // Container virtual void GetBounds(CRect *out, bool including_frame) const; virtual void MoveToFront(bool should_activate); virtual HWND GetHWND() const; diff --git a/chrome/browser/views/options/advanced_contents_view.cc b/chrome/browser/views/options/advanced_contents_view.cc index 0c04dd8..7df768c 100644 --- a/chrome/browser/views/options/advanced_contents_view.cc +++ b/chrome/browser/views/options/advanced_contents_view.cc @@ -505,7 +505,7 @@ void ContentSection::ButtonPressed(ChromeViews::NativeButton* sender) { disable_popup_blocked_notification_pref_.SetValue(!notification_disabled); } else if (sender == gears_settings_button_) { UserMetricsRecordAction(L"Options_GearsSettings", NULL); - GearsSettingsPressed(GetAncestor(GetViewContainer()->GetHWND(), GA_ROOT)); + GearsSettingsPressed(GetAncestor(GetContainer()->GetHWND(), GA_ROOT)); } } diff --git a/chrome/browser/views/options/content_page_view.cc b/chrome/browser/views/options/content_page_view.cc index 510976a..52911a4 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/view_container.h" #include "generated_resources.h" #include "skia/include/SkBitmap.h" @@ -127,7 +127,7 @@ gfx::Size FileDisplayArea::GetPreferredSize() { void FileDisplayArea::ViewHierarchyChanged(bool is_add, ChromeViews::View* parent, ChromeViews::View* child) { - if (!initialized_ && is_add && GetViewContainer()) + if (!initialized_ && is_add && GetContainer()) Init(); } diff --git a/chrome/browser/views/options/fonts_languages_window_view.cc b/chrome/browser/views/options/fonts_languages_window_view.cc index a93fe2c..b147d4e 100644 --- a/chrome/browser/views/options/fonts_languages_window_view.cc +++ b/chrome/browser/views/options/fonts_languages_window_view.cc @@ -75,7 +75,7 @@ gfx::Size FontsLanguagesWindowView::GetPreferredSize() { void FontsLanguagesWindowView::ViewHierarchyChanged( bool is_add, ChromeViews::View* parent, ChromeViews::View* child) { - // Can't init before we're inserted into a ViewContainer, because we require + // Can't init before we're inserted into a Container, because we require // a HWND to parent native child controls to. if (is_add && child == this) Init(); diff --git a/chrome/browser/views/options/fonts_page_view.cc b/chrome/browser/views/options/fonts_page_view.cc index 0dd8bab..7bd8836 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/view_container.h" #include "generated_resources.h" #include "skia/include/SkBitmap.h" @@ -228,7 +228,7 @@ FontsPageView::~FontsPageView() { } void FontsPageView::ButtonPressed(ChromeViews::NativeButton* sender) { - HWND owning_hwnd = GetAncestor(GetViewContainer()->GetHWND(), GA_ROOT); + HWND owning_hwnd = GetAncestor(GetContainer()->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 9a22c74..240bbe3 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/view_container.h" #include "skia/include/SkBitmap.h" #include "unicode/uloc.h" @@ -305,7 +305,7 @@ gfx::Size AddLanguageWindowView::GetPreferredSize() { void AddLanguageWindowView::ViewHierarchyChanged( bool is_add, ChromeViews::View* parent, ChromeViews::View* child) { - // Can't init before we're inserted into a ViewContainer, because we require + // Can't init before we're inserted into a Container, because we require // a HWND to parent native child controls to. if (is_add && child == this) Init(); @@ -503,7 +503,7 @@ void LanguagesPageView::ButtonPressed(ChromeViews::NativeButton* sender) { language_table_edited_ = true; } else if (sender == add_button_) { ChromeViews::Window::CreateChromeWindow( - GetViewContainer()->GetHWND(), + GetContainer()->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 d6ea955..5672397 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/view_container.h" +#include "chrome/views/container.h" /////////////////////////////////////////////////////////////////////////////// // OptionsPageView @@ -43,7 +43,7 @@ void OptionsPageView::Observe(NotificationType type, void OptionsPageView::ViewHierarchyChanged(bool is_add, ChromeViews::View* parent, ChromeViews::View* child) { - if (!initialized_ && is_add && GetViewContainer()) { + if (!initialized_ && is_add && GetContainer()) { // 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 ViewContainer is the TabbedPane content HWND, which is a child HWND. + // Our Container is the TabbedPane content HWND, which is a child HWND. // We need the root HWND for parenting. - return GetAncestor(GetViewContainer()->GetHWND(), GA_ROOT); + return GetAncestor(GetContainer()->GetHWND(), GA_ROOT); } diff --git a/chrome/browser/views/options/options_window_view.cc b/chrome/browser/views/options/options_window_view.cc index 57138f0..4393a7e 100644 --- a/chrome/browser/views/options/options_window_view.cc +++ b/chrome/browser/views/options/options_window_view.cc @@ -172,8 +172,8 @@ gfx::Size OptionsWindowView::GetPreferredSize() { void OptionsWindowView::ViewHierarchyChanged(bool is_add, ChromeViews::View* parent, ChromeViews::View* child) { - // Can't init before we're inserted into a ViewContainer, because we require - // a HWND to parent native child controls to. + // Can't init before we're inserted into a Container, because we require a + // HWND to parent native child controls to. if (is_add && child == this) Init(); } diff --git a/chrome/browser/views/sad_tab_view.h b/chrome/browser/views/sad_tab_view.h index f4ca7f0..2486224 100644 --- a/chrome/browser/views/sad_tab_view.h +++ b/chrome/browser/views/sad_tab_view.h @@ -15,11 +15,11 @@ // A ChromeViews::View subclass used to render the presentation of the crashed // "sad tab" in the browser window when a renderer is destroyed unnaturally. // -// Note that since this view is not (currently) part of a ViewContainer or +// Note that since this view is not (currently) part of a Container or // RootView hierarchy, it cannot respond to events or contain controls that -// do, right now it is used simply to render. Adding an extra ViewContainer to +// do, right now it is used simply to render. Adding an extra Container to // WebContents seemed like a lot of complexity. Ideally, perhaps WebContents' -// view portion would itself become a ViewContainer in the future, then event +// view portion would itself become a Container in the future, then event // processing will work. // /////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/views/shelf_item_dialog.cc b/chrome/browser/views/shelf_item_dialog.cc index f1bbeaa..306922f 100644 --- a/chrome/browser/views/shelf_item_dialog.cc +++ b/chrome/browser/views/shelf_item_dialog.cc @@ -458,7 +458,7 @@ bool ShelfItemDialog::AcceleratorPressed( window()->Close(); } else if (accelerator.GetKeyCode() == VK_RETURN) { ChromeViews::FocusManager* fm = ChromeViews::FocusManager::GetFocusManager( - GetViewContainer()->GetHWND()); + GetContainer()->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 9021634..fab001c 100644 --- a/chrome/browser/views/status_bubble.cc +++ b/chrome/browser/views/status_bubble.cc @@ -14,10 +14,9 @@ #include "chrome/common/gfx/url_elider.h" #include "chrome/common/l10n_util.h" #include "chrome/common/resource_bundle.h" -#include "chrome/views/hwnd_view_container.h" #include "chrome/views/label.h" #include "chrome/views/root_view.h" -#include "chrome/views/view_container.h" +#include "chrome/views/container_win.h" #include "googleurl/src/gurl.h" #include "net/base/net_util.h" #include "SkPaint.h" @@ -69,8 +68,7 @@ class StatusBubble::StatusView : public ChromeViews::Label, public Animation, public AnimationDelegate { public: - StatusView(StatusBubble* status_bubble, - ChromeViews::HWNDViewContainer* popup) + StatusView(StatusBubble* status_bubble, ChromeViews::ContainerWin* popup) : Animation(kFramerate, this), status_bubble_(status_bubble), popup_(popup), @@ -154,7 +152,7 @@ class StatusBubble::StatusView : public ChromeViews::Label, StatusBubble* status_bubble_; // Handle to the HWND that contains us. - ChromeViews::HWNDViewContainer* popup_; + ChromeViews::ContainerWin* popup_; // The currently-displayed text. std::wstring text_; @@ -445,7 +443,7 @@ void StatusBubble::StatusView::Paint(ChromeCanvas* canvas) { // StatusBubble --------------------------------------------------------------- -StatusBubble::StatusBubble(ChromeViews::ViewContainer* frame) +StatusBubble::StatusBubble(ChromeViews::Container* frame) : popup_(NULL), frame_(frame), view_(NULL), @@ -467,7 +465,7 @@ StatusBubble::~StatusBubble() { void StatusBubble::Init() { if (!popup_) { - popup_ = new ChromeViews::HWNDViewContainer(); + popup_ = new ChromeViews::ContainerWin(); 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 c6083f1..28d189c 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/hwnd_view_container.h" -#include "chrome/views/view_container.h" +#include "chrome/views/container.h" +#include "chrome/views/container_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(ChromeViews::ViewContainer* frame); + explicit StatusBubble(ChromeViews::Container* 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). - ChromeViews::HWNDViewContainer* popup_; + ChromeViews::ContainerWin* popup_; double opacity_; - ChromeViews::ViewContainer* frame_; + ChromeViews::Container* 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 0918ccf..a8ed55a 100644 --- a/chrome/browser/views/tab_contents_container_view.cc +++ b/chrome/browser/views/tab_contents_container_view.cc @@ -13,7 +13,7 @@ #include "chrome/browser/tab_contents.h" #include "chrome/browser/view_ids.h" #include "chrome/browser/web_contents.h" -#include "chrome/views/hwnd_view_container.h" +#include "chrome/views/container.h" #include "chrome/views/root_view.h" using ChromeViews::FocusTraversable; @@ -229,8 +229,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()->GetViewContainer()-> - GetHWND()); + FocusManager::GetFocusManager(GetRootView()->GetContainer()->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 bb93238..b174dc8 100644 --- a/chrome/browser/views/tabs/dragged_tab_controller.cc +++ b/chrome/browser/views/tabs/dragged_tab_controller.cc @@ -273,8 +273,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); - ChromeViews::View::ConvertPointToViewContainer(first_tab, - &window_create_point_); + ChromeViews::View::ConvertPointToContainer(first_tab, &window_create_point_); } gfx::Point DraggedTabController::GetWindowCreatePoint() const { @@ -386,7 +385,7 @@ void DraggedTabController::MoveTab(const gfx::Point& screen_point) { TabStrip* DraggedTabController::GetTabStripForPoint( const gfx::Point& screen_point) const { - HWND dragged_hwnd = view_->GetViewContainer()->GetHWND(); + HWND dragged_hwnd = view_->GetContainer()->GetHWND(); HWND other_hwnd = WindowFinder::WindowForPoint(screen_point, dragged_hwnd); if (!other_hwnd) return NULL; @@ -487,7 +486,7 @@ void DraggedTabController::Attach(TabStrip* attached_tabstrip, tab->SetVisible(false); // Move the corresponding window to the front. - attached_tabstrip_->GetViewContainer()->MoveToFront(true); + attached_tabstrip_->GetContainer()->MoveToFront(true); } void DraggedTabController::Detach() { @@ -679,7 +678,7 @@ void DraggedTabController::RevertDrag() { // it has been hidden. if (restore_frame) { if (!restore_bounds_.IsEmpty()) { - HWND frame_hwnd = source_tabstrip_->GetViewContainer()->GetHWND(); + HWND frame_hwnd = source_tabstrip_->GetContainer()->GetHWND(); MoveWindow(frame_hwnd, restore_bounds_.x(), restore_bounds_.y(), restore_bounds_.width(), restore_bounds_.height(), TRUE); } @@ -747,7 +746,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_->GetViewContainer()->GetHWND(); + HWND frame_hwnd = source_tabstrip_->GetContainer()->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 5b43500..2c326ba 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/hwnd_view_container.h" +#include "chrome/views/container_win.h" #include "skia/include/SkShader.h" const int kTransparentAlpha = 200; @@ -38,7 +38,7 @@ DraggedTabView::DraggedTabView(TabContents* datasource, renderer_->UpdateData(datasource); - container_ = new ChromeViews::HWNDViewContainer; + container_ = new ChromeViews::ContainerWin; container_->set_window_style(WS_POPUP); container_->set_window_ex_style( WS_EX_LAYERED | WS_EX_TOPMOST | WS_EX_TOOLWINDOW); @@ -106,7 +106,7 @@ void DraggedTabView::AnimateToBounds(const gfx::Rect& bounds, animation_callback_.reset(callback); RECT wr; - GetWindowRect(GetViewContainer()->GetHWND(), &wr); + GetWindowRect(GetContainer()->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 14ba7ec..0f4d626 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 ChromeViews { -class HWNDViewContainer; +class ContainerWin; } namespace gfx { class Point; @@ -76,7 +76,7 @@ class DraggedTabView : public ChromeViews::View, int ScaleValue(int value); // The window that contains the DraggedTabView. - ChromeViews::HWNDViewContainer* container_; + ChromeViews::ContainerWin* 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 a230c6b..5096565 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/hwnd_view_container.h" +#include "chrome/views/container_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 ChromeViews::HWNDViewContainer; + capture_window_ = new ChromeViews::ContainerWin; 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 4de1d14..d3f79bb 100644 --- a/chrome/browser/views/tabs/hwnd_photobooth.h +++ b/chrome/browser/views/tabs/hwnd_photobooth.h @@ -10,7 +10,7 @@ class ChromeCanvas; namespace ChromeViews { -class HWNDViewContainer; +class ContainerWin; } /////////////////////////////////////////////////////////////////////////////// @@ -50,7 +50,7 @@ class HWNDPhotobooth { void CreateCaptureWindow(HWND initial_hwnd); // The nearly off-screen photo-booth layered window used to hold the HWND. - ChromeViews::HWNDViewContainer* capture_window_; + ChromeViews::ContainerWin* 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 8a6f205..a64a073 100644 --- a/chrome/browser/views/tabs/tab.cc +++ b/chrome/browser/views/tabs/tab.cc @@ -5,12 +5,12 @@ #include "chrome/browser/views/tabs/tab.h" #include "base/gfx/size.h" -#include "chrome/views/view_container.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/gfx/path.h" #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 "generated_resources.h" @@ -53,9 +53,8 @@ class TabContextMenuController : public ChromeViews::MenuDelegate { } void RunMenuAt(int x, int y) { - menu_->RunMenuAt(tab_->GetViewContainer()->GetHWND(), - gfx::Rect(x, y, 0, 0), ChromeViews::MenuItemView::TOPLEFT, - true); + menu_->RunMenuAt(tab_->GetContainer()->GetHWND(), gfx::Rect(x, y, 0, 0), + ChromeViews::MenuItemView::TOPLEFT, true); } private: diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc index 7158bf0..c4e1371 100644 --- a/chrome/browser/views/tabs/tab_strip.cc +++ b/chrome/browser/views/tabs/tab_strip.cc @@ -342,10 +342,9 @@ class RemoveTabAnimation : public TabStrip::TabAnimation { } } - // When the animation completes, we send the ViewContainer a message to - // simulate a mouse moved event at the current mouse position. This tickles - // the Tab the mouse is currently over to show the "hot" state of the close - // button. + // When the animation completes, we send the Container a message to simulate + // a mouse moved event at the current mouse position. This tickles the Tab + // the mouse is currently over to show the "hot" state of the close button. void HighlightCloseButton() { if (tabstrip_->available_width_for_tabs_ == -1 || tabstrip_->IsDragSessionActive()) { @@ -356,7 +355,7 @@ class RemoveTabAnimation : public TabStrip::TabAnimation { POINT pt; GetCursorPos(&pt); - ChromeViews::ViewContainer* vc = tabstrip_->GetViewContainer(); + ChromeViews::Container* vc = tabstrip_->GetContainer(); RECT wr; GetWindowRect(vc->GetHWND(), &wr); pt.x -= wr.left; @@ -837,7 +836,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(GetViewContainer()->GetHWND())) { + if (GetTabCount() > 1 && IsWindowVisible(GetContainer()->GetHWND())) { StartInsertTabAnimation(index); } else { Layout(); @@ -1402,7 +1401,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 ChromeViews::HWNDViewContainer(); + arrow_window = new ChromeViews::ContainerWin(); 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 f30f59b..b00268db 100644 --- a/chrome/browser/views/tabs/tab_strip.h +++ b/chrome/browser/views/tabs/tab_strip.h @@ -9,7 +9,7 @@ #include "chrome/browser/tabs/tab_strip_model.h" #include "chrome/browser/views/tabs/tab.h" #include "chrome/views/button.h" -#include "chrome/views/hwnd_view_container.h" +#include "chrome/views/container_win.h" #include "chrome/views/menu.h" #include "chrome/views/view.h" @@ -342,7 +342,7 @@ class TabStrip : public ChromeViews::View, bool point_down; // Renders the drop indicator. - ChromeViews::HWNDViewContainer* arrow_window; + ChromeViews::ContainerWin* arrow_window; ChromeViews::ImageView* arrow_view; private: diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc index 63dd222..45d4354 100644 --- a/chrome/browser/views/toolbar_view.cc +++ b/chrome/browser/views/toolbar_view.cc @@ -34,9 +34,9 @@ #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/button_dropdown.h" #include "chrome/views/hwnd_view.h" -#include "chrome/views/view_container.h" #include "chrome/views/background.h" #include "chrome/views/label.h" #include "chrome/views/tooltip_manager.h" @@ -365,8 +365,8 @@ void BrowserToolbarView::DidGainFocus() { acc_focused_view_->SetHotTracked(true); // Show the tooltip for the view that got the focus. - if (GetViewContainer()->GetTooltipManager()) { - GetViewContainer()->GetTooltipManager()-> + if (GetContainer()->GetTooltipManager()) { + GetContainer()->GetTooltipManager()-> ShowKeyboardTooltip(acc_focused_view_); } @@ -374,7 +374,7 @@ void BrowserToolbarView::DidGainFocus() { view_index = acc_focused_view_->GetID(); } - HWND hwnd = GetViewContainer()->GetHWND(); + HWND hwnd = GetContainer()->GetHWND(); // Notify Access Technology that there was a change in keyboard focus. ::NotifyWinEvent(EVENT_OBJECT_FOCUS, hwnd, OBJID_CLIENT, @@ -385,8 +385,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 (GetViewContainer() && GetViewContainer()->GetTooltipManager()) - GetViewContainer()->GetTooltipManager()->HideKeyboardTooltip(); + if (GetContainer() && GetContainer()->GetTooltipManager()) + GetContainer()->GetTooltipManager()->HideKeyboardTooltip(); acc_focused_view_ = NULL; } @@ -412,8 +412,8 @@ bool BrowserToolbarView::OnKeyPressed(const ChromeViews::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 (GetViewContainer()->GetTooltipManager()) - GetViewContainer()->GetTooltipManager()->HideKeyboardTooltip(); + if (GetContainer()->GetTooltipManager()) + GetContainer()->GetTooltipManager()->HideKeyboardTooltip(); // Safe to cast, given to above view id check. static_cast<ChromeViews::MenuButton*>(acc_focused_view_)->Activate(); if (!acc_focused_view_) { @@ -446,11 +446,11 @@ bool BrowserToolbarView::OnKeyPressed(const ChromeViews::KeyEvent& e) { // Retrieve information to generate an MSAA focus event. int view_id = acc_focused_view_->GetID(); - HWND hwnd = GetViewContainer()->GetHWND(); + HWND hwnd = GetContainer()->GetHWND(); // Show the tooltip for the view that got the focus. - if (GetViewContainer()->GetTooltipManager()) { - GetViewContainer()->GetTooltipManager()-> + if (GetContainer()->GetTooltipManager()) { + GetContainer()->GetTooltipManager()-> ShowKeyboardTooltip(GetChildViewAt(next_view)); } // Notify Access Technology that there was a change in keyboard focus. @@ -737,6 +737,6 @@ bool BrowserToolbarView::GetAcceleratorInfo(int id, return true; } // Else, we retrieve the accelerator information from the frame. - return GetViewContainer()->GetAccelerator(id, accel); + return GetContainer()->GetAccelerator(id, accel); } diff --git a/chrome/browser/views/user_data_dir_dialog.cc b/chrome/browser/views/user_data_dir_dialog.cc index 90460fb..01d181a 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_->GetViewContainer()->GetHWND(), GA_ROOT); + GetAncestor(message_box_view_->GetContainer()->GetHWND(), GA_ROOT); select_file_dialog_->SelectFile(SelectFileDialog::SELECT_FOLDER, dialog_title, std::wstring(), owning_hwnd, NULL); diff --git a/chrome/browser/web_contents_view_win.cc b/chrome/browser/web_contents_view_win.cc index 82380cd..4891b6f 100644 --- a/chrome/browser/web_contents_view_win.cc +++ b/chrome/browser/web_contents_view_win.cc @@ -47,7 +47,7 @@ WebContentsViewWin::~WebContentsViewWin() { void WebContentsViewWin::CreateView(HWND parent_hwnd, const gfx::Rect& initial_bounds) { set_delete_on_destroy(false); - HWNDViewContainer::Init(parent_hwnd, initial_bounds, false); + ContainerWin::Init(parent_hwnd, initial_bounds, false); // Remove the root view drop target so we can register our own. RevokeDragDrop(GetHWND()); @@ -344,7 +344,7 @@ void WebContentsViewWin::OnWindowPosChanged(WINDOWPOS* window_pos) { } void WebContentsViewWin::OnSize(UINT param, const CSize& size) { - HWNDViewContainer::OnSize(param, size); + ContainerWin::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 459dd6e..36bcbe7 100644 --- a/chrome/browser/web_contents_view_win.h +++ b/chrome/browser/web_contents_view_win.h @@ -6,7 +6,7 @@ #define CHROME_BROWSER_WEB_CONTENTS_VIEW_WIN_H_ #include "chrome/browser/web_contents_view.h" -#include "chrome/views/hwnd_view_container.h" +#include "chrome/views/container_win.h" class InfoBarView; class InfoBarMessageView; @@ -16,7 +16,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 ChromeViews::HWNDViewContainer { + public ChromeViews::ContainerWin { 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 @@ -49,7 +49,7 @@ class WebContentsViewWin : public WebContentsView, private: // Windows events ------------------------------------------------------------ - // Overrides from HWNDViewContainer. + // Overrides from ContainerWin. virtual void OnDestroy(); virtual void OnHScroll(int scroll_type, short position, HWND scrollbar); virtual void OnMouseLeave(); diff --git a/chrome/common/gfx/url_elider.cc b/chrome/common/gfx/url_elider.cc index 1cc92ca..b930557 100644 --- a/chrome/common/gfx/url_elider.cc +++ b/chrome/common/gfx/url_elider.cc @@ -7,7 +7,6 @@ #include "chrome/common/gfx/url_elider.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/views/hwnd_view_container.h" #include "chrome/views/label.h" #include "googleurl/src/gurl.h" #include "net/base/escape.h" diff --git a/chrome/common/gfx/url_elider_unittest.cc b/chrome/common/gfx/url_elider_unittest.cc index 741f351..82feb80 100644 --- a/chrome/common/gfx/url_elider_unittest.cc +++ b/chrome/common/gfx/url_elider_unittest.cc @@ -5,7 +5,6 @@ #include "base/string_util.h" #include "chrome/common/gfx/chrome_font.h" #include "chrome/common/gfx/url_elider.h" -#include "chrome/views/hwnd_view_container.h" #include "chrome/views/label.h" #include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/test/accessibility/accessibility_util.cc b/chrome/test/accessibility/accessibility_util.cc index 82a4121..782ee0a 100644 --- a/chrome/test/accessibility/accessibility_util.cc +++ b/chrome/test/accessibility/accessibility_util.cc @@ -21,7 +21,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_HWNDViewContainer_0") { + if (class_name == L"Chrome_ContainerWin_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 c331a24..967de0c 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_HWNDViewContainer_0") +#define CHROME_HWND_VIEW_CONTAINER _T("Chrome_ContainerWin_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/SConscript b/chrome/views/SConscript index 3963a77..832db30 100644 --- a/chrome/views/SConscript +++ b/chrome/views/SConscript @@ -45,6 +45,7 @@ input_files = [ 'chrome_menu.cc', 'client_view.cc', 'combo_box.cc', + 'container_win.cc', 'custom_frame_window.cc', 'dialog_delegate.cc', 'dialog_client_view.cc', @@ -55,7 +56,6 @@ input_files = [ 'grid_layout.cc', 'group_table_view.cc', 'hwnd_view.cc', - 'hwnd_view_container.cc', 'image_view.cc', 'label.cc', 'layout_manager.cc', diff --git a/chrome/views/accessibility/view_accessibility.cc b/chrome/views/accessibility/view_accessibility.cc index af502fc..838995a 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) { ChromeViews::View* parent = view_->GetParent(); if (!parent) { - // This function can get called during teardown of HWNDViewContainer so - // we should bail out if we fail to get the HWND. - if (!view_->GetViewContainer() || !view_->GetViewContainer()->GetHWND()) { + // This function can get called during teardown of ContainerWin so we + // should bail out if we fail to get the HWND. + if (!view_->GetContainer() || !view_->GetContainer()->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_->GetViewContainer()->GetHWND(), + ::AccessibleObjectFromWindow(view_->GetContainer()->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 cf446d8..7929786 100644 --- a/chrome/views/aero_tooltip_manager.cc +++ b/chrome/views/aero_tooltip_manager.cc @@ -18,7 +18,7 @@ namespace ChromeViews { /////////////////////////////////////////////////////////////////////////////// // AeroTooltipManager, public: -AeroTooltipManager::AeroTooltipManager(ViewContainer* container, HWND parent) +AeroTooltipManager::AeroTooltipManager(Container* container, HWND parent) : TooltipManager(container, parent), initial_delay_(0) { } diff --git a/chrome/views/aero_tooltip_manager.h b/chrome/views/aero_tooltip_manager.h index 136db2e..2f2f29a 100644 --- a/chrome/views/aero_tooltip_manager.h +++ b/chrome/views/aero_tooltip_manager.h @@ -28,7 +28,7 @@ namespace ChromeViews { // TODO(glen): Resolve this with Microsoft. class AeroTooltipManager : public ChromeViews::TooltipManager { public: - AeroTooltipManager(ViewContainer* container, HWND parent); + AeroTooltipManager(Container* container, HWND parent); virtual ~AeroTooltipManager(); 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 699d986..87b1c5a 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/view_container.h" #include "skia/include/SkBitmap.h" #include "generated_resources.h" @@ -534,14 +534,14 @@ enum ScrollBarContextMenuCommands { void BitmapScrollBar::ShowContextMenu(View* source, int x, int y, bool is_mouse_gesture) { - ViewContainer* vc = GetViewContainer(); + Container* vc = GetContainer(); CRect vc_bounds; vc->GetBounds(&vc_bounds, true); gfx::Point temp_pt(x - vc_bounds.left, y - vc_bounds.top); - View::ConvertPointFromViewContainer(this, &temp_pt); + View::ConvertPointFromContainer(this, &temp_pt); context_menu_mouse_position_ = IsHorizontal() ? temp_pt.x() : temp_pt.y(); - Menu menu(this, Menu::TOPLEFT, GetViewContainer()->GetHWND()); + Menu menu(this, Menu::TOPLEFT, GetContainer()->GetHWND()); menu.AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollHere); menu.AppendSeparator(); menu.AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollStart); diff --git a/chrome/views/button.cc b/chrome/views/button.cc index 0cc98ae..4cc1bde 100644 --- a/chrome/views/button.cc +++ b/chrome/views/button.cc @@ -11,8 +11,8 @@ #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/views/view_container.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 a2d473b..bea4001 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/view_container.h" #include "generated_resources.h" @@ -49,7 +49,7 @@ bool ButtonDropDown::OnMousePressed(const ChromeViews::MouseEvent& e) { // Schedule a task that will show the menu. MessageLoop::current()->PostDelayedTask(FROM_HERE, show_menu_factory_.NewRunnableMethod(&ButtonDropDown::ShowDropDownMenu, - GetViewContainer()->GetHWND()), + GetContainer()->GetHWND()), kMenuTimerDelay); } @@ -74,7 +74,7 @@ void ButtonDropDown::OnMouseReleased(const ChromeViews::MouseEvent& e, // update the appearance synchronously. SetState(BS_PUSHED); PaintNow(); - ShowDropDownMenu(GetViewContainer()->GetHWND()); + ShowDropDownMenu(GetContainer()->GetHWND()); } } @@ -92,7 +92,7 @@ bool ButtonDropDown::OnMouseDragged(const ChromeViews::MouseEvent& e) { // it immediately. if (e.y() > y_position_on_lbuttondown_ + dragging_threshold) { show_menu_factory_.RevokeAll(); - ShowDropDownMenu(GetViewContainer()->GetHWND()); + ShowDropDownMenu(GetContainer()->GetHWND()); } } diff --git a/chrome/views/chrome_menu.cc b/chrome/views/chrome_menu.cc index 0b0d4ff..72519d5 100644 --- a/chrome/views/chrome_menu.cc +++ b/chrome/views/chrome_menu.cc @@ -21,7 +21,7 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/os_exchange_data.h" #include "chrome/views/border.h" -#include "chrome/views/hwnd_view_container.h" +#include "chrome/views/container_win.h" #include "chrome/views/root_view.h" #include "generated_resources.h" @@ -517,7 +517,7 @@ class MenuSeparator : public View { class MenuHostRootView : public RootView { public: - explicit MenuHostRootView(ViewContainer* container, + explicit MenuHostRootView(Container* container, SubmenuView* submenu) : RootView(container), submenu_(submenu), @@ -623,7 +623,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 HWNDViewContainer { +class MenuHost : public ContainerWin { public: MenuHost(SubmenuView* submenu) : closed_(false), @@ -647,7 +647,7 @@ class MenuHost : public HWNDViewContainer { const gfx::Rect& bounds, View* contents_view, bool do_capture) { - HWNDViewContainer::Init(parent, bounds, true); + ContainerWin::Init(parent, bounds, true); SetContentsView(contents_view); // We don't want to take focus away from the hosting window. ShowWindow(SW_SHOWNA); @@ -674,11 +674,11 @@ class MenuHost : public HWNDViewContainer { GetRootView()->RemoveAllChildViews(false); closed_ = true; ReleaseCapture(); - HWNDViewContainer::Hide(); + ContainerWin::Hide(); } virtual void OnCaptureChanged(HWND hwnd) { - HWNDViewContainer::OnCaptureChanged(hwnd); + ContainerWin::OnCaptureChanged(hwnd); owns_capture_ = false; #ifdef DEBUG_MENU DLOG(INFO) << "Capture changed"; @@ -2559,7 +2559,7 @@ bool MenuController::IsMenuWindow(MenuItemView* item, HWND window) { if (!item) return false; return ((item->HasSubmenu() && item->GetSubmenu()->IsShowing() && - item->GetSubmenu()->GetViewContainer()->GetHWND() == window) || + item->GetSubmenu()->GetContainer()->GetHWND() == window) || IsMenuWindow(item->GetParentMenuItem(), window)); } diff --git a/chrome/views/chrome_menu.h b/chrome/views/chrome_menu.h index 1c49188..75bec86 100644 --- a/chrome/views/chrome_menu.h +++ b/chrome/views/chrome_menu.h @@ -19,7 +19,7 @@ namespace ChromeViews { -class HWNDViewContainer; +class ContainerWin; class MenuController; class MenuItemView; class SubmenuView; @@ -477,8 +477,8 @@ 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 (an HWNDViewContainer) when the menu is -// shown on screen. +// . Shows and hides the window (a ContainerWin) when the menu is shown on +// screen. // // SubmenuView is itself contained in a MenuScrollViewContainer. // MenuScrollViewContainer handles showing as much of the SubmenuView as the @@ -571,7 +571,7 @@ class SubmenuView : public View { // Parent menu item. MenuItemView* parent_menu_item_; - // HWNDViewContainer subclass used to show the children. + // ContainerWin 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 5072acd..29953cc 100644 --- a/chrome/views/client_view.cc +++ b/chrome/views/client_view.cc @@ -24,7 +24,7 @@ int ClientView::NonClientHitTest(const gfx::Point& point) { gfx::Size ClientView::GetPreferredSize() { // |contents_view_| is allowed to be NULL up until the point where this view - // is attached to a ViewContainer. + // is attached to a Container. if (contents_view_) return contents_view_->GetPreferredSize(); return gfx::Size(); @@ -32,7 +32,7 @@ gfx::Size ClientView::GetPreferredSize() { void ClientView::ViewHierarchyChanged(bool is_add, View* parent, View* child) { if (is_add && child == this) { - DCHECK(GetViewContainer()); + DCHECK(GetContainer()); DCHECK(contents_view_); // |contents_view_| must be valid now! AddChildView(contents_view_); } @@ -44,7 +44,7 @@ void ClientView::DidChangeBounds(const CRect& previous, const CRect& current) { void ClientView::Layout() { // |contents_view_| is allowed to be NULL up until the point where this view - // is attached to a ViewContainer. + // is attached to a Container. if (contents_view_) contents_view_->SetBounds(0, 0, width(), height()); } diff --git a/chrome/views/view_container.h b/chrome/views/container.h index 52ef668..b4d6e29 100644 --- a/chrome/views/view_container.h +++ b/chrome/views/container.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_VIEW_CONTAINER_H_ -#define CHROME_VIEWS_VIEW_CONTAINER_H_ +#ifndef CHROME_VIEWS_CONTAINER_H_ +#define CHROME_VIEWS_CONTAINER_H_ // TODO(maruel): Remove once HWND is abstracted. #include <windows.h> @@ -22,24 +22,23 @@ class Accelerator; ///////////////////////////////////////////////////////////////////////////// // -// ViewContainer class +// Container interface // -// ViewContainer is an abstract class that defines the API that should -// be implemented by a CWindow / HWND implementation in order to host a view +// 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. // -// ViewContainer wraps a hierarchy of View objects (see view.h) that -// implement painting and flexible layout within the bounds of the -// ViewContainer's window. +// 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 ViewContainer is responsible for handling various system events and +// The Container is responsible for handling various system events and // forwarding them to the appropriate view. // ///////////////////////////////////////////////////////////////////////////// -class ViewContainer { +class Container { public: - virtual ~ViewContainer() { } + 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 @@ -68,8 +67,8 @@ class ViewContainer { // Returns whether the view container is the currently active window. virtual bool IsActive() = 0; - // Returns the TooltipManager for this ViewContainer. If this ViewContainer - // does not support tooltips, NULL is returned. + // Returns the TooltipManager for this Container. If this Container does not + // support tooltips, NULL is returned. virtual TooltipManager* GetTooltipManager() { return NULL; } diff --git a/chrome/views/hwnd_view_container.cc b/chrome/views/container_win.cc index 1529085..4506b80 100644 --- a/chrome/views/hwnd_view_container.cc +++ b/chrome/views/container_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/hwnd_view_container.h" +#include "chrome/views/container_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 HWNDViewContainer issuing the current Create. Only valid -// for the life of Create. +// Used to locate the ContainerWin issuing the current Create. Only valid for +// the life of Create. // -// This obviously assumes we only create HWNDViewContainers from the same -// thread, which is currently the case. -static HWNDViewContainer* instance_issuing_create = NULL; +// This obviously assumes we only create ContainerWins from the same thread, +// which is currently the case. +static ContainerWin* instance_issuing_create = NULL; /////////////////////////////////////////////////////////////////////////////// // FillLayout @@ -51,7 +51,7 @@ FillLayout::~FillLayout() { void FillLayout::Layout(View* host) { CRect bounds; - host->GetViewContainer()->GetBounds(&bounds, false); + host->GetContainer()->GetBounds(&bounds, false); if (host->GetChildViewCount() == 0) return; @@ -68,8 +68,8 @@ gfx::Size FillLayout::GetPreferredSize(View* host) { // Window class tracking. // static -const wchar_t* const HWNDViewContainer::kBaseClassName = - L"Chrome_HWNDViewContainer_"; +const wchar_t* const ContainerWin::kBaseClassName = + L"Chrome_ContainerWin_"; // Window class information used for registering unique windows. struct ClassInfo { @@ -113,9 +113,9 @@ static RegisteredClasses* registered_classes = NULL; /////////////////////////////////////////////////////////////////////////////// -// HWNDViewContainer, public +// ContainerWin, public -HWNDViewContainer::HWNDViewContainer() +ContainerWin::ContainerWin() : active_mouse_tracking_flags_(0), has_capture_(false), current_action_(FA_NONE), @@ -133,13 +133,12 @@ HWNDViewContainer::HWNDViewContainer() close_container_factory_(this) { } -HWNDViewContainer::~HWNDViewContainer() { +ContainerWin::~ContainerWin() { MessageLoopForUI::current()->RemoveObserver(this); } -void HWNDViewContainer::Init(HWND parent, - const gfx::Rect& bounds, - bool has_own_focus_manager) { +void ContainerWin::Init(HWND parent, const gfx::Rect& bounds, + bool has_own_focus_manager) { toplevel_ = parent == NULL; if (window_style_ == 0) @@ -166,7 +165,7 @@ void HWNDViewContainer::Init(HWND parent, // The window procedure should have set the data for us. DCHECK(win_util::GetWindowUserData(hwnd_) == this); - root_view_->OnViewContainerCreated(); + root_view_->OnContainerCreated(); if (has_own_focus_manager) { ChromeViews::FocusManager::CreateFocusManager(hwnd_, GetRootView()); @@ -202,10 +201,10 @@ void HWNDViewContainer::Init(HWND parent, ::ImmAssociateContextEx(GetHWND(), NULL, 0); } -void HWNDViewContainer::SetContentsView(View* view) { +void ContainerWin::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 - // ViewContainer pointer is valid. + // Container pointer is valid. root_view_->SetLayoutManager(new FillLayout); if (root_view_->GetChildViewCount() != 0) root_view_->RemoveAllChildViews(true); @@ -218,9 +217,9 @@ void HWNDViewContainer::SetContentsView(View* view) { } /////////////////////////////////////////////////////////////////////////////// -// ChromeViews::ViewContainer +// ChromeViews::Container implementation: -void HWNDViewContainer::GetBounds(CRect *out, bool including_frame) const { +void ContainerWin::GetBounds(CRect *out, bool including_frame) const { if (including_frame) { GetWindowRect(out); } else { @@ -236,7 +235,7 @@ void HWNDViewContainer::GetBounds(CRect *out, bool including_frame) const { } } -void HWNDViewContainer::MoveToFront(bool should_activate) { +void ContainerWin::MoveToFront(bool should_activate) { int flags = SWP_NOMOVE | SWP_NOSIZE; if (!should_activate) { flags |= SWP_NOACTIVATE; @@ -244,11 +243,11 @@ void HWNDViewContainer::MoveToFront(bool should_activate) { SetWindowPos(HWND_NOTOPMOST, 0, 0, 0, 0, flags); } -HWND HWNDViewContainer::GetHWND() const { +HWND ContainerWin::GetHWND() const { return hwnd_; } -void HWNDViewContainer::PaintNow(const CRect& update_rect) { +void ContainerWin::PaintNow(const CRect& update_rect) { if (layered_) { PaintLayeredWindow(); } else if (root_view_->NeedsPainting(false) && IsWindow()) { @@ -276,7 +275,7 @@ void HWNDViewContainer::PaintNow(const CRect& update_rect) { } } -RootView* HWNDViewContainer::GetRootView() { +RootView* ContainerWin::GetRootView() { if (!root_view_.get()) { // First time the root view is being asked for, create it now. root_view_.reset(CreateRootView()); @@ -284,20 +283,20 @@ RootView* HWNDViewContainer::GetRootView() { return root_view_.get(); } -bool HWNDViewContainer::IsVisible() { +bool ContainerWin::IsVisible() { return !!::IsWindowVisible(GetHWND()); } -bool HWNDViewContainer::IsActive() { +bool ContainerWin::IsActive() { return win_util::IsWindowActive(GetHWND()); } -TooltipManager* HWNDViewContainer::GetTooltipManager() { +TooltipManager* ContainerWin::GetTooltipManager() { return tooltip_manager_.get(); } -void HWNDViewContainer::SetLayeredAlpha(BYTE layered_alpha) { +void ContainerWin::SetLayeredAlpha(BYTE layered_alpha) { layered_alpha_ = layered_alpha; // if (hwnd_) @@ -315,7 +314,7 @@ static BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM l_param) { } // static -RootView* HWNDViewContainer::FindRootView(HWND hwnd) { +RootView* ContainerWin::FindRootView(HWND hwnd) { RootView* root_view = reinterpret_cast<RootView*>(GetProp(hwnd, kRootViewWindowProperty)); if (root_view) @@ -327,7 +326,7 @@ RootView* HWNDViewContainer::FindRootView(HWND hwnd) { return root_view; } -void HWNDViewContainer::Close() { +void ContainerWin::Close() { // Let's hide ourselves right away. Hide(); if (close_container_factory_.empty()) { @@ -337,11 +336,11 @@ void HWNDViewContainer::Close() { // dereference us when the callback returns). MessageLoop::current()->PostTask(FROM_HERE, close_container_factory_.NewRunnableMethod( - &HWNDViewContainer::CloseNow)); + &ContainerWin::CloseNow)); } } -void HWNDViewContainer::Hide() { +void ContainerWin::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 @@ -351,7 +350,7 @@ void HWNDViewContainer::Hide() { SWP_NOREPOSITION | SWP_NOSIZE | SWP_NOZORDER); } -void HWNDViewContainer::CloseNow() { +void ContainerWin::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 @@ -363,10 +362,10 @@ void HWNDViewContainer::CloseNow() { /////////////////////////////////////////////////////////////////////////////// // MessageLoop::Observer -void HWNDViewContainer::WillProcessMessage(const MSG& msg) { +void ContainerWin::WillProcessMessage(const MSG& msg) { } -void HWNDViewContainer::DidProcessMessage(const MSG& msg) { +void ContainerWin::DidProcessMessage(const MSG& msg) { if (root_view_->NeedsPainting(true)) { PaintNow(root_view_->GetScheduledPaintRect()); } @@ -375,7 +374,7 @@ void HWNDViewContainer::DidProcessMessage(const MSG& msg) { /////////////////////////////////////////////////////////////////////////////// // FocusTraversable -View* HWNDViewContainer::FindNextFocusableView( +View* ContainerWin::FindNextFocusableView( View* starting_view, bool reverse, Direction direction, bool dont_loop, FocusTraversable** focus_traversable, View** focus_traversable_view) { return root_view_->FindNextFocusableView(starting_view, @@ -386,32 +385,32 @@ View* HWNDViewContainer::FindNextFocusableView( focus_traversable_view); } -FocusTraversable* HWNDViewContainer::GetFocusTraversableParent() { +FocusTraversable* ContainerWin::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 HWNDViewContainer::SetFocusTraversableParent(FocusTraversable* parent) { +void ContainerWin::SetFocusTraversableParent(FocusTraversable* parent) { root_view_->SetFocusTraversableParent(parent); } -View* HWNDViewContainer::GetFocusTraversableParentView() { +View* ContainerWin::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 HWNDViewContainer::SetFocusTraversableParentView(View* parent_view) { +void ContainerWin::SetFocusTraversableParentView(View* parent_view) { root_view_->SetFocusTraversableParentView(parent_view); } /////////////////////////////////////////////////////////////////////////////// // Message handlers -void HWNDViewContainer::OnCaptureChanged(HWND hwnd) { +void ContainerWin::OnCaptureChanged(HWND hwnd) { if (has_capture_) { if (is_mouse_down_) root_view_->ProcessMouseDragCanceled(); @@ -420,10 +419,10 @@ void HWNDViewContainer::OnCaptureChanged(HWND hwnd) { } } -void HWNDViewContainer::OnClose() { - // WARNING: this method is NOT called for all HWNDViewContainers. If you - // need to do cleanup code before HWNDViewContainer is destroyed, put it - // in OnDestroy. +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. NotificationService::current()->Notify( NOTIFY_WINDOW_CLOSED, Source<HWND>(hwnd_), @@ -432,19 +431,18 @@ void HWNDViewContainer::OnClose() { Close(); } -void HWNDViewContainer::OnDestroy() { - root_view_->OnViewContainerDestroyed(); +void ContainerWin::OnDestroy() { + root_view_->OnContainerDestroyed(); RemoveProp(hwnd_, kRootViewWindowProperty); } -LRESULT HWNDViewContainer::OnEraseBkgnd(HDC dc) { +LRESULT ContainerWin::OnEraseBkgnd(HDC dc) { // This is needed for magical win32 flicker ju-ju return 1; } -LRESULT HWNDViewContainer::OnGetObject(UINT uMsg, WPARAM w_param, - LPARAM l_param) { +LRESULT ContainerWin::OnGetObject(UINT uMsg, WPARAM w_param, LPARAM l_param) { LRESULT reference_result = static_cast<LRESULT>(0L); // Accessibility readers will send an OBJID_CLIENT message @@ -490,60 +488,57 @@ LRESULT HWNDViewContainer::OnGetObject(UINT uMsg, WPARAM w_param, return reference_result; } -void HWNDViewContainer::OnKeyDown(TCHAR c, UINT rep_cnt, UINT flags) { +void ContainerWin::OnKeyDown(TCHAR c, UINT rep_cnt, UINT flags) { KeyEvent event(Event::ET_KEY_PRESSED, c, rep_cnt, flags); root_view_->ProcessKeyEvent(event); } -void HWNDViewContainer::OnKeyUp(TCHAR c, UINT rep_cnt, UINT flags) { +void ContainerWin::OnKeyUp(TCHAR c, UINT rep_cnt, UINT flags) { KeyEvent event(Event::ET_KEY_RELEASED, c, rep_cnt, flags); root_view_->ProcessKeyEvent(event); } -void HWNDViewContainer::OnLButtonDown(UINT flags, const CPoint& point) { +void ContainerWin::OnLButtonDown(UINT flags, const CPoint& point) { ProcessMousePressed(point, flags | MK_LBUTTON, false); } -void HWNDViewContainer::OnLButtonUp(UINT flags, const CPoint& point) { +void ContainerWin::OnLButtonUp(UINT flags, const CPoint& point) { ProcessMouseReleased(point, flags | MK_LBUTTON); } -void HWNDViewContainer::OnLButtonDblClk(UINT flags, const CPoint& point) { +void ContainerWin::OnLButtonDblClk(UINT flags, const CPoint& point) { ProcessMousePressed(point, flags | MK_LBUTTON, true); } -void HWNDViewContainer::OnMButtonDown(UINT flags, const CPoint& point) { +void ContainerWin::OnMButtonDown(UINT flags, const CPoint& point) { ProcessMousePressed(point, flags | MK_MBUTTON, false); } -void HWNDViewContainer::OnMButtonUp(UINT flags, const CPoint& point) { +void ContainerWin::OnMButtonUp(UINT flags, const CPoint& point) { ProcessMouseReleased(point, flags | MK_MBUTTON); } -void HWNDViewContainer::OnMButtonDblClk(UINT flags, const CPoint& point) { +void ContainerWin::OnMButtonDblClk(UINT flags, const CPoint& point) { ProcessMousePressed(point, flags | MK_MBUTTON, true); } -LRESULT HWNDViewContainer::OnMouseActivate(HWND window, - UINT hittest_code, - UINT message) { +LRESULT ContainerWin::OnMouseActivate(HWND window, UINT hittest_code, + UINT message) { SetMsgHandled(FALSE); return MA_ACTIVATE; } -void HWNDViewContainer::OnMouseMove(UINT flags, const CPoint& point) { +void ContainerWin::OnMouseMove(UINT flags, const CPoint& point) { ProcessMouseMoved(point, flags, false); } -LRESULT HWNDViewContainer::OnMouseLeave(UINT uMsg, WPARAM w_param, - LPARAM l_param) { +LRESULT ContainerWin::OnMouseLeave(UINT uMsg, WPARAM w_param, LPARAM l_param) { ProcessMouseExited(); return 0; } -LRESULT HWNDViewContainer::OnMouseWheel(UINT flags, - short distance, - const CPoint& point) { +LRESULT ContainerWin::OnMouseWheel(UINT flags, short distance, + const CPoint& point) { MouseWheelEvent e(distance, point.x, point.y, @@ -551,34 +546,31 @@ LRESULT HWNDViewContainer::OnMouseWheel(UINT flags, return root_view_->ProcessMouseWheelEvent(e) ? 0 : 1; } -LRESULT HWNDViewContainer::OnMouseRange(UINT msg, - WPARAM w_param, - LPARAM l_param) { +LRESULT ContainerWin::OnMouseRange(UINT msg, WPARAM w_param, LPARAM l_param) { tooltip_manager_->OnMouse(msg, w_param, l_param); SetMsgHandled(FALSE); return 0; } -void HWNDViewContainer::OnNCLButtonDblClk(UINT flags, const CPoint& point) { +void ContainerWin::OnNCLButtonDblClk(UINT flags, const CPoint& point) { SetMsgHandled(FALSE); } -void HWNDViewContainer::OnNCLButtonDown(UINT flags, const CPoint& point) { +void ContainerWin::OnNCLButtonDown(UINT flags, const CPoint& point) { SetMsgHandled(FALSE); } -void HWNDViewContainer::OnNCLButtonUp(UINT flags, const CPoint& point) { +void ContainerWin::OnNCLButtonUp(UINT flags, const CPoint& point) { SetMsgHandled(FALSE); } -LRESULT HWNDViewContainer::OnNCMouseLeave(UINT uMsg, - WPARAM w_param, - LPARAM l_param) { +LRESULT ContainerWin::OnNCMouseLeave(UINT uMsg, WPARAM w_param, + LPARAM l_param) { ProcessMouseExited(); return 0; } -LRESULT HWNDViewContainer::OnNCMouseMove(UINT flags, const CPoint& point) { +LRESULT ContainerWin::OnNCMouseMove(UINT flags, const CPoint& point) { // NC points are in screen coordinates. CPoint temp = point; MapWindowPoints(HWND_DESKTOP, GetHWND(), &temp, 1); @@ -590,19 +582,19 @@ LRESULT HWNDViewContainer::OnNCMouseMove(UINT flags, const CPoint& point) { return 0; } -void HWNDViewContainer::OnNCRButtonDblClk(UINT flags, const CPoint& point) { +void ContainerWin::OnNCRButtonDblClk(UINT flags, const CPoint& point) { SetMsgHandled(FALSE); } -void HWNDViewContainer::OnNCRButtonDown(UINT flags, const CPoint& point) { +void ContainerWin::OnNCRButtonDown(UINT flags, const CPoint& point) { SetMsgHandled(FALSE); } -void HWNDViewContainer::OnNCRButtonUp(UINT flags, const CPoint& point) { +void ContainerWin::OnNCRButtonUp(UINT flags, const CPoint& point) { SetMsgHandled(FALSE); } -LRESULT HWNDViewContainer::OnNotify(int w_param, NMHDR* l_param) { +LRESULT ContainerWin::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. @@ -616,25 +608,24 @@ LRESULT HWNDViewContainer::OnNotify(int w_param, NMHDR* l_param) { return 0; } -void HWNDViewContainer::OnPaint(HDC dc) { +void ContainerWin::OnPaint(HDC dc) { root_view_->OnPaint(GetHWND()); } -void HWNDViewContainer::OnRButtonDown(UINT flags, const CPoint& point) { +void ContainerWin::OnRButtonDown(UINT flags, const CPoint& point) { ProcessMousePressed(point, flags | MK_RBUTTON, false); } -void HWNDViewContainer::OnRButtonUp(UINT flags, const CPoint& point) { +void ContainerWin::OnRButtonUp(UINT flags, const CPoint& point) { ProcessMouseReleased(point, flags | MK_RBUTTON); } -void HWNDViewContainer::OnRButtonDblClk(UINT flags, const CPoint& point) { +void ContainerWin::OnRButtonDblClk(UINT flags, const CPoint& point) { ProcessMousePressed(point, flags | MK_RBUTTON, true); } -LRESULT HWNDViewContainer::OnSettingChange(UINT msg, - WPARAM w_param, - LPARAM l_param) { +LRESULT ContainerWin::OnSettingChange(UINT msg, WPARAM w_param, + LPARAM l_param) { if (toplevel_) { SetMsgHandled(FALSE); if (w_param != SPI_SETWORKAREA) @@ -647,24 +638,24 @@ LRESULT HWNDViewContainer::OnSettingChange(UINT msg, return 0; } -void HWNDViewContainer::OnSize(UINT param, const CSize& size) { +void ContainerWin::OnSize(UINT param, const CSize& size) { ChangeSize(param, size); } -void HWNDViewContainer::OnThemeChanged() { +void ContainerWin::OnThemeChanged() { // Notify NativeTheme. gfx::NativeTheme::instance()->CloseHandles(); } -void HWNDViewContainer::OnFinalMessage(HWND window) { +void ContainerWin::OnFinalMessage(HWND window) { if (delete_on_destroy_) delete this; } /////////////////////////////////////////////////////////////////////////////// -// HWNDViewContainer, protected +// ContainerWin, protected: -void HWNDViewContainer::TrackMouseEvents(DWORD mouse_tracking_flags) { +void ContainerWin::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) { @@ -688,9 +679,8 @@ void HWNDViewContainer::TrackMouseEvents(DWORD mouse_tracking_flags) { } } -bool HWNDViewContainer::ProcessMousePressed(const CPoint& point, - UINT flags, - bool dbl_click) { +bool ContainerWin::ProcessMousePressed(const CPoint& point, UINT flags, + bool dbl_click) { last_mouse_event_was_move_ = false; MouseEvent mouse_pressed(Event::ET_MOUSE_PRESSED, point.x, @@ -709,7 +699,7 @@ bool HWNDViewContainer::ProcessMousePressed(const CPoint& point, return false; } -void HWNDViewContainer::ProcessMouseDragged(const CPoint& point, UINT flags) { +void ContainerWin::ProcessMouseDragged(const CPoint& point, UINT flags) { last_mouse_event_was_move_ = false; MouseEvent mouse_drag(Event::ET_MOUSE_DRAGGED, point.x, @@ -718,7 +708,7 @@ void HWNDViewContainer::ProcessMouseDragged(const CPoint& point, UINT flags) { root_view_->OnMouseDragged(mouse_drag); } -void HWNDViewContainer::ProcessMouseReleased(const CPoint& point, UINT flags) { +void ContainerWin::ProcessMouseReleased(const CPoint& point, UINT flags) { last_mouse_event_was_move_ = false; MouseEvent mouse_up(Event::ET_MOUSE_RELEASED, point.x, @@ -735,8 +725,8 @@ void HWNDViewContainer::ProcessMouseReleased(const CPoint& point, UINT flags) { root_view_->OnMouseReleased(mouse_up, false); } -void HWNDViewContainer::ProcessMouseMoved(const CPoint &point, UINT flags, - bool is_nonclient) { +void ContainerWin::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. @@ -763,15 +753,15 @@ void HWNDViewContainer::ProcessMouseMoved(const CPoint &point, UINT flags, } } -void HWNDViewContainer::ProcessMouseExited() { +void ContainerWin::ProcessMouseExited() { last_mouse_event_was_move_ = false; root_view_->ProcessOnMouseExited(); // Reset our tracking flag so that future mouse movement over this - // HWNDViewContainer results in a new tracking session. + // ContainerWin results in a new tracking session. active_mouse_tracking_flags_ = 0; } -void HWNDViewContainer::AdjustWindowToFitScreenSize() { +void ContainerWin::AdjustWindowToFitScreenSize() { // Desktop size has changed. Make sure we're still on screen. CRect wr; GetWindowRect(&wr); @@ -799,7 +789,7 @@ void HWNDViewContainer::AdjustWindowToFitScreenSize() { } } -void HWNDViewContainer::ChangeSize(UINT size_param, const CSize& size) { +void ContainerWin::ChangeSize(UINT size_param, const CSize& size) { CRect rect; if (layered_) { GetWindowRect(&rect); @@ -818,20 +808,20 @@ void HWNDViewContainer::ChangeSize(UINT size_param, const CSize& size) { PaintNow(rect); } -RootView* HWNDViewContainer::CreateRootView() { +RootView* ContainerWin::CreateRootView() { return new RootView(this); } /////////////////////////////////////////////////////////////////////////////// -// HWNDViewContainer, private: +// ContainerWin, private: -void HWNDViewContainer::SizeContents(const CRect& window_rect) { +void ContainerWin::SizeContents(const CRect& window_rect) { contents_.reset(new ChromeCanvas(window_rect.Width(), window_rect.Height(), false)); } -void HWNDViewContainer::PaintLayeredWindow() { +void ContainerWin::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. @@ -845,7 +835,7 @@ void HWNDViewContainer::PaintLayeredWindow() { UpdateWindowFromContents(contents_->getTopPlatformDevice().getBitmapDC()); } -void HWNDViewContainer::UpdateWindowFromContents(HDC dib_dc) { +void ContainerWin::UpdateWindowFromContents(HDC dib_dc) { DCHECK(layered_); if (can_update_layered_window_) { CRect wr; @@ -861,7 +851,7 @@ void HWNDViewContainer::UpdateWindowFromContents(HDC dib_dc) { } } -std::wstring HWNDViewContainer::GetWindowClassName() { +std::wstring ContainerWin::GetWindowClassName() { if (!registered_classes) registered_classes = new RegisteredClasses(); ClassInfo class_info(initial_class_style()); @@ -878,7 +868,7 @@ std::wstring HWNDViewContainer::GetWindowClassName() { WNDCLASSEX class_ex; class_ex.cbSize = sizeof(WNDCLASSEX); class_ex.style = class_info.style; - class_ex.lpfnWndProc = &HWNDViewContainer::WndProc; + class_ex.lpfnWndProc = &ContainerWin::WndProc; class_ex.cbClsExtra = 0; class_ex.cbWndExtra = 0; class_ex.hInstance = NULL; @@ -897,20 +887,18 @@ std::wstring HWNDViewContainer::GetWindowClassName() { } // static -LRESULT CALLBACK HWNDViewContainer::WndProc(HWND window, - UINT message, - WPARAM w_param, - LPARAM l_param) { +LRESULT CALLBACK ContainerWin::WndProc(HWND window, UINT message, + WPARAM w_param, LPARAM l_param) { if (message == WM_NCCREATE) { CREATESTRUCT* cs = reinterpret_cast<CREATESTRUCT*>(l_param); - HWNDViewContainer* vc = - reinterpret_cast<HWNDViewContainer*>(cs->lpCreateParams); + ContainerWin* vc = + reinterpret_cast<ContainerWin*>(cs->lpCreateParams); DCHECK(vc); win_util::SetWindowUserData(window, vc); vc->hwnd_ = window; return TRUE; } - HWNDViewContainer* vc = reinterpret_cast<HWNDViewContainer*>( + ContainerWin* vc = reinterpret_cast<ContainerWin*>( win_util::GetWindowUserData(window)); if (!vc) return 0; diff --git a/chrome/views/hwnd_view_container.h b/chrome/views/container_win.h index 2df9622..0a8861a 100644 --- a/chrome/views/hwnd_view_container.h +++ b/chrome/views/container_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_HWND_VIEW_CONTAINER_H_ -#define CHROME_VIEWS_HWND_VIEW_CONTAINER_H_ +#ifndef CHROME_VIEWS_CONTAINER_WIN_H_ +#define CHROME_VIEWS_CONTAINER_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/view_container.h" +#include "chrome/views/container.h" class ChromeCanvas; @@ -68,15 +68,15 @@ class FillLayout : public LayoutManager { /////////////////////////////////////////////////////////////////////////////// // -// HWNDViewContainer +// ContainerWin // A container for a ChromeViews 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 ViewContainer contains a RootView which owns the hierarchy of -// ChromeViews within it. As long as ChromeViews 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. +// This Container contains a RootView which owns the hierarchy of ChromeViews +// within it. As long as ChromeViews 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 @@ -85,31 +85,31 @@ class FillLayout : public LayoutManager { // this <controller>-<view>-<platform-specific-view> separation. // /////////////////////////////////////////////////////////////////////////////// -class HWNDViewContainer : public ViewContainer, - public MessageLoopForUI::Observer, - public FocusTraversable, - public AcceleratorTarget { +class ContainerWin : public Container, + public MessageLoopForUI::Observer, + public FocusTraversable, + public AcceleratorTarget { public: - HWNDViewContainer(); - virtual ~HWNDViewContainer(); + ContainerWin(); + virtual ~ContainerWin(); // Initialize the container with a parent and an initial desired size. // |contents_view| is the view that will be the single child of RootView - // within this ViewContainer. 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 contents as the window is sized. + // within this Container. 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 + // contents as the window is sized. // If |has_own_focus_manager| is true, the focus traversal stay confined to // the window. void Init(HWND parent, const gfx::Rect& bounds, bool has_own_focus_manager); - // Sets the specified view as the contents of this HWNDViewContainer. There - // can only be one contnets view child of this ViewContainer'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 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. virtual void SetContentsView(View* view); // Sets the window styles. This is ONLY used when the window is created. @@ -155,11 +155,11 @@ class HWNDViewContainer : public ViewContainer, virtual void Hide(); // Closes the window synchronously. Note that this should not be called from - // an ATL message callback as it deletes the HWNDDViewContainer and ATL will + // an ATL message callback as it deletes the ContainerWin and ATL will // dereference it after the callback is processed. void CloseNow(); - // All classes registered by HWNDViewContainer start with this name. + // All classes registered by ContainerWin start with this name. static const wchar_t* const kBaseClassName; BEGIN_MSG_MAP_EX(0) @@ -237,7 +237,7 @@ class HWNDViewContainer : public ViewContainer, MSG_WM_WINDOWPOSCHANGED(OnWindowPosChanged) END_MSG_MAP() - // Overridden from ViewContainer: + // Overridden from Container: virtual void GetBounds(CRect *out, bool including_frame) const; virtual void MoveToFront(bool should_activate); virtual HWND GetHWND() const; @@ -478,7 +478,7 @@ class HWNDViewContainer : public ViewContainer, virtual RootView* CreateRootView(); - // Returns true if this HWNDViewContainer is opaque. + // Returns true if this ContainerWin is opaque. bool opaque() const { return opaque_; } // The root of the View hierarchy attached to this window. @@ -511,7 +511,7 @@ class HWNDViewContainer : public ViewContainer, // so that subclasses can do any cleanup they need to. void OnDestroyImpl(); - // The windows procedure used by all HWNDViewContainers. + // The windows procedure used by all ContainerWins. static LRESULT CALLBACK WndProc(HWND window, UINT message, WPARAM w_param, @@ -521,9 +521,9 @@ class HWNDViewContainer : public ViewContainer, // If necessary, this registers the window class. std::wstring GetWindowClassName(); - // The following factory is used for calls to close the HWNDViewContainer + // The following factory is used for calls to close the ContainerWin // instance. - ScopedRunnableMethodFactory<HWNDViewContainer> close_container_factory_; + ScopedRunnableMethodFactory<ContainerWin> close_container_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 @@ -582,5 +582,5 @@ class HWNDViewContainer : public ViewContainer, } // namespace ChromeViews -#endif // #ifndef CHROME_VIEWS_HWND_VIEW_CONTAINER_H_ +#endif // #ifndef CHROME_VIEWS_CONTAINER_WIN_H_ diff --git a/chrome/views/custom_frame_window.cc b/chrome/views/custom_frame_window.cc index 046210a..9bd9758 100644 --- a/chrome/views/custom_frame_window.cc +++ b/chrome/views/custom_frame_window.cc @@ -525,9 +525,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 ViewContainer so that if we are + // 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 && GetViewContainer() && child == this) + if (is_add && GetContainer() && child == this) AddChildView(container_->client_view()); } @@ -920,7 +920,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. - HWNDViewContainer::SetContentsView(non_client_view_); + ContainerWin::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. } @@ -970,7 +970,7 @@ void CustomFrameWindow::SizeWindowToDefault() { } /////////////////////////////////////////////////////////////////////////////// -// CustomFrameWindow, HWNDViewContainer overrides: +// CustomFrameWindow, ContainerWin overrides: void CustomFrameWindow::OnGetMinMaxInfo(MINMAXINFO* minmax_info) { // We handle this message so that we can make sure we interact nicely with diff --git a/chrome/views/custom_frame_window.h b/chrome/views/custom_frame_window.h index b1812a0..fbaff21 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 HWNDViewContainer: + // Overridden from ContainerWin: virtual void OnGetMinMaxInfo(MINMAXINFO* minmax_info); virtual void OnInitMenu(HMENU menu); virtual void OnMouseLeave(); diff --git a/chrome/views/dialog_client_view.cc b/chrome/views/dialog_client_view.cc index 2435644..559bc2e 100644 --- a/chrome/views/dialog_client_view.cc +++ b/chrome/views/dialog_client_view.cc @@ -226,7 +226,7 @@ void DialogClientView::ViewHierarchyChanged(bool is_add, View* parent, View* chi if (is_add && child == this) { // Can only add and update the dialog buttons _after_ they are added to the // view hierarchy since they are native controls and require the - // ViewContainer's HWND. + // Container's HWND. ShowDialogButtons(); ClientView::ViewHierarchyChanged(is_add, parent, child); UpdateDialogButtons(); diff --git a/chrome/views/focus_manager.cc b/chrome/views/focus_manager.cc index 8af3542..397a4a8 100644 --- a/chrome/views/focus_manager.cc +++ b/chrome/views/focus_manager.cc @@ -9,10 +9,10 @@ #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_container.h" #include "chrome/views/view_storage.h" // The following keys are used in SetProp/GetProp to associate additional @@ -304,7 +304,7 @@ 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 HWNDViewContainer::Close + // 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 @@ -425,7 +425,7 @@ bool FocusManager::ContainsView(View* view) { if (!root_view) return false; - ViewContainer* view_container = root_view->GetViewContainer(); + Container* view_container = root_view->GetContainer(); if (!view_container) return false; @@ -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 HWNDViewContainers for example. + // This is the case with ContainerWins 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 dc80253..e12457f 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 HWNDViewContainer, the +// When creating a top window, if it derives from ContainerWin, 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 HWNDViewContainer or one of its +// in that window). If you are not deriving from ContainerWin 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 HWNDViewContainer as its native +// by adding a NativeControl that contains a ContainerWin 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 78d02b4..3eba191 100644 --- a/chrome/views/focus_manager_unittest.cc +++ b/chrome/views/focus_manager_unittest.cc @@ -14,7 +14,7 @@ #include "chrome/views/background.h" #include "chrome/views/border.h" #include "chrome/views/checkbox.h" -#include "chrome/views/hwnd_view_container.h" +#include "chrome/views/container_win.h" #include "chrome/views/label.h" #include "chrome/views/link.h" #include "chrome/views/native_button.h" @@ -114,7 +114,7 @@ class BorderView : public ChromeViews::NativeControl { 0, 0, width(), height(), parent_container, NULL, NULL, NULL); // Create the view container which is a child of the TabControl. - view_container_ = new ChromeViews::HWNDViewContainer(); + view_container_ = new ChromeViews::ContainerWin(); view_container_->Init(tab_control, gfx::Rect(), false); view_container_->SetContentsView(child_); view_container_->SetFocusTraversableParentView(this); @@ -162,12 +162,12 @@ private: } View* child_; - ChromeViews::HWNDViewContainer* view_container_; + ChromeViews::ContainerWin* view_container_; DISALLOW_EVIL_CONSTRUCTORS(BorderView); }; -class TestViewWindow : public ChromeViews::HWNDViewContainer { +class TestViewWindow : public ChromeViews::ContainerWin { public: explicit TestViewWindow(FocusManagerTest* test); ~TestViewWindow() { } @@ -239,7 +239,7 @@ void TestViewWindow::Init() { contents_->SetBackground( ChromeViews::Background::CreateSolidBackground(255, 255, 255)); - HWNDViewContainer::Init(NULL, bounds, true); + ContainerWin::Init(NULL, bounds, true); SetContentsView(contents_); ChromeViews::CheckBox* cb = diff --git a/chrome/views/hwnd_view.cc b/chrome/views/hwnd_view.cc index 3550278..6c66851 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/view_container.h" #include "base/logging.h" namespace ChromeViews { @@ -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_, GetViewContainer()->GetHWND()); + ::SetParent(hwnd_, GetContainer()->GetHWND()); UpdateHWNDBounds(); // Register with the focus manager so the associated view is focused when the @@ -66,12 +66,12 @@ void HWNDView::UpdateHWNDBounds() { if (!hwnd_) return; - // Since HWNDs know nothing about the View hierarchy (they are direct children - // of the ViewContainer that hosts our View hierarchy) they need to be - // positioned in the coordinate system of the ViewContainer, not the current + // 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 // view. gfx::Point top_left; - ConvertPointToViewContainer(this, &top_left); + ConvertPointToContainer(this, &top_left); gfx::Rect vis_bounds = GetVisibleBounds(); bool visible = !vis_bounds.IsEmpty(); @@ -150,7 +150,7 @@ gfx::Size HWNDView::GetPreferredSize() { void HWNDView::ViewHierarchyChanged(bool is_add, View *parent, View *child) { if (hwnd_) { - ViewContainer* vc = GetViewContainer(); + Container* vc = GetContainer(); if (is_add && vc) { HWND parent = ::GetParent(hwnd_); HWND vc_hwnd = vc->GetHWND(); diff --git a/chrome/views/label.cc b/chrome/views/label.cc index f6ce601..d918cd5 100644 --- a/chrome/views/label.cc +++ b/chrome/views/label.cc @@ -15,7 +15,7 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/resource_bundle.h" #include "chrome/views/background.h" -#include "chrome/views/view_container.h" +#include "chrome/views/container.h" namespace ChromeViews { diff --git a/chrome/views/menu_button.cc b/chrome/views/menu_button.cc index a7eeb46..847239a 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/view_container.h" #include "generated_resources.h" @@ -102,7 +102,7 @@ void MenuButton::Paint(ChromeCanvas* canvas, bool for_drag) { //////////////////////////////////////////////////////////////////////////////// int MenuButton::GetMaximumScreenXCoordinate() { - ViewContainer* vc = GetViewContainer(); + Container* vc = GetContainer(); if (!vc) { NOTREACHED(); @@ -156,7 +156,7 @@ bool MenuButton::Activate() { menu_visible_ = true; menu_delegate_->RunMenu(this, menu_position.ToPOINT(), - GetViewContainer()->GetHWND()); + GetContainer()->GetHWND()); menu_visible_ = false; menu_closed_time_ = Time::Now(); diff --git a/chrome/views/native_control.cc b/chrome/views/native_control.cc index db0403d..5c14c57 100644 --- a/chrome/views/native_control.cc +++ b/chrome/views/native_control.cc @@ -12,8 +12,8 @@ #include "base/win_util.h" #include "chrome/common/l10n_util.h" #include "chrome/views/border.h" +#include "chrome/views/container.h" #include "chrome/views/focus_manager.h" -#include "chrome/views/view_container.h" #include "chrome/views/hwnd_view.h" #include "chrome/views/background.h" #include "base/gfx/native_theme.h" @@ -36,7 +36,7 @@ class NativeControlContainer : public CWindowImpl<NativeControlContainer, explicit NativeControlContainer(NativeControl* parent) : parent_(parent), control_(NULL) { - Create(parent->GetViewContainer()->GetHWND()); + Create(parent->GetContainer()->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 && GetViewContainer()) { + if (is_add && GetContainer()) { ValidateNativeControl(); Layout(); } } void NativeControl::Layout() { - if (!container_ && GetViewContainer()) + if (!container_ && GetContainer()) ValidateNativeControl(); if (hwnd_view_) { diff --git a/chrome/views/native_scroll_bar.cc b/chrome/views/native_scroll_bar.cc index 6058646..53c5189 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/view_container.h" namespace ChromeViews { @@ -30,7 +30,7 @@ class ScrollBarContainer : public CWindowImpl<ScrollBarContainer, public: ScrollBarContainer(ScrollBar* parent) : parent_(parent), scrollbar_(NULL) { - Create(parent->GetViewContainer()->GetHWND()); + Create(parent->GetContainer()->GetHWND()); ::ShowWindow(m_hWnd, SW_SHOW); } @@ -126,7 +126,7 @@ 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) { - ViewContainer* vc = parent_->GetViewContainer(); + Container* vc = parent_->GetContainer(); if (vc && vc->GetHWND() != GetFocus()) { parent_->RequestFocus(); } @@ -227,8 +227,8 @@ NativeScrollBar::~NativeScrollBar() { void NativeScrollBar::ViewHierarchyChanged(bool is_add, View *parent, View *child) { - ViewContainer* vc; - if (is_add && (vc = GetViewContainer()) && !sb_view_) { + Container* vc; + if (is_add && (vc = GetContainer()) && !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 c5b1979..5e7beff 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/view_container.h" +#include "chrome/views/container.h" namespace ChromeViews { @@ -51,8 +51,8 @@ const char RootView::kViewClassName[] = "chrome/views/RootView"; // ///////////////////////////////////////////////////////////////////////////// -RootView::RootView(ViewContainer* view_container) - : view_container_(view_container), +RootView::RootView(Container* container) + : container_(container), invalid_rect_(0,0,0,0), mouse_pressed_handler_(NULL), mouse_move_handler_(NULL), @@ -178,7 +178,7 @@ void RootView::PaintNow() { } if (!paint_task_needed_) return; - ViewContainer* vc = GetViewContainer(); + Container* vc = GetContainer(); if (vc) vc->PaintNow(invalid_rect_); } @@ -216,8 +216,8 @@ CRect RootView::GetScheduledPaintRectConstrainedToSize() { // ///////////////////////////////////////////////////////////////////////////// -ViewContainer* RootView::GetViewContainer() const { - return view_container_; +Container* RootView::GetContainer() const { + return container_; } ///////////////////////////////////////////////////////////////////////////// @@ -315,7 +315,7 @@ bool RootView::OnMousePressed(const MouseEvent& e) { mouse_pressed_handler_ = NULL; if (focus_on_mouse_pressed_) { - HWND hwnd = view_container_->GetHWND(); + HWND hwnd = container_->GetHWND(); if (::GetFocus() != hwnd) { ::SetFocus(hwnd); } @@ -331,7 +331,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_->GetViewContainer()) { + if (mouse_pressed_handler_->GetContainer()) { *p = l; ConvertPointToScreen(this, p); ConvertPointToView(NULL, mouse_pressed_handler_, p); @@ -463,17 +463,17 @@ void RootView::SetMouseHandler(View *new_mh) { mouse_pressed_handler_ = new_mh; } -void RootView::OnViewContainerCreated() { +void RootView::OnContainerCreated() { DCHECK(!drop_target_.get()); drop_target_ = new RootViewDropTarget(this); } -void RootView::OnViewContainerDestroyed() { +void RootView::OnContainerDestroyed() { if (drop_target_.get()) { - RevokeDragDrop(GetViewContainer()->GetHWND()); + RevokeDragDrop(GetContainer()->GetHWND()); drop_target_ = NULL; } - view_container_ = NULL; + container_ = NULL; } void RootView::ProcessMouseDragCanceled() { @@ -493,7 +493,7 @@ void RootView::FocusView(View* view) { if (view != GetFocusedView()) { FocusManager* focus_manager = GetFocusManager(); DCHECK(focus_manager) << "No Focus Manager for Window " << - (GetViewContainer() ? GetViewContainer()->GetHWND() : 0); + (GetContainer() ? GetContainer()->GetHWND() : 0); if (!focus_manager) return; diff --git a/chrome/views/root_view.h b/chrome/views/root_view.h index 99d744b..14a3977 100644 --- a/chrome/views/root_view.h +++ b/chrome/views/root_view.h @@ -11,7 +11,7 @@ namespace ChromeViews { -class ViewContainer; +class Container; class PaintTask; class RootViewDropTarget; @@ -31,11 +31,11 @@ class FocusListener { // RootView class // // The RootView is the root of a View hierarchy. Its parent is not -// necessarily a ViewContainer, but the ViewContainer's View child is -// always a RootView. +// necessarily a Container, but the Container's View child is always a +// RootView. // // The RootView manages the View hierarchy's interface with the -// ViewContainer, and also maintains the current invalid rect - the region +// Container, and also maintains the current invalid rect - the region // that needs repainting. // ///////////////////////////////////////////////////////////////////////////// @@ -44,7 +44,7 @@ class RootView : public View, public: static const char kViewClassName[]; - explicit RootView(ViewContainer* view_container); + explicit RootView(Container* container); virtual ~RootView(); @@ -71,7 +71,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 ViewContainer to discover what rectangle should be + // Invoked by the Container to discover what rectangle should be // painted const CRect& GetScheduledPaintRect(); @@ -80,8 +80,8 @@ class RootView : public View, // Tree functions - // Get the ViewContainer that hosts this View. - virtual ViewContainer* GetViewContainer() const; + // Get the Container that hosts this View. + virtual Container* GetContainer() const; // The following event methods are overridden to propagate event to the // control tree @@ -91,19 +91,19 @@ class RootView : public View, virtual void OnMouseMoved(const MouseEvent& e); virtual void SetMouseHandler(View* new_mouse_handler); - // Invoked when the ViewContainers has been fully initialized. - // At the time the constructor is invoked the ViewContainer may not be + // 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 OnViewContainerCreated(); + void OnContainerCreated(); - // Invoked prior to the ViewContainer being destroyed. - void OnViewContainerDestroyed(); + // Invoked prior to the Container being destroyed. + void OnContainerDestroyed(); - // Invoked By the ViewContainer if the mouse drag is interrupted by + // Invoked By the Container if the mouse drag is interrupted by // the system. Invokes OnMouseReleased with a value of true for canceled. void ProcessMouseDragCanceled(); - // Invoked by the ViewContainer instance when the mouse moves outside of + // Invoked by the Container instance when the mouse moves outside of // the container bounds virtual void ProcessOnMouseExited(); @@ -167,10 +167,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 ViewContainers. + // to invoke this. This is primarily intended for Containers. void ClearPaintRect(); - // Invoked from the ViewContainer to service a WM_PAINT call. + // Invoked from the Container 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 +202,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 ViewContainer. In that case, the + // mouse handler is not connected to a Container. In that case, the // conversion cannot take place and *p is unchanged bool ConvertPointToMouseHandler(const gfx::Point& l, gfx::Point *p); @@ -267,8 +267,8 @@ class RootView : public View, // The view currently handling enter / exit View* mouse_move_handler_; - // The host ViewContainer - ViewContainer* view_container_; + // The host Container + Container* container_; // The rectangle that should be painted CRect invalid_rect_; diff --git a/chrome/views/root_view_drop_target.cc b/chrome/views/root_view_drop_target.cc index fae3265..a58320c 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/view_container.h" namespace ChromeViews { RootViewDropTarget::RootViewDropTarget(RootView* root_view) - : BaseDropTarget(root_view->GetViewContainer()->GetHWND()), + : BaseDropTarget(root_view->GetContainer()->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 473f1db..3d87ca8 100644 --- a/chrome/views/tabbed_pane.cc +++ b/chrome/views/tabbed_pane.cc @@ -16,7 +16,7 @@ #include "chrome/common/stl_util-inl.h" #include "chrome/common/throb_animation.h" #include "chrome/views/background.h" -#include "chrome/views/hwnd_view_container.h" +#include "chrome/views/container_win.h" #include "chrome/views/root_view.h" #include "skia/include/SkColor.h" @@ -166,7 +166,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 HWNDViewContainer(); + content_window_ = new ContainerWin(); 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 16cc575..d518a4e 100644 --- a/chrome/views/tabbed_pane.h +++ b/chrome/views/tabbed_pane.h @@ -12,7 +12,7 @@ namespace ChromeViews { // 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 HWNDViewContainer; +class ContainerWin; class TabbedPane : public NativeControl { public: @@ -75,7 +75,7 @@ class TabbedPane : public NativeControl { std::vector<View*> tab_views_; // The window displayed in the tab. - HWNDViewContainer* content_window_; + ContainerWin* 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 21ada1f..ab33ebf 100644 --- a/chrome/views/table_view.cc +++ b/chrome/views/table_view.cc @@ -15,8 +15,8 @@ #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 "chrome/views/view_container.h" #include "SkBitmap.h" #include "SkColorFilter.h" diff --git a/chrome/views/text_button.cc b/chrome/views/text_button.cc index c1631ff..91e2e9808 100644 --- a/chrome/views/text_button.cc +++ b/chrome/views/text_button.cc @@ -10,9 +10,9 @@ #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" -#include "chrome/views/view_container.h" #include "generated_resources.h" diff --git a/chrome/views/text_field.cc b/chrome/views/text_field.cc index 6968b2b..2991040 100644 --- a/chrome/views/text_field.cc +++ b/chrome/views/text_field.cc @@ -20,9 +20,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/view_container.h" #include "generated_resources.h" @@ -248,7 +248,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_->GetViewContainer()->GetHWND(), r, NULL, style, ex_style); + Create(parent_->GetContainer()->GetHWND(), r, NULL, style, ex_style); // Set up the text_object_model_. CComPtr<IRichEditOle> ole_interface; @@ -800,9 +800,9 @@ TextField::~TextField() { } void TextField::ViewHierarchyChanged(bool is_add, View* parent, View* child) { - ViewContainer* vc; + Container* vc; - if (is_add && (vc = GetViewContainer())) { + if (is_add && (vc = GetContainer())) { // 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 e4ea574..aa37cf3 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/view_container.h" +#include "chrome/views/container.h" namespace ChromeViews { @@ -76,8 +76,8 @@ const std::wstring& TooltipManager::GetLineSeparator() { return *separator; } -TooltipManager::TooltipManager(ViewContainer* container, HWND parent) - : view_container_(container), +TooltipManager::TooltipManager(Container* container, HWND parent) + : container_(container), parent_(parent), last_mouse_x_(-1), last_mouse_y_(-1), @@ -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 = view_container_->GetRootView(); + RootView* root_view = container_->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(view_container_->GetRootView(), + View::ConvertPointToView(container_->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(view_container_->GetRootView(), + View::ConvertPointToView(container_->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(view_container_->GetRootView(), &screen_loc); + View::ConvertPointToScreen(container_->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 = view_container_->GetRootView(); + RootView* root_view = container_->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; - view_container_->GetBounds(&frame_bounds, true); + container_->GetBounds(&frame_bounds, true); x -= frame_bounds.left; y -= frame_bounds.top; } @@ -385,8 +385,8 @@ void TooltipManager::ShowKeyboardTooltip(View* focused_view) { gfx::Point screen_point; focused_view->ConvertPointToScreen(focused_view, &screen_point); gfx::Point relative_point_coordinates; - focused_view->ConvertPointToViewContainer(focused_view, - &relative_point_coordinates); + focused_view->ConvertPointToContainer(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 cb793fa..b48ddeb 100644 --- a/chrome/views/tooltip_manager.h +++ b/chrome/views/tooltip_manager.h @@ -13,11 +13,11 @@ class ChromeFont; namespace ChromeViews { +class Container; class View; -class ViewContainer; // TooltipManager takes care of the wiring to support tooltips for Views. -// This class is intended to be used by ViewContainers. To use this, you must +// This class is intended to be used by Containers. 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 ViewContainer and parent window. - TooltipManager(ViewContainer* container, HWND parent); + // Creates a TooltipManager for the specified Container and parent window. + TooltipManager(Container* container, HWND parent); virtual ~TooltipManager(); // Notification that the view hierarchy has changed in some way. @@ -122,7 +122,7 @@ class TooltipManager { void DestroyKeyboardTooltipWindow(HWND window_to_destroy); // Hosting view container. - ViewContainer* view_container_; + Container* container_; // 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 662f7194..2dca467 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/view_container.h" namespace ChromeViews { @@ -411,7 +411,7 @@ bool TreeView::OnKeyDown(int virtual_key_code) { } return true; } else if (virtual_key_code == VK_RETURN && !process_enter_) { - ViewContainer* vc = GetViewContainer(); + Container* vc = GetContainer(); DCHECK(vc); FocusManager* fm = FocusManager::GetFocusManager(vc->GetHWND()); DCHECK(fm); diff --git a/chrome/views/view.cc b/chrome/views/view.cc index cbb1b25..6b8f53e 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/view_container.h" #include "SkShader.h" namespace ChromeViews { @@ -323,7 +323,7 @@ void View::SetFocusable(bool focusable) { } FocusManager* View::GetFocusManager() { - ViewContainer* container = GetViewContainer(); + Container* container = GetContainer(); if (!container) return NULL; @@ -803,14 +803,14 @@ View* View::GetViewForPoint(const gfx::Point& point, return this; } -ViewContainer* View::GetViewContainer() const { +Container* View::GetContainer() const { // The root view holds a reference to this view hierarchy's container. - return parent_ ? parent_->GetViewContainer() : NULL; + return parent_ ? parent_->GetContainer() : NULL; } // Get the containing RootView RootView* View::GetRootView() { - ViewContainer* vc = GetViewContainer(); + Container* vc = GetContainer(); if (vc) { return vc->GetRootView(); } else { @@ -1319,7 +1319,7 @@ void View::ConvertPointToView(View* src, View* dst, gfx::Point* point, // If src is NULL, sp is in the screen coordinate system if (src == NULL) { - ViewContainer* vc = dst->GetViewContainer(); + Container* vc = dst->GetContainer(); if (vc) { CRect b; vc->GetBounds(&b, false); @@ -1330,7 +1330,7 @@ void View::ConvertPointToView(View* src, View* dst, gfx::Point* point, } // static -void View::ConvertPointToViewContainer(View* src, gfx::Point* p) { +void View::ConvertPointToContainer(View* src, gfx::Point* p) { DCHECK(src); DCHECK(p); @@ -1344,9 +1344,9 @@ void View::ConvertPointToViewContainer(View* src, gfx::Point* p) { } // static -void View::ConvertPointFromViewContainer(View *source, gfx::Point* p) { +void View::ConvertPointFromContainer(View *source, gfx::Point* p) { gfx::Point t; - ConvertPointToViewContainer(source, &t); + ConvertPointToContainer(source, &t); p->SetPoint(p->x() - t.x(), p->y() - t.y()); } @@ -1356,9 +1356,9 @@ 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. - ViewContainer* vc = src->GetViewContainer(); + Container* vc = src->GetContainer(); if (vc) { - ConvertPointToViewContainer(src, p); + ConvertPointToContainer(src, p); CRect r; vc->GetBounds(&r, false); p->SetPoint(p->x() + r.left, p->y() + r.top); @@ -1531,7 +1531,7 @@ void View::Focus() { // messages. FocusManager* focus_manager = GetFocusManager(); if (focus_manager) - focus_manager->FocusHWND(GetRootView()->GetViewContainer()->GetHWND()); + focus_manager->FocusHWND(GetRootView()->GetContainer()->GetHWND()); } bool View::CanProcessTabKeyEvents() { @@ -1548,13 +1548,13 @@ bool View::GetTooltipTextOrigin(int x, int y, CPoint* loc) { } void View::TooltipTextChanged() { - ViewContainer* view_container = GetViewContainer(); + Container* view_container = GetContainer(); if (view_container != NULL && view_container->GetTooltipManager()) view_container->GetTooltipManager()->TooltipTextChanged(this); } void View::UpdateTooltip() { - ViewContainer* view_container = GetViewContainer(); + Container* view_container = GetContainer(); if (view_container != NULL && view_container->GetTooltipManager()) view_container->GetTooltipManager()->UpdateTooltip(); } @@ -1587,8 +1587,8 @@ gfx::Rect View::GetVisibleBounds() { ancestor_bounds.SetRect(0, 0, ancestor->width(), ancestor->height()); vis_bounds = vis_bounds.Intersect(ancestor_bounds); - } else if (!view->GetViewContainer()) { - // If the view has no ViewContainer, we're not visible. Return an empty + } else if (!view->GetContainer()) { + // If the view has no Container, we're not visible. Return an empty // rect. return gfx::Rect(); } diff --git a/chrome/views/view.h b/chrome/views/view.h index 18314b0..2d0f21e 100644 --- a/chrome/views/view.h +++ b/chrome/views/view.h @@ -31,13 +31,13 @@ namespace ChromeViews { class Background; class Border; +class Container; class FocusManager; class FocusTraversable; class LayoutManager; class RestoreFocusTask; class RootView; class ScrollView; -class ViewContainer; // ContextMenuController is responsible for showing the context menu for a // View. To use a ContextMenuController invoke SetContextMenuController on a @@ -430,8 +430,8 @@ class View : public AcceleratorTarget { // Get the child View at the specified point. virtual View* GetViewForPoint(const gfx::Point& point); - // Get the containing ViewContainer - virtual ViewContainer* GetViewContainer() const; + // Get the Container that hosts this View, if any. + virtual Container* GetContainer() const; // Get the containing RootView virtual RootView* GetRootView(); @@ -503,7 +503,7 @@ class View : public AcceleratorTarget { // 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 ViewContainer. + // view is not part of a view hierarchy with a Container. virtual FocusManager* GetFocusManager(); // Sets a keyboard accelerator for that view. When the user presses the @@ -675,13 +675,13 @@ class View : public AcceleratorTarget { gfx::Point* point); // Convert a point from the coordinate system of a View to that of the - // ViewContainer. This is useful for example when sizing HWND children - // of the ViewContainer that don't know about the View hierarchy and need - // to be placed relative to the ViewContainer that is their parent. - static void ConvertPointToViewContainer(View* src, gfx::Point* point); + // 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); - // Convert a point from a view ViewContainer to a View dest - static void ConvertPointFromViewContainer(View *dest, gfx::Point* p); + // Convert a point from a view Container to a View dest + static void ConvertPointFromContainer(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. @@ -1168,7 +1168,7 @@ class View : public AcceleratorTarget { gfx::Point* point, bool try_other_direction); - // Propagates UpdateTooltip() to the TooltipManager for the ViewContainer. + // Propagates UpdateTooltip() to the TooltipManager for the Container. // 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 91c556c..38df3bd 100644 --- a/chrome/views/view_unittest.cc +++ b/chrome/views/view_unittest.cc @@ -281,7 +281,7 @@ TEST_F(ViewTest, MouseEvent) { TestView* v2 = new TestView(); v2->SetBounds (100, 100, 100, 100); - ChromeViews::HWNDViewContainer window; + ChromeViews::ContainerWin window; window.set_delete_on_destroy(false); window.set_window_style(WS_OVERLAPPEDWINDOW); window.Init(NULL, gfx::Rect(50, 50, 650, 650), false); @@ -355,7 +355,7 @@ TEST_F(ViewTest, Painting) { RDW_UPDATENOW | RDW_INVALIDATE | RDW_ALLCHILDREN); bool empty_paint = paint_window.empty_paint(); - ChromeViews::HWNDViewContainer window; + ChromeViews::ContainerWin window; window.set_delete_on_destroy(false); window.set_window_style(WS_OVERLAPPEDWINDOW); window.Init(NULL, gfx::Rect(50, 50, 650, 650), NULL); @@ -442,7 +442,7 @@ TEST_F(ViewTest, RemoveNotification) { NotificationService::current()->AddObserver( observer.get(), NOTIFY_VIEW_REMOVED, NotificationService::AllSources()); - ChromeViews::HWNDViewContainer* window = new ChromeViews::HWNDViewContainer; + ChromeViews::ContainerWin* window = new ChromeViews::ContainerWin; ChromeViews::RootView* root_view = window->GetRootView(); View* v1 = new View; @@ -546,7 +546,7 @@ gfx::Point ConvertPointToView(ChromeViews::View* view, const gfx::Point& p) { } TEST_F(ViewTest, HitTestMasks) { - ChromeViews::HWNDViewContainer window; + ChromeViews::ContainerWin window; ChromeViews::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 ecb5048..0a6ef96 100644 --- a/chrome/views/views.vcproj +++ b/chrome/views/views.vcproj @@ -258,6 +258,18 @@ > </File> <File + RelativePath=".\container.h" + > + </File> + <File + RelativePath=".\container_win.cc" + > + </File> + <File + RelativePath=".\container_win.h" + > + </File> + <File RelativePath=".\controller.h" > </File> @@ -346,14 +358,6 @@ > </File> <File - RelativePath=".\hwnd_view_container.cc" - > - </File> - <File - RelativePath=".\hwnd_view_container.h" - > - </File> - <File RelativePath=".\image_view.cc" > </File> @@ -598,10 +602,6 @@ > </File> <File - RelativePath=".\view_container.h" - > - </File> - <File RelativePath=".\view_menu_delegate.h" > </File> diff --git a/chrome/views/window.cc b/chrome/views/window.cc index 78df878..4c9de42 100644 --- a/chrome/views/window.cc +++ b/chrome/views/window.cc @@ -117,7 +117,7 @@ void Window::Close() { if (client_view_->CanClose()) { SaveWindowPosition(); RestoreEnabledIfNecessary(); - HWNDViewContainer::Close(); + ContainerWin::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 @@ -259,7 +259,7 @@ gfx::Size Window::GetLocalizedContentsSize(int col_resource_id, // Window, protected: Window::Window(WindowDelegate* window_delegate) - : HWNDViewContainer(), + : ContainerWin(), focus_on_creation_(true), window_delegate_(window_delegate), non_client_view_(NULL), @@ -286,7 +286,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 HWNDViewContainer functions may be called during initialization. + // assorted ContainerWin functions may be called during initialization. is_modal_ = window_delegate_->IsModal(); if (is_modal_) BecomeModal(); @@ -297,7 +297,7 @@ void Window::Init(HWND parent, const gfx::Rect& bounds) { if (window_ex_style() == 0) set_window_ex_style(CalculateWindowExStyle()); - HWNDViewContainer::Init(parent, bounds, true); + ContainerWin::Init(parent, bounds, true); win_util::SetWindowUserData(GetHWND(), this); std::wstring window_title = window_delegate_->GetWindowTitle(); @@ -318,9 +318,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. - HWNDViewContainer::SetContentsView(non_client_view_); + ContainerWin::SetContentsView(non_client_view_); } else { - HWNDViewContainer::SetContentsView(client_view_); + ContainerWin::SetContentsView(client_view_); } } @@ -352,7 +352,7 @@ void Window::RunSystemMenu(const CPoint& point) { } /////////////////////////////////////////////////////////////////////////////// -// Window, HWNDViewContainer overrides: +// Window, ContainerWin overrides: void Window::OnActivate(UINT action, BOOL minimized, HWND window) { if (action == WA_INACTIVE) @@ -363,17 +363,15 @@ LRESULT Window::OnAppCommand(HWND window, short app_command, WORD device, int keystate) { // 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 HWNDViewContainer::OnAppCommand(window, app_command, device, - keystate); - } + if (!window_delegate_->ExecuteWindowsCommand(app_command)) + return ContainerWin::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)) - HWNDViewContainer::OnCommand(notification_code, command_id, window); + ContainerWin::OnCommand(notification_code, command_id, window); } void Window::OnDestroy() { @@ -382,7 +380,7 @@ void Window::OnDestroy() { window_delegate_ = NULL; } RestoreEnabledIfNecessary(); - HWNDViewContainer::OnDestroy(); + ContainerWin::OnDestroy(); } LRESULT Window::OnEraseBkgnd(HDC dc) { @@ -396,7 +394,7 @@ LRESULT Window::OnNCActivate(BOOL active) { return DefWindowProc(GetHWND(), WM_NCACTIVATE, TRUE, 0); } // Otherwise just do the default thing. - return HWNDViewContainer::OnNCActivate(active); + return ContainerWin::OnNCActivate(active); } LRESULT Window::OnNCHitTest(const CPoint& point) { @@ -422,14 +420,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()); - HWNDViewContainer::OnNCLButtonDown(ht_component, point); + ContainerWin::OnNCLButtonDown(ht_component, point); } void Window::OnNCRButtonDown(UINT ht_component, const CPoint& point) { if (ht_component == HTCAPTION || ht_component == HTSYSMENU) { RunSystemMenu(point); } else { - HWNDViewContainer::OnNCRButtonDown(ht_component, point); + ContainerWin::OnNCRButtonDown(ht_component, point); } } diff --git a/chrome/views/window.h b/chrome/views/window.h index fcf3e49..cfb0b88 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/hwnd_view_container.h" +#include "chrome/views/container_win.h" namespace gfx { class Size; @@ -22,15 +22,15 @@ class Client; class NonClientView; class WindowDelegate; -//////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// // // Window // -// A Window is a HWNDViewContainer that has a caption and a border. The frame -// is rendered by the operating system. +// A Window is a ContainerWin that has a caption and a border. The frame is +// rendered by the operating system. // -//////////////////////////////////////////////////////////////////////////////// -class Window : public HWNDViewContainer { +/////////////////////////////////////////////////////////////////////////////// +class Window : public ContainerWin { public: virtual ~Window(); @@ -156,7 +156,7 @@ class Window : public HWNDViewContainer { // Shows the system menu at the specified screen point. void RunSystemMenu(const CPoint& point); - // Overridden from HWNDViewContainer: + // Overridden from ContainerWin: virtual void OnActivate(UINT action, BOOL minimized, HWND window); virtual LRESULT OnAppCommand(HWND window, short app_command, WORD device, int keystate); |