diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-16 00:26:30 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-16 00:26:30 +0000 |
commit | 4d0bd1045bc0df8daea2a5626e73906cb074631b (patch) | |
tree | 6794b895e236b68c2f7de1163dfb1c554646364c /chrome/views | |
parent | 7609533b68dcbeaa80bf712dd84726d1da8d3f8a (diff) | |
download | chromium_src-4d0bd1045bc0df8daea2a5626e73906cb074631b.zip chromium_src-4d0bd1045bc0df8daea2a5626e73906cb074631b.tar.gz chromium_src-4d0bd1045bc0df8daea2a5626e73906cb074631b.tar.bz2 |
Rename ViewContainer to Container and HWNDViewContainer to ContainerWin.
http://crbug.com/3430
Review URL: http://codereview.chromium.org/7376
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3441 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views')
41 files changed, 344 insertions, 359 deletions
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); |