summaryrefslogtreecommitdiffstats
path: root/chrome/views
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-21 20:51:20 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-21 20:51:20 +0000
commita0dde12f2e4f92f1a59885c45cfecd10dbfdfdfd (patch)
treed8283a980977f11c43542016d57f698d3a83b73d /chrome/views
parent933cc00eb856db684b9e64b7486ca20edbb2c3ea (diff)
downloadchromium_src-a0dde12f2e4f92f1a59885c45cfecd10dbfdfdfd.zip
chromium_src-a0dde12f2e4f92f1a59885c45cfecd10dbfdfdfd.tar.gz
chromium_src-a0dde12f2e4f92f1a59885c45cfecd10dbfdfdfd.tar.bz2
Rename Container->Widget
R=erg review url = http://codereview.chromium.org/11348/show git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5849 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views')
-rw-r--r--chrome/views/accessibility/view_accessibility.cc6
-rw-r--r--chrome/views/aero_tooltip_manager.cc4
-rw-r--r--chrome/views/aero_tooltip_manager.h2
-rw-r--r--chrome/views/bitmap_scroll_bar.cc14
-rw-r--r--chrome/views/button.cc3
-rw-r--r--chrome/views/button_dropdown.cc10
-rw-r--r--chrome/views/chrome_menu.cc18
-rw-r--r--chrome/views/chrome_menu.h6
-rw-r--r--chrome/views/client_view.cc2
-rw-r--r--chrome/views/container.h89
-rw-r--r--chrome/views/custom_frame_window.cc22
-rw-r--r--chrome/views/custom_frame_window.h2
-rw-r--r--chrome/views/focus_manager.cc20
-rw-r--r--chrome/views/focus_manager.h6
-rw-r--r--chrome/views/focus_manager_unittest.cc24
-rw-r--r--chrome/views/hwnd_view.cc20
-rw-r--r--chrome/views/label.cc1
-rw-r--r--chrome/views/menu_button.cc10
-rw-r--r--chrome/views/native_control.cc10
-rw-r--r--chrome/views/native_scroll_bar.cc12
-rw-r--r--chrome/views/root_view.cc30
-rw-r--r--chrome/views/root_view.h53
-rw-r--r--chrome/views/root_view_drop_target.cc4
-rw-r--r--chrome/views/tabbed_pane.cc4
-rw-r--r--chrome/views/tabbed_pane.h4
-rw-r--r--chrome/views/table_view.cc3
-rw-r--r--chrome/views/text_button.cc1
-rw-r--r--chrome/views/text_field.cc8
-rw-r--r--chrome/views/tooltip_manager.cc23
-rw-r--r--chrome/views/tooltip_manager.h12
-rw-r--r--chrome/views/tree_view.cc8
-rw-r--r--chrome/views/view.cc62
-rw-r--r--chrome/views/view.h28
-rw-r--r--chrome/views/view_unittest.cc8
-rw-r--r--chrome/views/views.vcproj32
-rw-r--r--chrome/views/widget.h87
-rw-r--r--chrome/views/widget_win.cc (renamed from chrome/views/container_win.cc)233
-rw-r--r--chrome/views/widget_win.h (renamed from chrome/views/container_win.h)68
-rw-r--r--chrome/views/window.cc26
-rw-r--r--chrome/views/window.h8
40 files changed, 477 insertions, 506 deletions
diff --git a/chrome/views/accessibility/view_accessibility.cc b/chrome/views/accessibility/view_accessibility.cc
index af2d933..ac7ed71 100644
--- a/chrome/views/accessibility/view_accessibility.cc
+++ b/chrome/views/accessibility/view_accessibility.cc
@@ -109,9 +109,9 @@ STDMETHODIMP ViewAccessibility::get_accParent(IDispatch** disp_parent) {
views::View* parent = view_->GetParent();
if (!parent) {
- // This function can get called during teardown of ContainerWin so we
+ // This function can get called during teardown of WidetWin so we
// should bail out if we fail to get the HWND.
- if (!view_->GetContainer() || !view_->GetContainer()->GetHWND()) {
+ if (!view_->GetWidget() || !view_->GetWidget()->GetHWND()) {
*disp_parent = NULL;
return S_FALSE;
}
@@ -120,7 +120,7 @@ STDMETHODIMP ViewAccessibility::get_accParent(IDispatch** disp_parent) {
// the default implementation, to interface with Windows' hierarchy and to
// support calls from e.g. WindowFromAccessibleObject.
HRESULT hr =
- ::AccessibleObjectFromWindow(view_->GetContainer()->GetHWND(),
+ ::AccessibleObjectFromWindow(view_->GetWidget()->GetHWND(),
OBJID_WINDOW, IID_IAccessible,
reinterpret_cast<void**>(disp_parent));
diff --git a/chrome/views/aero_tooltip_manager.cc b/chrome/views/aero_tooltip_manager.cc
index 5977644..29f3d66 100644
--- a/chrome/views/aero_tooltip_manager.cc
+++ b/chrome/views/aero_tooltip_manager.cc
@@ -18,8 +18,8 @@ namespace views {
///////////////////////////////////////////////////////////////////////////////
// AeroTooltipManager, public:
-AeroTooltipManager::AeroTooltipManager(Container* container, HWND parent)
- : TooltipManager(container, parent),
+AeroTooltipManager::AeroTooltipManager(Widget* widget, HWND parent)
+ : TooltipManager(widget, parent),
initial_delay_(0) {
}
diff --git a/chrome/views/aero_tooltip_manager.h b/chrome/views/aero_tooltip_manager.h
index 3b7b99a..7635904 100644
--- a/chrome/views/aero_tooltip_manager.h
+++ b/chrome/views/aero_tooltip_manager.h
@@ -28,7 +28,7 @@ namespace views {
// TODO(glen): Resolve this with Microsoft.
class AeroTooltipManager : public TooltipManager {
public:
- AeroTooltipManager(Container* container, HWND parent);
+ AeroTooltipManager(Widget* widget, HWND parent);
virtual ~AeroTooltipManager();
virtual void OnMouse(UINT u_msg, WPARAM w_param, LPARAM l_param);
diff --git a/chrome/views/bitmap_scroll_bar.cc b/chrome/views/bitmap_scroll_bar.cc
index 5297f59..283f987 100644
--- a/chrome/views/bitmap_scroll_bar.cc
+++ b/chrome/views/bitmap_scroll_bar.cc
@@ -7,9 +7,9 @@
#include "base/message_loop.h"
#include "chrome/common/gfx/chrome_canvas.h"
#include "chrome/common/l10n_util.h"
-#include "chrome/views/container.h"
#include "chrome/views/menu.h"
#include "chrome/views/scroll_view.h"
+#include "chrome/views/widget.h"
#include "skia/include/SkBitmap.h"
#include "generated_resources.h"
@@ -529,14 +529,14 @@ enum ScrollBarContextMenuCommands {
void BitmapScrollBar::ShowContextMenu(View* source, int x, int y,
bool is_mouse_gesture) {
- Container* vc = GetContainer();
- CRect vc_bounds;
- vc->GetBounds(&vc_bounds, true);
- gfx::Point temp_pt(x - vc_bounds.left, y - vc_bounds.top);
- View::ConvertPointFromContainer(this, &temp_pt);
+ Widget* widget = GetWidget();
+ CRect widget_bounds;
+ widget->GetBounds(&widget_bounds, true);
+ gfx::Point temp_pt(x - widget_bounds.left, y - widget_bounds.top);
+ View::ConvertPointFromWidget(this, &temp_pt);
context_menu_mouse_position_ = IsHorizontal() ? temp_pt.x() : temp_pt.y();
- Menu menu(this, Menu::TOPLEFT, GetContainer()->GetHWND());
+ Menu menu(this, Menu::TOPLEFT, GetWidget()->GetHWND());
menu.AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollHere);
menu.AppendSeparator();
menu.AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollStart);
diff --git a/chrome/views/button.cc b/chrome/views/button.cc
index 1a55aaf..93e2e3c 100644
--- a/chrome/views/button.cc
+++ b/chrome/views/button.cc
@@ -8,12 +8,11 @@
#include <atlapp.h>
#include "base/gfx/image_operations.h"
+#include "chrome/app/chrome_dll_resource.h"
#include "chrome/common/gfx/chrome_canvas.h"
#include "chrome/common/l10n_util.h"
#include "chrome/common/throb_animation.h"
-#include "chrome/views/container.h"
#include "chrome/views/event.h"
-#include "chrome/app/chrome_dll_resource.h"
#include "generated_resources.h"
diff --git a/chrome/views/button_dropdown.cc b/chrome/views/button_dropdown.cc
index 2b07def..cb2b4b2 100644
--- a/chrome/views/button_dropdown.cc
+++ b/chrome/views/button_dropdown.cc
@@ -7,8 +7,8 @@
#include "base/message_loop.h"
#include "chrome/browser/back_forward_menu_model.h"
#include "chrome/common/l10n_util.h"
-#include "chrome/views/container.h"
#include "chrome/views/view_menu_delegate.h"
+#include "chrome/views/widget.h"
#include "generated_resources.h"
@@ -49,7 +49,7 @@ bool ButtonDropDown::OnMousePressed(const MouseEvent& e) {
// Schedule a task that will show the menu.
MessageLoop::current()->PostDelayedTask(FROM_HERE,
show_menu_factory_.NewRunnableMethod(&ButtonDropDown::ShowDropDownMenu,
- GetContainer()->GetHWND()),
+ GetWidget()->GetHWND()),
kMenuTimerDelay);
}
@@ -73,7 +73,7 @@ void ButtonDropDown::OnMouseReleased(const MouseEvent& e, bool canceled) {
// update the appearance synchronously.
SetState(BS_PUSHED);
PaintNow();
- ShowDropDownMenu(GetContainer()->GetHWND());
+ ShowDropDownMenu(GetWidget()->GetHWND());
}
}
@@ -91,7 +91,7 @@ bool ButtonDropDown::OnMouseDragged(const MouseEvent& e) {
// it immediately.
if (e.y() > y_position_on_lbuttondown_ + dragging_threshold) {
show_menu_factory_.RevokeAll();
- ShowDropDownMenu(GetContainer()->GetHWND());
+ ShowDropDownMenu(GetWidget()->GetHWND());
}
}
@@ -112,7 +112,7 @@ void ButtonDropDown::ShowContextMenu(int x, int y, bool is_mouse_gesture) {
// update the appearance synchronously.
SetState(BS_PUSHED);
PaintNow();
- ShowDropDownMenu(GetContainer()->GetHWND());
+ ShowDropDownMenu(GetWidget()->GetHWND());
SetState(BS_HOT);
}
diff --git a/chrome/views/chrome_menu.cc b/chrome/views/chrome_menu.cc
index ffa4891..549bedf 100644
--- a/chrome/views/chrome_menu.cc
+++ b/chrome/views/chrome_menu.cc
@@ -21,9 +21,9 @@
#include "chrome/common/l10n_util.h"
#include "chrome/common/os_exchange_data.h"
#include "chrome/views/border.h"
-#include "chrome/views/container_win.h"
#include "chrome/views/root_view.h"
#include "chrome/views/view_constants.h"
+#include "chrome/views/widget_win.h"
#include "generated_resources.h"
#undef min
@@ -542,9 +542,9 @@ class MenuSeparator : public View {
class MenuHostRootView : public RootView {
public:
- explicit MenuHostRootView(Container* container,
+ explicit MenuHostRootView(Widget* widget,
SubmenuView* submenu)
- : RootView(container),
+ : RootView(widget),
submenu_(submenu),
forward_drag_to_menu_controller_(true),
suspend_events_(false) {
@@ -648,7 +648,7 @@ class MenuHostRootView : public RootView {
// DelayedClosed, which avoids timing issues with deleting the window while
// capture or events are directed at it.
-class MenuHost : public ContainerWin {
+class MenuHost : public WidgetWin {
public:
MenuHost(SubmenuView* submenu)
: closed_(false),
@@ -672,7 +672,7 @@ class MenuHost : public ContainerWin {
const gfx::Rect& bounds,
View* contents_view,
bool do_capture) {
- ContainerWin::Init(parent, bounds, true);
+ WidgetWin::Init(parent, bounds, true);
SetContentsView(contents_view);
// We don't want to take focus away from the hosting window.
ShowWindow(SW_SHOWNA);
@@ -699,17 +699,17 @@ class MenuHost : public ContainerWin {
GetRootView()->RemoveAllChildViews(false);
closed_ = true;
ReleaseCapture();
- ContainerWin::Hide();
+ WidgetWin::Hide();
}
virtual void HideWindow() {
// Make sure we release capture before hiding.
ReleaseCapture();
- ContainerWin::Hide();
+ WidgetWin::Hide();
}
virtual void OnCaptureChanged(HWND hwnd) {
- ContainerWin::OnCaptureChanged(hwnd);
+ WidgetWin::OnCaptureChanged(hwnd);
owns_capture_ = false;
#ifdef DEBUG_MENU
DLOG(INFO) << "Capture changed";
@@ -2638,7 +2638,7 @@ bool MenuController::IsMenuWindow(MenuItemView* item, HWND window) {
if (!item)
return false;
return ((item->HasSubmenu() && item->GetSubmenu()->IsShowing() &&
- item->GetSubmenu()->GetContainer()->GetHWND() == window) ||
+ item->GetSubmenu()->GetWidget()->GetHWND() == window) ||
IsMenuWindow(item->GetParentMenuItem(), window));
}
diff --git a/chrome/views/chrome_menu.h b/chrome/views/chrome_menu.h
index dd17a84..98ce67b 100644
--- a/chrome/views/chrome_menu.h
+++ b/chrome/views/chrome_menu.h
@@ -19,7 +19,7 @@
namespace views {
-class ContainerWin;
+class WidgetWin;
class MenuController;
class MenuItemView;
class SubmenuView;
@@ -484,7 +484,7 @@ class MenuItemView : public View {
// . Forwards the appropriate events to the MenuController. This allows the
// MenuController to update the selection as the user moves the mouse around.
// . Renders the drop indicator during a drop operation.
-// . Shows and hides the window (a ContainerWin) when the menu is shown on
+// . Shows and hides the window (a WidgetWin) when the menu is shown on
// screen.
//
// SubmenuView is itself contained in a MenuScrollViewContainer.
@@ -590,7 +590,7 @@ class SubmenuView : public View {
// Parent menu item.
MenuItemView* parent_menu_item_;
- // ContainerWin subclass used to show the children.
+ // WidgetWin subclass used to show the children.
MenuHost* host_;
// If non-null, indicates a drop is in progress and drop_item is the item
diff --git a/chrome/views/client_view.cc b/chrome/views/client_view.cc
index ba3f6e4..4f4bae3 100644
--- a/chrome/views/client_view.cc
+++ b/chrome/views/client_view.cc
@@ -38,7 +38,7 @@ gfx::Size ClientView::GetPreferredSize() {
void ClientView::ViewHierarchyChanged(bool is_add, View* parent, View* child) {
if (is_add && child == this) {
- DCHECK(GetContainer());
+ DCHECK(GetWidget());
DCHECK(contents_view_); // |contents_view_| must be valid now!
AddChildView(contents_view_);
}
diff --git a/chrome/views/container.h b/chrome/views/container.h
deleted file mode 100644
index 08f776c..0000000
--- a/chrome/views/container.h
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_VIEWS_CONTAINER_H_
-#define CHROME_VIEWS_CONTAINER_H_
-
-// TODO(maruel): Remove once HWND is abstracted.
-#include <windows.h>
-
-namespace gfx {
-class Rect;
-}
-
-// TODO(maruel): Remove once gfx::Rect is used instead.
-namespace WTL {
-class CRect;
-}
-using WTL::CRect;
-
-namespace views {
-
-class RootView;
-class TooltipManager;
-class Accelerator;
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Container interface
-//
-// Container is an abstract class that defines the API that should be
-// implemented by a CWindow / HWND implementation in order to host a view
-// hierarchy.
-//
-// Container wraps a hierarchy of View objects (see view.h) that implement
-// painting and flexible layout within the bounds of the Container's window.
-//
-// The Container is responsible for handling various system events and
-// forwarding them to the appropriate view.
-//
-/////////////////////////////////////////////////////////////////////////////
-
-class Container {
- public:
- virtual ~Container() { }
-
- // Returns the bounds of this container in the screen coordinate system.
- // If the receiving view container is a frame which is larger than its
- // client area, this method returns the client area if including_frame is
- // false and the frame bounds otherwise. If the receiving view container
- // is not a frame, including_frame is ignored.
- virtual void GetBounds(CRect *out, bool including_frame) const = 0;
-
- // Moves this view container to the front of the Z-Order
- // If should_activate is TRUE, the window should also become the active
- // window
- virtual void MoveToFront(bool should_activate) = 0;
-
- // Returns the Window HWND associated with this container
- virtual HWND GetHWND() const = 0;
-
- // Forces a paint of a specified rectangle immediately.
- virtual void PaintNow(const gfx::Rect& update_rect) = 0;
-
- // Returns the RootView contained by this container
- virtual RootView* GetRootView() = 0;
-
- // Returns whether the view container is visible to the user
- virtual bool IsVisible() = 0;
-
- // Returns whether the view container is the currently active window.
- virtual bool IsActive() = 0;
-
- // Returns the TooltipManager for this Container. If this Container does not
- // support tooltips, NULL is returned.
- virtual TooltipManager* GetTooltipManager() {
- return NULL;
- }
-
- // Returns the accelerator given a command id. Returns false if there is
- // no accelerator associated with a given id, which is a common condition.
- virtual bool GetAccelerator(int cmd_id,
- Accelerator* accelerator) = 0;
-};
-
-} // namespace views
-
-#endif // CHROME_VIEWS_VIEW_CONTAINER_H_
-
diff --git a/chrome/views/custom_frame_window.cc b/chrome/views/custom_frame_window.cc
index 33df287..3ff64a6 100644
--- a/chrome/views/custom_frame_window.cc
+++ b/chrome/views/custom_frame_window.cc
@@ -532,9 +532,9 @@ gfx::Size DefaultNonClientView::GetPreferredSize() {
void DefaultNonClientView::ViewHierarchyChanged(bool is_add,
View* parent,
View* child) {
- // Add our Client View as we are added to the Container so that if we are
+ // Add our Client View as we are added to the Widget so that if we are
// subsequently resized all the parent-child relationships are established.
- if (is_add && GetContainer() && child == this)
+ if (is_add && GetWidget() && child == this)
AddChildView(container_->client_view());
}
@@ -927,7 +927,7 @@ void CustomFrameWindow::SetClientView(ClientView* cv) {
DCHECK(cv && !client_view() && GetHWND());
set_client_view(cv);
// For a CustomFrameWindow, the non-client view is the root.
- ContainerWin::SetContentsView(non_client_view_);
+ WidgetWin::SetContentsView(non_client_view_);
// When the non client view is added to the view hierarchy, it will cause the
// client view to be added as well.
}
@@ -977,7 +977,7 @@ void CustomFrameWindow::SizeWindowToDefault() {
}
///////////////////////////////////////////////////////////////////////////////
-// CustomFrameWindow, ContainerWin overrides:
+// CustomFrameWindow, WidgetWin overrides:
void CustomFrameWindow::OnGetMinMaxInfo(MINMAXINFO* minmax_info) {
// We handle this message so that we can make sure we interact nicely with
@@ -1207,7 +1207,7 @@ void CustomFrameWindow::OnNCLButtonDown(UINT ht_component,
/*
if (!IsMsgHandled()) {
// Window::OnNCLButtonDown set the message as unhandled. This normally
- // means ContainerWin::ProcessWindowMessage will pass it to
+ // means WidgetWin::ProcessWindowMessage will pass it to
// DefWindowProc. Sadly, DefWindowProc for WM_NCLBUTTONDOWN does weird
// non-client painting, so we need to call it directly here inside a
// scoped update lock.
@@ -1232,23 +1232,21 @@ void CustomFrameWindow::OnNCMButtonDown(UINT ht_component,
SetMsgHandled(FALSE);
return;
}
- ContainerWin::OnNCMButtonDown(ht_component, point);
+ WidgetWin::OnNCMButtonDown(ht_component, point);
}
LRESULT CustomFrameWindow::OnNCUAHDrawCaption(UINT msg, WPARAM w_param,
LPARAM l_param) {
- // See comment in hwnd_view_container.h at the definition of
- // WM_NCUAHDRAWCAPTION for an explanation about why we need to handle this
- // message.
+ // See comment in widget_win.h at the definition of WM_NCUAHDRAWCAPTION for
+ // an explanation about why we need to handle this message.
SetMsgHandled(TRUE);
return 0;
}
LRESULT CustomFrameWindow::OnNCUAHDrawFrame(UINT msg, WPARAM w_param,
LPARAM l_param) {
- // See comment in hwnd_view_container.h at the definition of
- // WM_NCUAHDRAWCAPTION for an explanation about why we need to handle this
- // message.
+ // See comment in widget_win.h at the definition of WM_NCUAHDRAWCAPTION for
+ // an explanation about why we need to handle this message.
SetMsgHandled(TRUE);
return 0;
}
diff --git a/chrome/views/custom_frame_window.h b/chrome/views/custom_frame_window.h
index 85c6b2d..2878f91 100644
--- a/chrome/views/custom_frame_window.h
+++ b/chrome/views/custom_frame_window.h
@@ -47,7 +47,7 @@ class CustomFrameWindow : public Window {
virtual void EnableClose(bool enable);
virtual void DisableInactiveRendering(bool disable);
- // Overridden from ContainerWin:
+ // Overridden from WidgetWin:
virtual void OnGetMinMaxInfo(MINMAXINFO* minmax_info);
virtual void OnInitMenu(HMENU menu);
virtual void OnMouseLeave();
diff --git a/chrome/views/focus_manager.cc b/chrome/views/focus_manager.cc
index 4164cb8..da23bda 100644
--- a/chrome/views/focus_manager.cc
+++ b/chrome/views/focus_manager.cc
@@ -9,11 +9,11 @@
#include "chrome/browser/render_widget_host_view_win.h"
#include "chrome/common/notification_types.h"
#include "chrome/views/accelerator.h"
-#include "chrome/views/container.h"
#include "chrome/views/focus_manager.h"
#include "chrome/views/root_view.h"
#include "chrome/views/view.h"
#include "chrome/views/view_storage.h"
+#include "chrome/views/widget.h"
// The following keys are used in SetProp/GetProp to associate additional
// information needed for focus tracking with a window.
@@ -304,11 +304,11 @@ bool FocusManager::OnKeyDown(HWND window, UINT message, WPARAM wparam,
DCHECK((message == WM_KEYDOWN) || (message == WM_SYSKEYDOWN));
if (!IsWindowVisible(root_)) {
- // We got a message for a hidden window. Because ContainerWin::Close
- // hides the window, then destroys it, it it possible to get a message after
- // we've hidden the window. If we allow the message to be dispatched
- // chances are we'll crash in some weird place. By returning false we make
- // sure the message isn't dispatched.
+ // We got a message for a hidden window. Because WidgetWin::Close hides the
+ // window, then destroys it, it it possible to get a message after we've
+ // hidden the window. If we allow the message to be dispatched chances are
+ // we'll crash in some weird place. By returning false we make sure the
+ // message isn't dispatched.
return false;
}
@@ -425,11 +425,11 @@ bool FocusManager::ContainsView(View* view) {
if (!root_view)
return false;
- Container* view_container = root_view->GetContainer();
- if (!view_container)
+ Widget* widget = root_view->GetWidget();
+ if (!widget)
return false;
- HWND window = view_container->GetHWND();
+ HWND window = widget->GetHWND();
while (window) {
if (window == root_)
return true;
@@ -457,7 +457,7 @@ View* FocusManager::GetNextFocusableView(View* original_starting_view,
View* starting_view = NULL;
if (original_starting_view) {
// If the starting view has a focus traversable, use it.
- // This is the case with ContainerWins for example.
+ // This is the case with WidgetWins for example.
focus_traversable = original_starting_view->GetFocusTraversable();
// Otherwise default to the root view.
diff --git a/chrome/views/focus_manager.h b/chrome/views/focus_manager.h
index 835b745..4fcd1ce 100644
--- a/chrome/views/focus_manager.h
+++ b/chrome/views/focus_manager.h
@@ -29,10 +29,10 @@
// This is already done for you if you subclass the NativeControl class or if
// you use the HWNDView class.
//
-// When creating a top window, if it derives from ContainerWin, the
+// When creating a top window, if it derives from WidgetWin, the
// |has_own_focus_manager| of the Init method lets you specify whether that
// window should have its own focus manager (so focus traversal stays confined
-// in that window). If you are not deriving from ContainerWin or one of its
+// in that window). If you are not deriving from WidgetWin or one of its
// derived classes (Window, FramelessWindow, ConstrainedWindow), you must
// create a FocusManager when the window is created (it is automatically deleted
// when the window is destroyed).
@@ -49,7 +49,7 @@
// method SetNextFocusableView().
//
// If you are embedding a native view containing a nested RootView (for example
-// by adding a NativeControl that contains a ContainerWin as its native
+// by adding a NativeControl that contains a WidgetWin as its native
// component), then you need to:
// - override the View::GetFocusTraversable() method in your outter component.
// It should return the RootView of the inner component. This is used when
diff --git a/chrome/views/focus_manager_unittest.cc b/chrome/views/focus_manager_unittest.cc
index 861979e..30f7e85 100644
--- a/chrome/views/focus_manager_unittest.cc
+++ b/chrome/views/focus_manager_unittest.cc
@@ -14,7 +14,6 @@
#include "chrome/views/background.h"
#include "chrome/views/border.h"
#include "chrome/views/checkbox.h"
-#include "chrome/views/container_win.h"
#include "chrome/views/label.h"
#include "chrome/views/link.h"
#include "chrome/views/native_button.h"
@@ -23,6 +22,7 @@
#include "chrome/views/scroll_view.h"
#include "chrome/views/tabbed_pane.h"
#include "chrome/views/text_field.h"
+#include "chrome/views/widget_win.h"
#include "chrome/views/window.h"
#include "chrome/views/window_delegate.h"
#include "SkColor.h"
@@ -114,10 +114,10 @@ class BorderView : public views::NativeControl {
0, 0, width(), height(),
parent_container, NULL, NULL, NULL);
// Create the view container which is a child of the TabControl.
- view_container_ = new views::ContainerWin();
- view_container_->Init(tab_control, gfx::Rect(), false);
- view_container_->SetContentsView(child_);
- view_container_->SetFocusTraversableParentView(this);
+ widget_ = new views::WidgetWin();
+ widget_->Init(tab_control, gfx::Rect(), false);
+ widget_->SetContentsView(child_);
+ widget_->SetFocusTraversableParentView(this);
ResizeContents(tab_control);
return tab_control;
}
@@ -132,11 +132,11 @@ class BorderView : public views::NativeControl {
}
virtual views::RootView* GetContentsRootView() {
- return view_container_->GetRootView();
+ return widget_->GetRootView();
}
virtual views::FocusTraversable* GetFocusTraversable() {
- return view_container_;
+ return widget_;
}
virtual void ViewHierarchyChanged(bool is_add, View *parent, View *child) {
@@ -145,7 +145,7 @@ class BorderView : public views::NativeControl {
if (child == this && is_add) {
// We have been added to a view hierarchy, update the FocusTraversable
// parent.
- view_container_->SetFocusTraversableParent(GetRootView());
+ widget_->SetFocusTraversableParent(GetRootView());
}
}
@@ -156,18 +156,18 @@ private:
if (!GetClientRect(tab_control, &content_bounds))
return;
TabCtrl_AdjustRect(tab_control, FALSE, &content_bounds);
- view_container_->MoveWindow(content_bounds.left, content_bounds.top,
+ widget_->MoveWindow(content_bounds.left, content_bounds.top,
content_bounds.Width(), content_bounds.Height(),
TRUE);
}
View* child_;
- views::ContainerWin* view_container_;
+ views::WidgetWin* widget_;
DISALLOW_EVIL_CONSTRUCTORS(BorderView);
};
-class TestViewWindow : public views::ContainerWin {
+class TestViewWindow : public views::WidgetWin {
public:
explicit TestViewWindow(FocusManagerTest* test);
~TestViewWindow() { }
@@ -239,7 +239,7 @@ void TestViewWindow::Init() {
contents_->set_background(
views::Background::CreateSolidBackground(255, 255, 255));
- ContainerWin::Init(NULL, bounds, true);
+ WidgetWin::Init(NULL, bounds, true);
SetContentsView(contents_);
views::CheckBox* cb =
diff --git a/chrome/views/hwnd_view.cc b/chrome/views/hwnd_view.cc
index 9a4ab30..22990fb 100644
--- a/chrome/views/hwnd_view.cc
+++ b/chrome/views/hwnd_view.cc
@@ -6,9 +6,9 @@
#include "chrome/common/gfx/chrome_canvas.h"
#include "chrome/common/win_util.h"
-#include "chrome/views/container.h"
#include "chrome/views/focus_manager.h"
#include "chrome/views/scroll_view.h"
+#include "chrome/views/widget.h"
#include "base/logging.h"
namespace views {
@@ -38,7 +38,7 @@ void HWNDView::Attach(HWND hwnd) {
ShowWindow(hwnd_, SW_HIDE);
// Need to set the HWND's parent before changing its size to avoid flashing.
- ::SetParent(hwnd_, GetContainer()->GetHWND());
+ ::SetParent(hwnd_, GetWidget()->GetHWND());
UpdateHWNDBounds();
// Register with the focus manager so the associated view is focused when the
@@ -67,11 +67,11 @@ void HWNDView::UpdateHWNDBounds() {
return;
// Since HWNDs know nothing about the View hierarchy (they are direct
- // children of the Container that hosts our View hierarchy) they need to be
- // positioned in the coordinate system of the Container, not the current
+ // children of the Widget that hosts our View hierarchy) they need to be
+ // positioned in the coordinate system of the Widget, not the current
// view.
gfx::Point top_left;
- ConvertPointToContainer(this, &top_left);
+ ConvertPointToWidget(this, &top_left);
gfx::Rect vis_bounds = GetVisibleBounds();
bool visible = !vis_bounds.IsEmpty();
@@ -150,12 +150,12 @@ gfx::Size HWNDView::GetPreferredSize() {
void HWNDView::ViewHierarchyChanged(bool is_add, View *parent, View *child) {
if (hwnd_) {
- Container* vc = GetContainer();
- if (is_add && vc) {
+ Widget* widget = GetWidget();
+ if (is_add && widget) {
HWND parent = ::GetParent(hwnd_);
- HWND vc_hwnd = vc->GetHWND();
- if (parent != vc_hwnd) {
- ::SetParent(hwnd_, vc_hwnd);
+ HWND widget_hwnd = widget->GetHWND();
+ if (parent != widget_hwnd) {
+ ::SetParent(hwnd_, widget_hwnd);
}
if (IsVisibleInRootView())
::ShowWindow(hwnd_, SW_SHOW);
diff --git a/chrome/views/label.cc b/chrome/views/label.cc
index d63e2f0..fc1e9d3 100644
--- a/chrome/views/label.cc
+++ b/chrome/views/label.cc
@@ -15,7 +15,6 @@
#include "chrome/common/l10n_util.h"
#include "chrome/common/resource_bundle.h"
#include "chrome/views/background.h"
-#include "chrome/views/container.h"
namespace views {
diff --git a/chrome/views/menu_button.cc b/chrome/views/menu_button.cc
index 59b0aa2..011a8b3 100644
--- a/chrome/views/menu_button.cc
+++ b/chrome/views/menu_button.cc
@@ -14,10 +14,10 @@
#include "chrome/common/resource_bundle.h"
#include "chrome/common/win_util.h"
#include "chrome/views/button.h"
-#include "chrome/views/container.h"
#include "chrome/views/event.h"
#include "chrome/views/root_view.h"
#include "chrome/views/view_menu_delegate.h"
+#include "chrome/views/widget.h"
#include "generated_resources.h"
@@ -105,14 +105,14 @@ void MenuButton::Paint(ChromeCanvas* canvas, bool for_drag) {
////////////////////////////////////////////////////////////////////////////////
int MenuButton::GetMaximumScreenXCoordinate() {
- Container* vc = GetContainer();
+ Widget* widget = GetWidget();
- if (!vc) {
+ if (!widget) {
NOTREACHED();
return 0;
}
- HWND hwnd = vc->GetHWND();
+ HWND hwnd = widget->GetHWND();
CRect t;
::GetWindowRect(hwnd, &t);
@@ -158,7 +158,7 @@ bool MenuButton::Activate() {
menu_visible_ = true;
menu_delegate_->RunMenu(this, menu_position.ToPOINT(),
- GetContainer()->GetHWND());
+ GetWidget()->GetHWND());
menu_visible_ = false;
menu_closed_time_ = Time::Now();
diff --git a/chrome/views/native_control.cc b/chrome/views/native_control.cc
index fd81b4f..4236e27 100644
--- a/chrome/views/native_control.cc
+++ b/chrome/views/native_control.cc
@@ -11,11 +11,11 @@
#include "base/win_util.h"
#include "chrome/common/l10n_util.h"
+#include "chrome/views/background.h"
#include "chrome/views/border.h"
-#include "chrome/views/container.h"
#include "chrome/views/focus_manager.h"
#include "chrome/views/hwnd_view.h"
-#include "chrome/views/background.h"
+#include "chrome/views/widget.h"
#include "base/gfx/native_theme.h"
namespace views {
@@ -36,7 +36,7 @@ class NativeControlContainer : public CWindowImpl<NativeControlContainer,
explicit NativeControlContainer(NativeControl* parent) : parent_(parent),
control_(NULL) {
- Create(parent->GetContainer()->GetHWND());
+ Create(parent->GetWidget()->GetHWND());
::ShowWindow(m_hWnd, SW_SHOW);
}
@@ -199,14 +199,14 @@ void NativeControl::ValidateNativeControl() {
void NativeControl::ViewHierarchyChanged(bool is_add, View *parent,
View *child) {
- if (is_add && GetContainer()) {
+ if (is_add && GetWidget()) {
ValidateNativeControl();
Layout();
}
}
void NativeControl::Layout() {
- if (!container_ && GetContainer())
+ if (!container_ && GetWidget())
ValidateNativeControl();
if (hwnd_view_) {
diff --git a/chrome/views/native_scroll_bar.cc b/chrome/views/native_scroll_bar.cc
index fb10520..38f4b8d 100644
--- a/chrome/views/native_scroll_bar.cc
+++ b/chrome/views/native_scroll_bar.cc
@@ -11,8 +11,8 @@
#include <atlframe.h>
#include "base/message_loop.h"
-#include "chrome/views/container.h"
#include "chrome/views/hwnd_view.h"
+#include "chrome/views/widget.h"
namespace views {
@@ -30,7 +30,7 @@ class ScrollBarContainer : public CWindowImpl<ScrollBarContainer,
public:
ScrollBarContainer(ScrollBar* parent) : parent_(parent),
scrollbar_(NULL) {
- Create(parent->GetContainer()->GetHWND());
+ Create(parent->GetWidget()->GetHWND());
::ShowWindow(m_hWnd, SW_SHOW);
}
@@ -126,8 +126,8 @@ class ScrollBarContainer : public CWindowImpl<ScrollBarContainer,
// If we receive an event from the scrollbar, make the view
// component focused so we actually get mousewheel events.
if (source != NULL) {
- Container* vc = parent_->GetContainer();
- if (vc && vc->GetHWND() != GetFocus()) {
+ Widget* widget = parent_->GetWidget();
+ if (widget && widget->GetHWND() != GetFocus()) {
parent_->RequestFocus();
}
}
@@ -227,8 +227,8 @@ NativeScrollBar::~NativeScrollBar() {
void NativeScrollBar::ViewHierarchyChanged(bool is_add, View *parent,
View *child) {
- Container* vc;
- if (is_add && (vc = GetContainer()) && !sb_view_) {
+ Widget* widget;
+ if (is_add && (widget = GetWidget()) && !sb_view_) {
sb_view_ = new HWNDView();
AddChildView(sb_view_);
sb_container_ = new ScrollBarContainer(this);
diff --git a/chrome/views/root_view.cc b/chrome/views/root_view.cc
index 4b4027d..ac59d3f 100644
--- a/chrome/views/root_view.cc
+++ b/chrome/views/root_view.cc
@@ -12,7 +12,7 @@
#include "chrome/common/drag_drop_types.h"
#include "chrome/common/gfx/chrome_canvas.h"
#include "chrome/views/root_view_drop_target.h"
-#include "chrome/views/container.h"
+#include "chrome/views/widget.h"
namespace views {
@@ -51,8 +51,8 @@ const char RootView::kViewClassName[] = "chrome/views/RootView";
//
/////////////////////////////////////////////////////////////////////////////
-RootView::RootView(Container* container)
- : container_(container),
+RootView::RootView(Widget* widget)
+ : widget_(widget),
mouse_pressed_handler_(NULL),
mouse_move_handler_(NULL),
explicit_mouse_handler_(FALSE),
@@ -178,9 +178,9 @@ void RootView::PaintNow() {
}
if (!paint_task_needed_)
return;
- Container* vc = GetContainer();
- if (vc)
- vc->PaintNow(invalid_rect_);
+ Widget* widget = GetWidget();
+ if (widget)
+ widget->PaintNow(invalid_rect_);
}
bool RootView::NeedsPainting(bool urgent) {
@@ -212,8 +212,8 @@ RECT RootView::GetScheduledPaintRectConstrainedToSize() {
//
/////////////////////////////////////////////////////////////////////////////
-Container* RootView::GetContainer() const {
- return container_;
+Widget* RootView::GetWidget() const {
+ return widget_;
}
/////////////////////////////////////////////////////////////////////////////
@@ -311,7 +311,7 @@ bool RootView::OnMousePressed(const MouseEvent& e) {
mouse_pressed_handler_ = NULL;
if (focus_on_mouse_pressed_) {
- HWND hwnd = container_->GetHWND();
+ HWND hwnd = GetWidget()->GetHWND();
if (::GetFocus() != hwnd) {
::SetFocus(hwnd);
}
@@ -327,7 +327,7 @@ bool RootView::ConvertPointToMouseHandler(const gfx::Point& l,
// window. (a non explicit mouse handler is automatically
// cleared when the control is removed from the hierarchy)
if (explicit_mouse_handler_) {
- if (mouse_pressed_handler_->GetContainer()) {
+ if (mouse_pressed_handler_->GetWidget()) {
*p = l;
ConvertPointToScreen(this, p);
ConvertPointToView(NULL, mouse_pressed_handler_, p);
@@ -459,17 +459,17 @@ void RootView::SetMouseHandler(View *new_mh) {
mouse_pressed_handler_ = new_mh;
}
-void RootView::OnContainerCreated() {
+void RootView::OnWidgetCreated() {
DCHECK(!drop_target_.get());
drop_target_ = new RootViewDropTarget(this);
}
-void RootView::OnContainerDestroyed() {
+void RootView::OnWidgetDestroyed() {
if (drop_target_.get()) {
- RevokeDragDrop(GetContainer()->GetHWND());
+ RevokeDragDrop(GetWidget()->GetHWND());
drop_target_ = NULL;
}
- container_ = NULL;
+ widget_ = NULL;
}
void RootView::ProcessMouseDragCanceled() {
@@ -489,7 +489,7 @@ void RootView::FocusView(View* view) {
if (view != GetFocusedView()) {
FocusManager* focus_manager = GetFocusManager();
DCHECK(focus_manager) << "No Focus Manager for Window " <<
- (GetContainer() ? GetContainer()->GetHWND() : 0);
+ (GetWidget() ? GetWidget()->GetHWND() : 0);
if (!focus_manager)
return;
diff --git a/chrome/views/root_view.h b/chrome/views/root_view.h
index d15d354..6c62ba8 100644
--- a/chrome/views/root_view.h
+++ b/chrome/views/root_view.h
@@ -11,9 +11,9 @@
namespace views {
-class Container;
class PaintTask;
class RootViewDropTarget;
+class Widget;
////////////////////////////////////////////////////////////////////////////////
//
@@ -30,13 +30,12 @@ class FocusListener {
//
// RootView class
//
-// The RootView is the root of a View hierarchy. Its parent is not
-// necessarily a Container, but the Container's View child is always a
-// RootView.
+// The RootView is the root of a View hierarchy. A RootView is always the
+// first and only child of a Widget.
//
-// The RootView manages the View hierarchy's interface with the
-// Container, and also maintains the current invalid rect - the region
-// that needs repainting.
+// The RootView manages the View hierarchy's interface with the Widget
+// and also maintains the current invalid rect - the region that needs
+// repainting.
//
/////////////////////////////////////////////////////////////////////////////
class RootView : public View,
@@ -44,7 +43,7 @@ class RootView : public View,
public:
static const char kViewClassName[];
- explicit RootView(Container* container);
+ explicit RootView(Widget* widget);
virtual ~RootView();
@@ -71,8 +70,7 @@ class RootView : public View,
// returns whether this root view needs to paint as soon as possible.
virtual bool NeedsPainting(bool urgent);
- // Invoked by the Container to discover what rectangle should be
- // painted
+ // Invoked by the Widget to discover what rectangle should be painted.
const gfx::Rect& GetScheduledPaintRect();
// Returns the region scheduled to paint clipped to the RootViews bounds.
@@ -80,8 +78,8 @@ class RootView : public View,
// Tree functions
- // Get the Container that hosts this View.
- virtual Container* GetContainer() const;
+ // Get the Widget that hosts this View.
+ virtual Widget* GetWidget() const;
// The following event methods are overridden to propagate event to the
// control tree
@@ -91,24 +89,23 @@ class RootView : public View,
virtual void OnMouseMoved(const MouseEvent& e);
virtual void SetMouseHandler(View* new_mouse_handler);
- // Invoked when the Containers has been fully initialized.
- // At the time the constructor is invoked the Container may not be
- // completely initialized, when this method is invoked, it is.
- void OnContainerCreated();
+ // Invoked when the Widget has been fully initialized.
+ // At the time the constructor is invoked the Widget may not be completely
+ // initialized, when this method is invoked, it is.
+ void OnWidgetCreated();
- // Invoked prior to the Container being destroyed.
- void OnContainerDestroyed();
+ // Invoked prior to the Widget being destroyed.
+ void OnWidgetDestroyed();
- // Invoked By the Container if the mouse drag is interrupted by
+ // Invoked By the Widget if the mouse drag is interrupted by
// the system. Invokes OnMouseReleased with a value of true for canceled.
void ProcessMouseDragCanceled();
- // Invoked by the Container instance when the mouse moves outside of
- // the container bounds
+ // Invoked by the Widget instance when the mouse moves outside of the Widget
+ // bounds.
virtual void ProcessOnMouseExited();
- // Make the provided view focused. Also make sure that our container
- // is focused.
+ // Make the provided view focused. Also make sure that our Widget is focused.
void FocusView(View* view);
// Check whether the provided view is in the focus path. The focus path is the
@@ -167,10 +164,10 @@ class RootView : public View,
virtual std::string GetClassName() const;
// Clears the region that is schedule to be painted. You nearly never need
- // to invoke this. This is primarily intended for Containers.
+ // to invoke this. This is primarily intended for Widgets.
void ClearPaintRect();
- // Invoked from the Container to service a WM_PAINT call.
+ // Invoked from the Widget to service a WM_PAINT call.
void OnPaint(HWND hwnd);
// Returns the MSAA role of the current view. The role is what assistive
@@ -202,7 +199,7 @@ class RootView : public View,
DISALLOW_EVIL_CONSTRUCTORS(RootView);
// Convert a point to our current mouse handler. Returns false if the
- // mouse handler is not connected to a Container. In that case, the
+ // mouse handler is not connected to a Widget. In that case, the
// conversion cannot take place and *p is unchanged
bool ConvertPointToMouseHandler(const gfx::Point& l, gfx::Point *p);
@@ -267,8 +264,8 @@ class RootView : public View,
// The view currently handling enter / exit
View* mouse_move_handler_;
- // The host Container
- Container* container_;
+ // The host Widget
+ Widget* widget_;
// The rectangle that should be painted
gfx::Rect invalid_rect_;
diff --git a/chrome/views/root_view_drop_target.cc b/chrome/views/root_view_drop_target.cc
index c5beedc..8920234 100644
--- a/chrome/views/root_view_drop_target.cc
+++ b/chrome/views/root_view_drop_target.cc
@@ -7,13 +7,13 @@
#include "base/gfx/point.h"
#include "base/logging.h"
#include "chrome/common/drag_drop_types.h"
-#include "chrome/views/container.h"
#include "chrome/views/root_view.h"
+#include "chrome/views/widget.h"
namespace views {
RootViewDropTarget::RootViewDropTarget(RootView* root_view)
- : BaseDropTarget(root_view->GetContainer()->GetHWND()),
+ : BaseDropTarget(root_view->GetWidget()->GetHWND()),
root_view_(root_view),
target_view_(NULL),
deepest_view_(NULL) {
diff --git a/chrome/views/tabbed_pane.cc b/chrome/views/tabbed_pane.cc
index 9fe72a7..2638972 100644
--- a/chrome/views/tabbed_pane.cc
+++ b/chrome/views/tabbed_pane.cc
@@ -16,8 +16,8 @@
#include "chrome/common/stl_util-inl.h"
#include "chrome/common/throb_animation.h"
#include "chrome/views/background.h"
-#include "chrome/views/container_win.h"
#include "chrome/views/root_view.h"
+#include "chrome/views/widget_win.h"
#include "skia/include/SkColor.h"
namespace views {
@@ -167,7 +167,7 @@ HWND TabbedPane::CreateNativeControl(HWND parent_container) {
SendMessage(tab_control_, WM_SETFONT, reinterpret_cast<WPARAM>(font), FALSE);
// Create the view container which is a child of the TabControl.
- content_window_ = new ContainerWin();
+ content_window_ = new WidgetWin();
content_window_->Init(tab_control_, gfx::Rect(), false);
// Explicitly setting the WS_EX_LAYOUTRTL property for the HWND (see above
diff --git a/chrome/views/tabbed_pane.h b/chrome/views/tabbed_pane.h
index fc30765..5e0dd5e 100644
--- a/chrome/views/tabbed_pane.h
+++ b/chrome/views/tabbed_pane.h
@@ -12,7 +12,7 @@ namespace views {
// The TabbedPane class is a view that shows tabs. When the user clicks on a
// tab, the associated view is displayed.
// TODO (jcampan): implement GetPreferredSize().
-class ContainerWin;
+class WidgetWin;
class TabbedPane : public NativeControl {
public:
@@ -75,7 +75,7 @@ class TabbedPane : public NativeControl {
std::vector<View*> tab_views_;
// The window displayed in the tab.
- ContainerWin* content_window_;
+ WidgetWin* content_window_;
// The listener we notify about tab selection changes.
Listener* listener_;
diff --git a/chrome/views/table_view.cc b/chrome/views/table_view.cc
index b67ca49..61d70388 100644
--- a/chrome/views/table_view.cc
+++ b/chrome/views/table_view.cc
@@ -15,7 +15,6 @@
#include "chrome/common/gfx/icon_util.h"
#include "chrome/common/resource_bundle.h"
#include "chrome/common/win_util.h"
-#include "chrome/views/container.h"
#include "chrome/views/hwnd_view.h"
#include "SkBitmap.h"
#include "SkColorFilter.h"
@@ -438,7 +437,7 @@ void TableView::SetColumnVisibility(int id, bool is_visible) {
int index = static_cast<int>(i - visible_columns_.begin());
// This could be called before the native list view has been created
// (in CreateNativeControl, called when the view is added to a
- // container). In that case since the column is not in
+ // Widget). In that case since the column is not in
// visible_columns_ it will not be added later on when it is created.
if (list_view_)
SendMessage(list_view_, LVM_DELETECOLUMN, index, 0);
diff --git a/chrome/views/text_button.cc b/chrome/views/text_button.cc
index a64c2fd..30019c4 100644
--- a/chrome/views/text_button.cc
+++ b/chrome/views/text_button.cc
@@ -10,7 +10,6 @@
#include "chrome/common/throb_animation.h"
#include "chrome/common/win_util.h"
#include "chrome/views/button.h"
-#include "chrome/views/container.h"
#include "chrome/views/event.h"
#include "chrome/views/view_menu_delegate.h"
diff --git a/chrome/views/text_field.cc b/chrome/views/text_field.cc
index 3c64c3d..072ff76 100644
--- a/chrome/views/text_field.cc
+++ b/chrome/views/text_field.cc
@@ -22,9 +22,9 @@
#include "chrome/common/l10n_util.h"
#include "chrome/common/logging_chrome.h"
#include "chrome/common/win_util.h"
-#include "chrome/views/container.h"
#include "chrome/views/hwnd_view.h"
#include "chrome/views/menu.h"
+#include "chrome/views/widget.h"
#include "generated_resources.h"
@@ -267,7 +267,7 @@ TextField::Edit::Edit(TextField* parent, bool draw_border)
DWORD ex_style = l10n_util::GetExtendedStyles();
RECT r = {0, 0, parent_->width(), parent_->height()};
- Create(parent_->GetContainer()->GetHWND(), r, NULL, style, ex_style);
+ Create(parent_->GetWidget()->GetHWND(), r, NULL, style, ex_style);
// Set up the text_object_model_.
CComPtr<IRichEditOle> ole_interface;
@@ -884,9 +884,9 @@ TextField::~TextField() {
}
void TextField::ViewHierarchyChanged(bool is_add, View* parent, View* child) {
- Container* vc;
+ Widget* widget;
- if (is_add && (vc = GetContainer())) {
+ if (is_add && (widget = GetWidget())) {
// This notification is called from the AddChildView call below. Ignore it.
if (native_view_ && !edit_)
return;
diff --git a/chrome/views/tooltip_manager.cc b/chrome/views/tooltip_manager.cc
index ae842bf..2e5c00b 100644
--- a/chrome/views/tooltip_manager.cc
+++ b/chrome/views/tooltip_manager.cc
@@ -13,7 +13,7 @@
#include "chrome/views/root_view.h"
#include "chrome/views/tooltip_manager.h"
#include "chrome/views/view.h"
-#include "chrome/views/container.h"
+#include "chrome/views/widget.h"
namespace views {
@@ -76,8 +76,8 @@ const std::wstring& TooltipManager::GetLineSeparator() {
return *separator;
}
-TooltipManager::TooltipManager(Container* container, HWND parent)
- : container_(container),
+TooltipManager::TooltipManager(Widget* widget, HWND parent)
+ : widget_(widget),
parent_(parent),
last_mouse_x_(-1),
last_mouse_y_(-1),
@@ -88,7 +88,7 @@ TooltipManager::TooltipManager(Container* container, HWND parent)
keyboard_tooltip_hwnd_(NULL),
#pragma warning(suppress: 4355)
keyboard_tooltip_factory_(this) {
- DCHECK(container && parent);
+ DCHECK(widget && parent);
Init();
}
@@ -147,7 +147,7 @@ LRESULT TooltipManager::OnNotify(int w_param, NMHDR* l_param, bool* handled) {
case TTN_GETDISPINFO: {
if (last_view_out_of_sync_) {
// View under the mouse is out of sync, determine it now.
- RootView* root_view = container_->GetRootView();
+ RootView* root_view = widget_->GetRootView();
last_tooltip_view_ = root_view->GetViewForPoint(
gfx::Point(last_mouse_x_, last_mouse_y_));
last_view_out_of_sync_ = false;
@@ -165,7 +165,7 @@ LRESULT TooltipManager::OnNotify(int w_param, NMHDR* l_param, bool* handled) {
tooltip_text_.clear();
// Mouse is over a View, ask the View for it's tooltip.
gfx::Point view_loc(last_mouse_x_, last_mouse_y_);
- View::ConvertPointToView(container_->GetRootView(),
+ View::ConvertPointToView(widget_->GetRootView(),
last_tooltip_view_, &view_loc);
if (last_tooltip_view_->GetTooltipText(view_loc.x(), view_loc.y(),
&tooltip_text_) &&
@@ -194,7 +194,7 @@ LRESULT TooltipManager::OnNotify(int w_param, NMHDR* l_param, bool* handled) {
if (tooltip_height_ == 0)
tooltip_height_ = CalcTooltipHeight();
gfx::Point view_loc(last_mouse_x_, last_mouse_y_);
- View::ConvertPointToView(container_->GetRootView(),
+ View::ConvertPointToView(widget_->GetRootView(),
last_tooltip_view_, &view_loc);
if (last_tooltip_view_->GetTooltipTextOrigin(
view_loc.x(), view_loc.y(), &text_origin) &&
@@ -284,7 +284,7 @@ void TooltipManager::TrimTooltipToFit(std::wstring* text,
// Determine the available width for the tooltip.
gfx::Point screen_loc(position_x, position_y);
- View::ConvertPointToScreen(container_->GetRootView(), &screen_loc);
+ View::ConvertPointToScreen(widget_->GetRootView(), &screen_loc);
gfx::Rect monitor_bounds =
win_util::GetMonitorBoundsForRect(gfx::Rect(screen_loc.x(), screen_loc.y(),
0, 0));
@@ -319,7 +319,7 @@ void TooltipManager::TrimTooltipToFit(std::wstring* text,
}
void TooltipManager::UpdateTooltip(int x, int y) {
- RootView* root_view = container_->GetRootView();
+ RootView* root_view = widget_->GetRootView();
View* view = root_view->GetViewForPoint(gfx::Point(x, y));
if (view != last_tooltip_view_) {
// NOTE: This *must* be sent regardless of the visibility of the tooltip.
@@ -352,7 +352,7 @@ void TooltipManager::OnMouse(UINT u_msg, WPARAM w_param, LPARAM l_param) {
if (u_msg >= WM_NCMOUSEMOVE && u_msg <= WM_NCXBUTTONDBLCLK) {
// NC message coordinates are in screen coordinates.
CRect frame_bounds;
- container_->GetBounds(&frame_bounds, true);
+ widget_->GetBounds(&frame_bounds, true);
x -= frame_bounds.left;
y -= frame_bounds.top;
}
@@ -385,8 +385,7 @@ void TooltipManager::ShowKeyboardTooltip(View* focused_view) {
gfx::Point screen_point;
focused_view->ConvertPointToScreen(focused_view, &screen_point);
gfx::Point relative_point_coordinates;
- focused_view->ConvertPointToContainer(focused_view,
- &relative_point_coordinates);
+ focused_view->ConvertPointToWidget(focused_view, &relative_point_coordinates);
keyboard_tooltip_hwnd_ = CreateWindowEx(
WS_EX_TRANSPARENT | l10n_util::GetExtendedTooltipStyles(),
TOOLTIPS_CLASS, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
diff --git a/chrome/views/tooltip_manager.h b/chrome/views/tooltip_manager.h
index f1aab66a..2800fb0 100644
--- a/chrome/views/tooltip_manager.h
+++ b/chrome/views/tooltip_manager.h
@@ -13,11 +13,11 @@ class ChromeFont;
namespace views {
-class Container;
class View;
+class Widget;
// TooltipManager takes care of the wiring to support tooltips for Views.
-// This class is intended to be used by Containers. To use this, you must
+// This class is intended to be used by Widgets. To use this, you must
// do the following:
// Add the following to your MSG_MAP:
//
@@ -57,8 +57,8 @@ class TooltipManager {
// Returns the separator for lines of text in a tooltip.
static const std::wstring& GetLineSeparator();
- // Creates a TooltipManager for the specified Container and parent window.
- TooltipManager(Container* container, HWND parent);
+ // Creates a TooltipManager for the specified Widget and parent window.
+ TooltipManager(Widget* widget, HWND parent);
virtual ~TooltipManager();
// Notification that the view hierarchy has changed in some way.
@@ -123,8 +123,8 @@ class TooltipManager {
// Invoked when the timer elapses and tooltip has to be destroyed.
void DestroyKeyboardTooltipWindow(HWND window_to_destroy);
- // Hosting view container.
- Container* container_;
+ // Hosting Widget.
+ Widget* widget_;
// The View the mouse is under. This is null if the mouse isn't under a
// View.
diff --git a/chrome/views/tree_view.cc b/chrome/views/tree_view.cc
index 0410ecc..ffb3e4c 100644
--- a/chrome/views/tree_view.cc
+++ b/chrome/views/tree_view.cc
@@ -13,8 +13,8 @@
#include "chrome/common/l10n_util.h"
#include "chrome/common/resource_bundle.h"
#include "chrome/common/stl_util-inl.h"
-#include "chrome/views/container.h"
#include "chrome/views/focus_manager.h"
+#include "chrome/views/widget.h"
namespace views {
@@ -436,9 +436,9 @@ bool TreeView::OnKeyDown(int virtual_key_code) {
}
return true;
} else if (virtual_key_code == VK_RETURN && !process_enter_) {
- Container* vc = GetContainer();
- DCHECK(vc);
- FocusManager* fm = FocusManager::GetFocusManager(vc->GetHWND());
+ Widget* widget = GetWidget();
+ DCHECK(widget);
+ FocusManager* fm = FocusManager::GetFocusManager(widget->GetHWND());
DCHECK(fm);
Accelerator accelerator(Accelerator(static_cast<int>(virtual_key_code),
win_util::IsShiftPressed(),
diff --git a/chrome/views/view.cc b/chrome/views/view.cc
index 4525724..823cb3e 100644
--- a/chrome/views/view.cc
+++ b/chrome/views/view.cc
@@ -22,10 +22,10 @@
#include "chrome/views/accessibility/accessible_wrapper.h"
#include "chrome/views/background.h"
#include "chrome/views/border.h"
-#include "chrome/views/container.h"
#include "chrome/views/layout_manager.h"
#include "chrome/views/root_view.h"
#include "chrome/views/tooltip_manager.h"
+#include "chrome/views/widget.h"
#include "SkShader.h"
namespace views {
@@ -282,11 +282,11 @@ void View::SetFocusable(bool focusable) {
}
FocusManager* View::GetFocusManager() {
- Container* container = GetContainer();
- if (!container)
+ Widget* widget = GetWidget();
+ if (!widget)
return NULL;
- HWND hwnd = container->GetHWND();
+ HWND hwnd = widget->GetHWND();
if (!hwnd)
return NULL;
@@ -748,19 +748,15 @@ View* View::GetViewForPoint(const gfx::Point& point,
return this;
}
-Container* View::GetContainer() const {
- // The root view holds a reference to this view hierarchy's container.
- return parent_ ? parent_->GetContainer() : NULL;
+Widget* View::GetWidget() const {
+ // The root view holds a reference to this view hierarchy's Widget.
+ return parent_ ? parent_->GetWidget() : NULL;
}
// Get the containing RootView
RootView* View::GetRootView() {
- Container* vc = GetContainer();
- if (vc) {
- return vc->GetRootView();
- } else {
- return NULL;
- }
+ Widget* widget = GetWidget();
+ return widget ? widget->GetRootView() : NULL;
}
View* View::GetViewByID(int id) const {
@@ -1291,10 +1287,10 @@ void View::ConvertPointToView(View* src, View* dst, gfx::Point* point,
// If src is NULL, sp is in the screen coordinate system
if (src == NULL) {
- Container* vc = dst->GetContainer();
- if (vc) {
+ Widget* widget = dst->GetWidget();
+ if (widget) {
CRect b;
- vc->GetBounds(&b, false);
+ widget->GetBounds(&b, false);
point->SetPoint(point->x() - b.left, point->y() - b.top);
}
}
@@ -1302,7 +1298,7 @@ void View::ConvertPointToView(View* src, View* dst, gfx::Point* point,
}
// static
-void View::ConvertPointToContainer(View* src, gfx::Point* p) {
+void View::ConvertPointToWidget(View* src, gfx::Point* p) {
DCHECK(src);
DCHECK(p);
@@ -1316,9 +1312,9 @@ void View::ConvertPointToContainer(View* src, gfx::Point* p) {
}
// static
-void View::ConvertPointFromContainer(View *source, gfx::Point* p) {
+void View::ConvertPointFromWidget(View *source, gfx::Point* p) {
gfx::Point t;
- ConvertPointToContainer(source, &t);
+ ConvertPointToWidget(source, &t);
p->SetPoint(p->x() - t.x(), p->y() - t.y());
}
@@ -1328,11 +1324,11 @@ void View::ConvertPointToScreen(View* src, gfx::Point* p) {
DCHECK(p);
// If the view is not connected to a tree, there's nothing we can do.
- Container* vc = src->GetContainer();
- if (vc) {
- ConvertPointToContainer(src, p);
+ Widget* widget = src->GetWidget();
+ if (widget) {
+ ConvertPointToWidget(src, p);
CRect r;
- vc->GetBounds(&r, false);
+ widget->GetBounds(&r, false);
p->SetPoint(p->x() + r.left, p->y() + r.top);
}
}
@@ -1503,7 +1499,7 @@ void View::Focus() {
// messages.
FocusManager* focus_manager = GetFocusManager();
if (focus_manager)
- focus_manager->FocusHWND(GetRootView()->GetContainer()->GetHWND());
+ focus_manager->FocusHWND(GetRootView()->GetWidget()->GetHWND());
}
bool View::CanProcessTabKeyEvents() {
@@ -1520,15 +1516,15 @@ bool View::GetTooltipTextOrigin(int x, int y, gfx::Point* loc) {
}
void View::TooltipTextChanged() {
- Container* view_container = GetContainer();
- if (view_container != NULL && view_container->GetTooltipManager())
- view_container->GetTooltipManager()->TooltipTextChanged(this);
+ Widget* widget = GetWidget();
+ if (widget && widget->GetTooltipManager())
+ widget->GetTooltipManager()->TooltipTextChanged(this);
}
void View::UpdateTooltip() {
- Container* view_container = GetContainer();
- if (view_container != NULL && view_container->GetTooltipManager())
- view_container->GetTooltipManager()->UpdateTooltip();
+ Widget* widget = GetWidget();
+ if (widget && widget->GetTooltipManager())
+ widget->GetTooltipManager()->UpdateTooltip();
}
void View::SetParentOwned(bool f) {
@@ -1549,7 +1545,6 @@ gfx::Rect View::GetVisibleBounds() {
View* view = this;
int root_x = 0;
int root_y = 0;
- bool has_view_container = false;
while (view != NULL && !vis_bounds.IsEmpty()) {
root_x += view->GetX(APPLY_MIRRORING_TRANSFORMATION);
root_y += view->y();
@@ -1559,9 +1554,8 @@ gfx::Rect View::GetVisibleBounds() {
ancestor_bounds.SetRect(0, 0, ancestor->width(),
ancestor->height());
vis_bounds = vis_bounds.Intersect(ancestor_bounds);
- } else if (!view->GetContainer()) {
- // If the view has no Container, we're not visible. Return an empty
- // rect.
+ } else if (!view->GetWidget()) {
+ // If the view has no Widget, we're not visible. Return an empty rect.
return gfx::Rect();
}
view = ancestor;
diff --git a/chrome/views/view.h b/chrome/views/view.h
index d6b16ce..383473f 100644
--- a/chrome/views/view.h
+++ b/chrome/views/view.h
@@ -32,13 +32,13 @@ namespace views {
class Background;
class Border;
-class Container;
class FocusManager;
class FocusTraversable;
class LayoutManager;
class RestoreFocusTask;
class RootView;
class ScrollView;
+class Widget;
// ContextMenuController is responsible for showing the context menu for a
// View. To use a ContextMenuController invoke SetContextMenuController on a
@@ -424,8 +424,8 @@ class View : public AcceleratorTarget {
// Get the child View at the specified point.
virtual View* GetViewForPoint(const gfx::Point& point);
- // Get the Container that hosts this View, if any.
- virtual Container* GetContainer() const;
+ // Get the Widget that hosts this View, if any.
+ virtual Widget* GetWidget() const;
// Get the containing RootView
virtual RootView* GetRootView();
@@ -496,8 +496,8 @@ class View : public AcceleratorTarget {
virtual void SetFocusable(bool focusable);
// Convenience method to retrieve the FocusManager associated with the
- // container window that contains this view. This can return NULL if this
- // view is not part of a view hierarchy with a Container.
+ // Widget that contains this view. This can return NULL if this view is not
+ // part of a view hierarchy with a Widget.
virtual FocusManager* GetFocusManager();
// Sets a keyboard accelerator for that view. When the user presses the
@@ -672,13 +672,13 @@ class View : public AcceleratorTarget {
gfx::Point* point);
// Convert a point from the coordinate system of a View to that of the
- // Container. This is useful for example when sizing HWND children of the
- // Container that don't know about the View hierarchy and need to be placed
- // relative to the Container that is their parent.
- static void ConvertPointToContainer(View* src, gfx::Point* point);
+ // Widget. This is useful for example when sizing HWND children of the
+ // Widget that don't know about the View hierarchy and need to be placed
+ // relative to the Widget that is their parent.
+ static void ConvertPointToWidget(View* src, gfx::Point* point);
- // Convert a point from a view Container to a View dest
- static void ConvertPointFromContainer(View *dest, gfx::Point* p);
+ // Convert a point from a view Widget to a View dest
+ static void ConvertPointFromWidget(View *dest, gfx::Point* p);
// Convert a point from the coordinate system of a View to that of the
// screen. This is useful for example when placing popup windows.
@@ -1050,8 +1050,8 @@ class View : public AcceleratorTarget {
// set and gives an opportunity to subclasses to perform any extra focus steps
// (for example native component set the native focus on their native
// component). The default behavior is to set the native focus on the root
- // view container, which is what is appropriate for views that have no native
- // window associated with them (so the root view gets the keyboard messages).
+ // Widget, which is what is appropriate for views that have no native window
+ // associated with them (so the root view gets the keyboard messages).
virtual void Focus();
// Invoked when a key is pressed before the key event is processed by the
@@ -1171,7 +1171,7 @@ class View : public AcceleratorTarget {
gfx::Point* point,
bool try_other_direction);
- // Propagates UpdateTooltip() to the TooltipManager for the Container.
+ // Propagates UpdateTooltip() to the TooltipManager for the Widget.
// This must be invoked any time the View hierarchy changes in such a way
// the view under the mouse differs. For example, if the bounds of a View is
// changed, this is invoked. Similarly, as Views are added/removed, this
diff --git a/chrome/views/view_unittest.cc b/chrome/views/view_unittest.cc
index e7196a0..48499a3 100644
--- a/chrome/views/view_unittest.cc
+++ b/chrome/views/view_unittest.cc
@@ -285,7 +285,7 @@ TEST_F(ViewTest, MouseEvent) {
TestView* v2 = new TestView();
v2->SetBounds (100, 100, 100, 100);
- views::ContainerWin window;
+ views::WidgetWin window;
window.set_delete_on_destroy(false);
window.set_window_style(WS_OVERLAPPEDWINDOW);
window.Init(NULL, gfx::Rect(50, 50, 650, 650), false);
@@ -359,7 +359,7 @@ TEST_F(ViewTest, Painting) {
RDW_UPDATENOW | RDW_INVALIDATE | RDW_ALLCHILDREN);
bool empty_paint = paint_window.empty_paint();
- views::ContainerWin window;
+ views::WidgetWin window;
window.set_delete_on_destroy(false);
window.set_window_style(WS_OVERLAPPEDWINDOW);
window.Init(NULL, gfx::Rect(50, 50, 650, 650), NULL);
@@ -446,7 +446,7 @@ TEST_F(ViewTest, RemoveNotification) {
NotificationService::current()->AddObserver(
observer.get(), NOTIFY_VIEW_REMOVED, NotificationService::AllSources());
- views::ContainerWin* window = new views::ContainerWin;
+ views::WidgetWin* window = new views::WidgetWin;
views::RootView* root_view = window->GetRootView();
View* v1 = new View;
@@ -550,7 +550,7 @@ gfx::Point ConvertPointToView(views::View* view, const gfx::Point& p) {
}
TEST_F(ViewTest, HitTestMasks) {
- views::ContainerWin window;
+ views::WidgetWin window;
views::RootView* root_view = window.GetRootView();
root_view->SetBounds(0, 0, 500, 500);
diff --git a/chrome/views/views.vcproj b/chrome/views/views.vcproj
index 505186f..104f77b 100644
--- a/chrome/views/views.vcproj
+++ b/chrome/views/views.vcproj
@@ -258,18 +258,6 @@
>
</File>
<File
- RelativePath=".\container.h"
- >
- </File>
- <File
- RelativePath=".\container_win.cc"
- >
- </File>
- <File
- RelativePath=".\container_win.h"
- >
- </File>
- <File
RelativePath=".\controller.h"
>
</File>
@@ -589,10 +577,10 @@
RelativePath=".\tooltip_manager.h"
>
</File>
- <File
- RelativePath=".\tree_model.h"
- >
- </File>
+ <File
+ RelativePath=".\tree_model.h"
+ >
+ </File>
<File
RelativePath=".\tree_node_model.h"
>
@@ -634,6 +622,18 @@
>
</File>
<File
+ RelativePath=".\widget.h"
+ >
+ </File>
+ <File
+ RelativePath=".\widget_win.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\widget_win.h"
+ >
+ </File>
+ <File
RelativePath=".\window.cc"
>
</File>
diff --git a/chrome/views/widget.h b/chrome/views/widget.h
new file mode 100644
index 0000000..221919d
--- /dev/null
+++ b/chrome/views/widget.h
@@ -0,0 +1,87 @@
+// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_VIEWS_WIDGET_H_
+#define CHROME_VIEWS_WIDGET_H_
+
+// TODO(maruel): Remove once HWND is abstracted.
+#include <windows.h>
+
+namespace gfx {
+class Rect;
+}
+
+// TODO(maruel): Remove once gfx::Rect is used instead.
+namespace WTL {
+class CRect;
+}
+using WTL::CRect;
+
+namespace views {
+
+class RootView;
+class TooltipManager;
+class Accelerator;
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// Widget interface
+//
+// Widget is an abstract class that defines the API that should be implemented
+// by a native window in order to host a view hierarchy.
+//
+// Widget wraps a hierarchy of View objects (see view.h) that implement
+// painting and flexible layout within the bounds of the Widget's window.
+//
+// The Widget is responsible for handling various system events and forwarding
+// them to the appropriate view.
+//
+/////////////////////////////////////////////////////////////////////////////
+
+class Widget {
+ public:
+ virtual ~Widget() { }
+
+ // Returns the bounds of this Widget in the screen coordinate system.
+ // If the receiving Widget is a frame which is larger than its client area,
+ // this method returns the client area if including_frame is false and the
+ // frame bounds otherwise. If the receiving Widget is not a frame,
+ // including_frame is ignored.
+ virtual void GetBounds(CRect *out, bool including_frame) const = 0;
+
+ // Moves this Widget to the front of the Z-Order If should_activate is TRUE,
+ // the window should also become the active window.
+ virtual void MoveToFront(bool should_activate) = 0;
+
+ // Returns the Window HWND associated with this Widget.
+ virtual HWND GetHWND() const = 0;
+
+ // Forces a paint of a specified rectangle immediately.
+ virtual void PaintNow(const gfx::Rect& update_rect) = 0;
+
+ // Returns the RootView contained by this Widget.
+ virtual RootView* GetRootView() = 0;
+
+ // Returns whether the Widget is visible to the user.
+ virtual bool IsVisible() = 0;
+
+ // Returns whether the Widget is the currently active window.
+ virtual bool IsActive() = 0;
+
+ // Returns the TooltipManager for this Widget. If this Widget does not support
+ // tooltips, NULL is returned.
+ virtual TooltipManager* GetTooltipManager() {
+ return NULL;
+ }
+
+ // Returns the accelerator given a command id. Returns false if there is
+ // no accelerator associated with a given id, which is a common condition.
+ virtual bool GetAccelerator(int cmd_id,
+ Accelerator* accelerator) = 0;
+};
+
+} // namespace views
+
+#endif // CHROME_VIEWS_WIDGET_H_
+
diff --git a/chrome/views/container_win.cc b/chrome/views/widget_win.cc
index dc011742..cd0e913 100644
--- a/chrome/views/container_win.cc
+++ b/chrome/views/widget_win.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/views/container_win.h"
+#include "chrome/views/widget_win.h"
#include "base/gfx/native_theme.h"
#include "base/string_util.h"
@@ -33,12 +33,12 @@ RootView* GetRootViewForHWND(HWND hwnd) {
return reinterpret_cast<RootView*>(::GetProp(hwnd, kRootViewWindowProperty));
}
-// Used to locate the ContainerWin issuing the current Create. Only valid for
-// the life of Create.
+// Used to locate the WidgetWin issuing the current Create. Only valid for the
+// life of Create.
//
-// This obviously assumes we only create ContainerWins from the same thread,
+// This obviously assumes we only create WidgetWins from the same thread,
// which is currently the case.
-static ContainerWin* instance_issuing_create = NULL;
+static WidgetWin* instance_issuing_create = NULL;
///////////////////////////////////////////////////////////////////////////////
// FillLayout
@@ -66,8 +66,8 @@ gfx::Size FillLayout::GetPreferredSize(View* host) {
// Window class tracking.
// static
-const wchar_t* const ContainerWin::kBaseClassName =
- L"Chrome_ContainerWin_";
+const wchar_t* const WidgetWin::kBaseClassName =
+ L"Chrome_WidgetWin_";
// Window class information used for registering unique windows.
struct ClassInfo {
@@ -111,9 +111,9 @@ static RegisteredClasses* registered_classes = NULL;
///////////////////////////////////////////////////////////////////////////////
-// ContainerWin, public
+// WidgetWin, public
-ContainerWin::ContainerWin()
+WidgetWin::WidgetWin()
: active_mouse_tracking_flags_(0),
has_capture_(false),
current_action_(FA_NONE),
@@ -128,15 +128,15 @@ ContainerWin::ContainerWin()
is_mouse_down_(false),
class_style_(CS_DBLCLKS),
hwnd_(NULL),
- close_container_factory_(this) {
+ close_widget_factory_(this) {
}
-ContainerWin::~ContainerWin() {
+WidgetWin::~WidgetWin() {
MessageLoopForUI::current()->RemoveObserver(this);
}
-void ContainerWin::Init(HWND parent, const gfx::Rect& bounds,
- bool has_own_focus_manager) {
+void WidgetWin::Init(HWND parent, const gfx::Rect& bounds,
+ bool has_own_focus_manager) {
toplevel_ = parent == NULL;
if (window_style_ == 0)
@@ -163,7 +163,7 @@ void ContainerWin::Init(HWND parent, const gfx::Rect& bounds,
// The window procedure should have set the data for us.
DCHECK(win_util::GetWindowUserData(hwnd_) == this);
- root_view_->OnContainerCreated();
+ root_view_->OnWidgetCreated();
if (has_own_focus_manager) {
FocusManager::CreateFocusManager(hwnd_, GetRootView());
@@ -199,10 +199,10 @@ void ContainerWin::Init(HWND parent, const gfx::Rect& bounds,
::ImmAssociateContextEx(GetHWND(), NULL, 0);
}
-void ContainerWin::SetContentsView(View* view) {
+void WidgetWin::SetContentsView(View* view) {
DCHECK(view && hwnd_) << "Can't be called until after the HWND is created!";
// The ContentsView must be set up _after_ the window is created so that its
- // Container pointer is valid.
+ // Widget pointer is valid.
root_view_->SetLayoutManager(new FillLayout);
if (root_view_->GetChildViewCount() != 0)
root_view_->RemoveAllChildViews(true);
@@ -215,9 +215,9 @@ void ContainerWin::SetContentsView(View* view) {
}
///////////////////////////////////////////////////////////////////////////////
-// Container implementation:
+// Widget implementation:
-void ContainerWin::GetBounds(CRect *out, bool including_frame) const {
+void WidgetWin::GetBounds(CRect *out, bool including_frame) const {
if (including_frame) {
GetWindowRect(out);
} else {
@@ -233,7 +233,7 @@ void ContainerWin::GetBounds(CRect *out, bool including_frame) const {
}
}
-void ContainerWin::MoveToFront(bool should_activate) {
+void WidgetWin::MoveToFront(bool should_activate) {
int flags = SWP_NOMOVE | SWP_NOSIZE;
if (!should_activate) {
flags |= SWP_NOACTIVATE;
@@ -241,11 +241,11 @@ void ContainerWin::MoveToFront(bool should_activate) {
SetWindowPos(HWND_NOTOPMOST, 0, 0, 0, 0, flags);
}
-HWND ContainerWin::GetHWND() const {
+HWND WidgetWin::GetHWND() const {
return hwnd_;
}
-void ContainerWin::PaintNow(const gfx::Rect& update_rect) {
+void WidgetWin::PaintNow(const gfx::Rect& update_rect) {
if (layered_) {
PaintLayeredWindow();
} else if (root_view_->NeedsPainting(false) && IsWindow()) {
@@ -274,7 +274,7 @@ void ContainerWin::PaintNow(const gfx::Rect& update_rect) {
}
}
-RootView* ContainerWin::GetRootView() {
+RootView* WidgetWin::GetRootView() {
if (!root_view_.get()) {
// First time the root view is being asked for, create it now.
root_view_.reset(CreateRootView());
@@ -282,20 +282,20 @@ RootView* ContainerWin::GetRootView() {
return root_view_.get();
}
-bool ContainerWin::IsVisible() {
+bool WidgetWin::IsVisible() {
return !!::IsWindowVisible(GetHWND());
}
-bool ContainerWin::IsActive() {
+bool WidgetWin::IsActive() {
return win_util::IsWindowActive(GetHWND());
}
-TooltipManager* ContainerWin::GetTooltipManager() {
+TooltipManager* WidgetWin::GetTooltipManager() {
return tooltip_manager_.get();
}
-void ContainerWin::SetLayeredAlpha(BYTE layered_alpha) {
+void WidgetWin::SetLayeredAlpha(BYTE layered_alpha) {
layered_alpha_ = layered_alpha;
// if (hwnd_)
@@ -313,7 +313,7 @@ static BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM l_param) {
}
// static
-RootView* ContainerWin::FindRootView(HWND hwnd) {
+RootView* WidgetWin::FindRootView(HWND hwnd) {
RootView* root_view =
reinterpret_cast<RootView*>(GetProp(hwnd, kRootViewWindowProperty));
if (root_view)
@@ -325,21 +325,21 @@ RootView* ContainerWin::FindRootView(HWND hwnd) {
return root_view;
}
-void ContainerWin::Close() {
+void WidgetWin::Close() {
// Let's hide ourselves right away.
Hide();
- if (close_container_factory_.empty()) {
+ if (close_widget_factory_.empty()) {
// And we delay the close so that if we are called from an ATL callback,
// we don't destroy the window before the callback returned (as the caller
// may delete ourselves on destroy and the ATL callback would still
// dereference us when the callback returns).
MessageLoop::current()->PostTask(FROM_HERE,
- close_container_factory_.NewRunnableMethod(
- &ContainerWin::CloseNow));
+ close_widget_factory_.NewRunnableMethod(
+ &WidgetWin::CloseNow));
}
}
-void ContainerWin::Hide() {
+void WidgetWin::Hide() {
// NOTE: Be careful not to activate any windows here (for example, calling
// ShowWindow(SW_HIDE) will automatically activate another window). This
// code can be called while a window is being deactivated, and activating
@@ -349,7 +349,7 @@ void ContainerWin::Hide() {
SWP_NOREPOSITION | SWP_NOSIZE | SWP_NOZORDER);
}
-void ContainerWin::CloseNow() {
+void WidgetWin::CloseNow() {
// We may already have been destroyed if the selection resulted in a tab
// switch which will have reactivated the browser window and closed us, so
// we need to check to see if we're still a window before trying to destroy
@@ -361,10 +361,10 @@ void ContainerWin::CloseNow() {
///////////////////////////////////////////////////////////////////////////////
// MessageLoop::Observer
-void ContainerWin::WillProcessMessage(const MSG& msg) {
+void WidgetWin::WillProcessMessage(const MSG& msg) {
}
-void ContainerWin::DidProcessMessage(const MSG& msg) {
+void WidgetWin::DidProcessMessage(const MSG& msg) {
if (root_view_->NeedsPainting(true)) {
PaintNow(root_view_->GetScheduledPaintRect());
}
@@ -373,7 +373,7 @@ void ContainerWin::DidProcessMessage(const MSG& msg) {
///////////////////////////////////////////////////////////////////////////////
// FocusTraversable
-View* ContainerWin::FindNextFocusableView(
+View* WidgetWin::FindNextFocusableView(
View* starting_view, bool reverse, Direction direction, bool dont_loop,
FocusTraversable** focus_traversable, View** focus_traversable_view) {
return root_view_->FindNextFocusableView(starting_view,
@@ -384,32 +384,32 @@ View* ContainerWin::FindNextFocusableView(
focus_traversable_view);
}
-FocusTraversable* ContainerWin::GetFocusTraversableParent() {
+FocusTraversable* WidgetWin::GetFocusTraversableParent() {
// We are a proxy to the root view, so we should be bypassed when traversing
// up and as a result this should not be called.
NOTREACHED();
return NULL;
}
-void ContainerWin::SetFocusTraversableParent(FocusTraversable* parent) {
+void WidgetWin::SetFocusTraversableParent(FocusTraversable* parent) {
root_view_->SetFocusTraversableParent(parent);
}
-View* ContainerWin::GetFocusTraversableParentView() {
+View* WidgetWin::GetFocusTraversableParentView() {
// We are a proxy to the root view, so we should be bypassed when traversing
// up and as a result this should not be called.
NOTREACHED();
return NULL;
}
-void ContainerWin::SetFocusTraversableParentView(View* parent_view) {
+void WidgetWin::SetFocusTraversableParentView(View* parent_view) {
root_view_->SetFocusTraversableParentView(parent_view);
}
///////////////////////////////////////////////////////////////////////////////
// Message handlers
-void ContainerWin::OnCaptureChanged(HWND hwnd) {
+void WidgetWin::OnCaptureChanged(HWND hwnd) {
if (has_capture_) {
if (is_mouse_down_)
root_view_->ProcessMouseDragCanceled();
@@ -418,11 +418,9 @@ void ContainerWin::OnCaptureChanged(HWND hwnd) {
}
}
-void ContainerWin::OnClose() {
- // WARNING: this method is NOT called for all ContainerWins. If you need to
- // do cleanup code before ContainerWin is destroyed, put it in
- // OnDestroy.
-
+void WidgetWin::OnClose() {
+ // WARNING: this method is NOT called for all WidgetWins. If you need to do
+ // cleanup code before WidgetWin is destroyed, put it in OnDestroy.
NotificationService::current()->Notify(
NOTIFY_WINDOW_CLOSED, Source<HWND>(hwnd_),
NotificationService::NoDetails());
@@ -430,18 +428,18 @@ void ContainerWin::OnClose() {
Close();
}
-void ContainerWin::OnDestroy() {
- root_view_->OnContainerDestroyed();
+void WidgetWin::OnDestroy() {
+ root_view_->OnWidgetDestroyed();
RemoveProp(hwnd_, kRootViewWindowProperty);
}
-LRESULT ContainerWin::OnEraseBkgnd(HDC dc) {
+LRESULT WidgetWin::OnEraseBkgnd(HDC dc) {
// This is needed for magical win32 flicker ju-ju
return 1;
}
-LRESULT ContainerWin::OnGetObject(UINT uMsg, WPARAM w_param, LPARAM l_param) {
+LRESULT WidgetWin::OnGetObject(UINT uMsg, WPARAM w_param, LPARAM l_param) {
LRESULT reference_result = static_cast<LRESULT>(0L);
// Accessibility readers will send an OBJID_CLIENT message
@@ -487,58 +485,58 @@ LRESULT ContainerWin::OnGetObject(UINT uMsg, WPARAM w_param, LPARAM l_param) {
return reference_result;
}
-void ContainerWin::OnKeyDown(TCHAR c, UINT rep_cnt, UINT flags) {
+void WidgetWin::OnKeyDown(TCHAR c, UINT rep_cnt, UINT flags) {
KeyEvent event(Event::ET_KEY_PRESSED, c, rep_cnt, flags);
root_view_->ProcessKeyEvent(event);
}
-void ContainerWin::OnKeyUp(TCHAR c, UINT rep_cnt, UINT flags) {
+void WidgetWin::OnKeyUp(TCHAR c, UINT rep_cnt, UINT flags) {
KeyEvent event(Event::ET_KEY_RELEASED, c, rep_cnt, flags);
root_view_->ProcessKeyEvent(event);
}
-void ContainerWin::OnLButtonDown(UINT flags, const CPoint& point) {
+void WidgetWin::OnLButtonDown(UINT flags, const CPoint& point) {
ProcessMousePressed(point, flags | MK_LBUTTON, false);
}
-void ContainerWin::OnLButtonUp(UINT flags, const CPoint& point) {
+void WidgetWin::OnLButtonUp(UINT flags, const CPoint& point) {
ProcessMouseReleased(point, flags | MK_LBUTTON);
}
-void ContainerWin::OnLButtonDblClk(UINT flags, const CPoint& point) {
+void WidgetWin::OnLButtonDblClk(UINT flags, const CPoint& point) {
ProcessMousePressed(point, flags | MK_LBUTTON, true);
}
-void ContainerWin::OnMButtonDown(UINT flags, const CPoint& point) {
+void WidgetWin::OnMButtonDown(UINT flags, const CPoint& point) {
ProcessMousePressed(point, flags | MK_MBUTTON, false);
}
-void ContainerWin::OnMButtonUp(UINT flags, const CPoint& point) {
+void WidgetWin::OnMButtonUp(UINT flags, const CPoint& point) {
ProcessMouseReleased(point, flags | MK_MBUTTON);
}
-void ContainerWin::OnMButtonDblClk(UINT flags, const CPoint& point) {
+void WidgetWin::OnMButtonDblClk(UINT flags, const CPoint& point) {
ProcessMousePressed(point, flags | MK_MBUTTON, true);
}
-LRESULT ContainerWin::OnMouseActivate(HWND window, UINT hittest_code,
- UINT message) {
+LRESULT WidgetWin::OnMouseActivate(HWND window, UINT hittest_code,
+ UINT message) {
SetMsgHandled(FALSE);
return MA_ACTIVATE;
}
-void ContainerWin::OnMouseMove(UINT flags, const CPoint& point) {
+void WidgetWin::OnMouseMove(UINT flags, const CPoint& point) {
ProcessMouseMoved(point, flags, false);
}
-LRESULT ContainerWin::OnMouseLeave(UINT uMsg, WPARAM w_param, LPARAM l_param) {
+LRESULT WidgetWin::OnMouseLeave(UINT uMsg, WPARAM w_param, LPARAM l_param) {
tooltip_manager_->OnMouseLeave();
ProcessMouseExited();
return 0;
}
-LRESULT ContainerWin::OnMouseWheel(UINT flags, short distance,
- const CPoint& point) {
+LRESULT WidgetWin::OnMouseWheel(UINT flags, short distance,
+ const CPoint& point) {
MouseWheelEvent e(distance,
point.x,
point.y,
@@ -546,43 +544,42 @@ LRESULT ContainerWin::OnMouseWheel(UINT flags, short distance,
return root_view_->ProcessMouseWheelEvent(e) ? 0 : 1;
}
-LRESULT ContainerWin::OnMouseRange(UINT msg, WPARAM w_param, LPARAM l_param) {
+LRESULT WidgetWin::OnMouseRange(UINT msg, WPARAM w_param, LPARAM l_param) {
tooltip_manager_->OnMouse(msg, w_param, l_param);
SetMsgHandled(FALSE);
return 0;
}
-void ContainerWin::OnNCLButtonDblClk(UINT flags, const CPoint& point) {
+void WidgetWin::OnNCLButtonDblClk(UINT flags, const CPoint& point) {
SetMsgHandled(FALSE);
}
-void ContainerWin::OnNCLButtonDown(UINT flags, const CPoint& point) {
+void WidgetWin::OnNCLButtonDown(UINT flags, const CPoint& point) {
SetMsgHandled(FALSE);
}
-void ContainerWin::OnNCLButtonUp(UINT flags, const CPoint& point) {
+void WidgetWin::OnNCLButtonUp(UINT flags, const CPoint& point) {
SetMsgHandled(FALSE);
}
-void ContainerWin::OnNCMButtonDblClk(UINT flags, const CPoint& point) {
+void WidgetWin::OnNCMButtonDblClk(UINT flags, const CPoint& point) {
SetMsgHandled(FALSE);
}
-void ContainerWin::OnNCMButtonDown(UINT flags, const CPoint& point) {
+void WidgetWin::OnNCMButtonDown(UINT flags, const CPoint& point) {
SetMsgHandled(FALSE);
}
-void ContainerWin::OnNCMButtonUp(UINT flags, const CPoint& point) {
+void WidgetWin::OnNCMButtonUp(UINT flags, const CPoint& point) {
SetMsgHandled(FALSE);
}
-LRESULT ContainerWin::OnNCMouseLeave(UINT uMsg, WPARAM w_param,
- LPARAM l_param) {
+LRESULT WidgetWin::OnNCMouseLeave(UINT uMsg, WPARAM w_param, LPARAM l_param) {
ProcessMouseExited();
return 0;
}
-LRESULT ContainerWin::OnNCMouseMove(UINT flags, const CPoint& point) {
+LRESULT WidgetWin::OnNCMouseMove(UINT flags, const CPoint& point) {
// NC points are in screen coordinates.
CPoint temp = point;
MapWindowPoints(HWND_DESKTOP, GetHWND(), &temp, 1);
@@ -594,19 +591,19 @@ LRESULT ContainerWin::OnNCMouseMove(UINT flags, const CPoint& point) {
return 0;
}
-void ContainerWin::OnNCRButtonDblClk(UINT flags, const CPoint& point) {
+void WidgetWin::OnNCRButtonDblClk(UINT flags, const CPoint& point) {
SetMsgHandled(FALSE);
}
-void ContainerWin::OnNCRButtonDown(UINT flags, const CPoint& point) {
+void WidgetWin::OnNCRButtonDown(UINT flags, const CPoint& point) {
SetMsgHandled(FALSE);
}
-void ContainerWin::OnNCRButtonUp(UINT flags, const CPoint& point) {
+void WidgetWin::OnNCRButtonUp(UINT flags, const CPoint& point) {
SetMsgHandled(FALSE);
}
-LRESULT ContainerWin::OnNotify(int w_param, NMHDR* l_param) {
+LRESULT WidgetWin::OnNotify(int w_param, NMHDR* l_param) {
// We can be sent this message before the tooltip manager is created, if a
// subclass overrides OnCreate and creates some kind of Windows control there
// that sends WM_NOTIFY messages.
@@ -620,24 +617,23 @@ LRESULT ContainerWin::OnNotify(int w_param, NMHDR* l_param) {
return 0;
}
-void ContainerWin::OnPaint(HDC dc) {
+void WidgetWin::OnPaint(HDC dc) {
root_view_->OnPaint(GetHWND());
}
-void ContainerWin::OnRButtonDown(UINT flags, const CPoint& point) {
+void WidgetWin::OnRButtonDown(UINT flags, const CPoint& point) {
ProcessMousePressed(point, flags | MK_RBUTTON, false);
}
-void ContainerWin::OnRButtonUp(UINT flags, const CPoint& point) {
+void WidgetWin::OnRButtonUp(UINT flags, const CPoint& point) {
ProcessMouseReleased(point, flags | MK_RBUTTON);
}
-void ContainerWin::OnRButtonDblClk(UINT flags, const CPoint& point) {
+void WidgetWin::OnRButtonDblClk(UINT flags, const CPoint& point) {
ProcessMousePressed(point, flags | MK_RBUTTON, true);
}
-LRESULT ContainerWin::OnSettingChange(UINT msg, WPARAM w_param,
- LPARAM l_param) {
+LRESULT WidgetWin::OnSettingChange(UINT msg, WPARAM w_param, LPARAM l_param) {
if (toplevel_) {
SetMsgHandled(FALSE);
if (w_param != SPI_SETWORKAREA)
@@ -650,24 +646,24 @@ LRESULT ContainerWin::OnSettingChange(UINT msg, WPARAM w_param,
return 0;
}
-void ContainerWin::OnSize(UINT param, const CSize& size) {
+void WidgetWin::OnSize(UINT param, const CSize& size) {
ChangeSize(param, size);
}
-void ContainerWin::OnThemeChanged() {
+void WidgetWin::OnThemeChanged() {
// Notify NativeTheme.
gfx::NativeTheme::instance()->CloseHandles();
}
-void ContainerWin::OnFinalMessage(HWND window) {
+void WidgetWin::OnFinalMessage(HWND window) {
if (delete_on_destroy_)
delete this;
}
///////////////////////////////////////////////////////////////////////////////
-// ContainerWin, protected:
+// WidgetWin, protected:
-void ContainerWin::TrackMouseEvents(DWORD mouse_tracking_flags) {
+void WidgetWin::TrackMouseEvents(DWORD mouse_tracking_flags) {
// Begin tracking mouse events for this HWND so that we get WM_MOUSELEAVE
// when the user moves the mouse outside this HWND's bounds.
if (active_mouse_tracking_flags_ == 0 || mouse_tracking_flags & TME_CANCEL) {
@@ -691,8 +687,8 @@ void ContainerWin::TrackMouseEvents(DWORD mouse_tracking_flags) {
}
}
-bool ContainerWin::ProcessMousePressed(const CPoint& point, UINT flags,
- bool dbl_click) {
+bool WidgetWin::ProcessMousePressed(const CPoint& point, UINT flags,
+ bool dbl_click) {
last_mouse_event_was_move_ = false;
MouseEvent mouse_pressed(Event::ET_MOUSE_PRESSED,
point.x,
@@ -711,7 +707,7 @@ bool ContainerWin::ProcessMousePressed(const CPoint& point, UINT flags,
return false;
}
-void ContainerWin::ProcessMouseDragged(const CPoint& point, UINT flags) {
+void WidgetWin::ProcessMouseDragged(const CPoint& point, UINT flags) {
last_mouse_event_was_move_ = false;
MouseEvent mouse_drag(Event::ET_MOUSE_DRAGGED,
point.x,
@@ -720,7 +716,7 @@ void ContainerWin::ProcessMouseDragged(const CPoint& point, UINT flags) {
root_view_->OnMouseDragged(mouse_drag);
}
-void ContainerWin::ProcessMouseReleased(const CPoint& point, UINT flags) {
+void WidgetWin::ProcessMouseReleased(const CPoint& point, UINT flags) {
last_mouse_event_was_move_ = false;
MouseEvent mouse_up(Event::ET_MOUSE_RELEASED,
point.x,
@@ -737,8 +733,8 @@ void ContainerWin::ProcessMouseReleased(const CPoint& point, UINT flags) {
root_view_->OnMouseReleased(mouse_up, false);
}
-void ContainerWin::ProcessMouseMoved(const CPoint &point, UINT flags,
- bool is_nonclient) {
+void WidgetWin::ProcessMouseMoved(const CPoint &point, UINT flags,
+ bool is_nonclient) {
// Windows only fires WM_MOUSELEAVE events if the application begins
// "tracking" mouse events for a given HWND during WM_MOUSEMOVE events.
// We need to call |TrackMouseEvents| to listen for WM_MOUSELEAVE.
@@ -765,15 +761,15 @@ void ContainerWin::ProcessMouseMoved(const CPoint &point, UINT flags,
}
}
-void ContainerWin::ProcessMouseExited() {
+void WidgetWin::ProcessMouseExited() {
last_mouse_event_was_move_ = false;
root_view_->ProcessOnMouseExited();
- // Reset our tracking flag so that future mouse movement over this
- // ContainerWin results in a new tracking session.
+ // Reset our tracking flag so that future mouse movement over this WidgetWin
+ // results in a new tracking session.
active_mouse_tracking_flags_ = 0;
}
-void ContainerWin::AdjustWindowToFitScreenSize() {
+void WidgetWin::AdjustWindowToFitScreenSize() {
// Desktop size has changed. Make sure we're still on screen.
CRect wr;
GetWindowRect(&wr);
@@ -801,7 +797,7 @@ void ContainerWin::AdjustWindowToFitScreenSize() {
}
}
-void ContainerWin::ChangeSize(UINT size_param, const CSize& size) {
+void WidgetWin::ChangeSize(UINT size_param, const CSize& size) {
CRect rect;
if (layered_) {
GetWindowRect(&rect);
@@ -820,20 +816,20 @@ void ContainerWin::ChangeSize(UINT size_param, const CSize& size) {
PaintNow(gfx::Rect(rect));
}
-RootView* ContainerWin::CreateRootView() {
+RootView* WidgetWin::CreateRootView() {
return new RootView(this);
}
///////////////////////////////////////////////////////////////////////////////
-// ContainerWin, private:
+// WidgetWin, private:
-void ContainerWin::SizeContents(const CRect& window_rect) {
+void WidgetWin::SizeContents(const CRect& window_rect) {
contents_.reset(new ChromeCanvas(window_rect.Width(),
window_rect.Height(),
false));
}
-void ContainerWin::PaintLayeredWindow() {
+void WidgetWin::PaintLayeredWindow() {
// Painting monkeys with our cliprect, so we need to save it so that the
// call to UpdateLayeredWindow updates the entire window, not just the
// cliprect.
@@ -847,7 +843,7 @@ void ContainerWin::PaintLayeredWindow() {
UpdateWindowFromContents(contents_->getTopPlatformDevice().getBitmapDC());
}
-void ContainerWin::UpdateWindowFromContents(HDC dib_dc) {
+void WidgetWin::UpdateWindowFromContents(HDC dib_dc) {
DCHECK(layered_);
if (can_update_layered_window_) {
CRect wr;
@@ -863,7 +859,7 @@ void ContainerWin::UpdateWindowFromContents(HDC dib_dc) {
}
}
-std::wstring ContainerWin::GetWindowClassName() {
+std::wstring WidgetWin::GetWindowClassName() {
if (!registered_classes)
registered_classes = new RegisteredClasses();
ClassInfo class_info(initial_class_style());
@@ -880,7 +876,7 @@ std::wstring ContainerWin::GetWindowClassName() {
WNDCLASSEX class_ex;
class_ex.cbSize = sizeof(WNDCLASSEX);
class_ex.style = class_info.style;
- class_ex.lpfnWndProc = &ContainerWin::WndProc;
+ class_ex.lpfnWndProc = &WidgetWin::WndProc;
class_ex.cbClsExtra = 0;
class_ex.cbWndExtra = 0;
class_ex.hInstance = NULL;
@@ -899,27 +895,26 @@ std::wstring ContainerWin::GetWindowClassName() {
}
// static
-LRESULT CALLBACK ContainerWin::WndProc(HWND window, UINT message,
- WPARAM w_param, LPARAM l_param) {
+LRESULT CALLBACK WidgetWin::WndProc(HWND window, UINT message,
+ WPARAM w_param, LPARAM l_param) {
if (message == WM_NCCREATE) {
CREATESTRUCT* cs = reinterpret_cast<CREATESTRUCT*>(l_param);
- ContainerWin* vc =
- reinterpret_cast<ContainerWin*>(cs->lpCreateParams);
- DCHECK(vc);
- win_util::SetWindowUserData(window, vc);
- vc->hwnd_ = window;
+ WidgetWin* widget = reinterpret_cast<WidgetWin*>(cs->lpCreateParams);
+ DCHECK(widget);
+ win_util::SetWindowUserData(window, widget);
+ widget->hwnd_ = window;
return TRUE;
}
- ContainerWin* vc = reinterpret_cast<ContainerWin*>(
+ WidgetWin* widget = reinterpret_cast<WidgetWin*>(
win_util::GetWindowUserData(window));
- if (!vc)
+ if (!widget)
return 0;
LRESULT result = 0;
- if (!vc->ProcessWindowMessage(window, message, w_param, l_param, result))
+ if (!widget->ProcessWindowMessage(window, message, w_param, l_param, result))
result = DefWindowProc(window, message, w_param, l_param);
if (message == WM_NCDESTROY) {
- vc->hwnd_ = NULL;
- vc->OnFinalMessage(window);
+ widget->hwnd_ = NULL;
+ widget->OnFinalMessage(window);
}
return result;
}
diff --git a/chrome/views/container_win.h b/chrome/views/widget_win.h
index 84309b9..9e402e8 100644
--- a/chrome/views/container_win.h
+++ b/chrome/views/widget_win.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_VIEWS_CONTAINER_WIN_H_
-#define CHROME_VIEWS_CONTAINER_WIN_H_
+#ifndef CHROME_VIEWS_WIDGET_WIN_H_
+#define CHROME_VIEWS_WIDGET_WIN_H_
#include <atlbase.h>
#include <atlcrack.h>
@@ -11,7 +11,7 @@
#include "base/message_loop.h"
#include "chrome/views/focus_manager.h"
#include "chrome/views/layout_manager.h"
-#include "chrome/views/container.h"
+#include "chrome/views/widget.h"
class ChromeCanvas;
@@ -68,34 +68,28 @@ class FillLayout : public LayoutManager {
///////////////////////////////////////////////////////////////////////////////
//
-// ContainerWin
-// A container for a views hierarchy used to represent anything that can be
+// WidgetWin
+// A Widget for a views hierarchy used to represent anything that can be
// contained within an HWND, e.g. a control, a window, etc. Specializations
// suitable for specific tasks, e.g. top level window, are derived from this.
//
-// This Container contains a RootView which owns the hierarchy of views
-// within it. As long as views are part of this tree, they will be deleted
-// automatically when the RootView is destroyed. If you remove a view from the
-// tree, you are then responsible for cleaning up after it.
-//
-// Note: We try and keep this API platform-neutral, since to some extent we
-// consider this the boundary between the platform and potentially cross
-// platform views code. In some cases this isn't true, primarily
-// because of other code that has not yet been refactored to maintain
-// this <controller>-<view>-<platform-specific-view> separation.
+// This Widget contains a RootView which owns the hierarchy of views within it.
+// As long as views are part of this tree, they will be deleted automatically
+// when the RootView is destroyed. If you remove a view from the tree, you are
+// then responsible for cleaning up after it.
//
///////////////////////////////////////////////////////////////////////////////
-class ContainerWin : public Container,
- public MessageLoopForUI::Observer,
- public FocusTraversable,
- public AcceleratorTarget {
+class WidgetWin : public Widget,
+ public MessageLoopForUI::Observer,
+ public FocusTraversable,
+ public AcceleratorTarget {
public:
- ContainerWin();
- virtual ~ContainerWin();
+ WidgetWin();
+ virtual ~WidgetWin();
- // Initialize the container with a parent and an initial desired size.
+ // Initialize the Widget with a parent and an initial desired size.
// |contents_view| is the view that will be the single child of RootView
- // within this Container. As contents_view is inserted into RootView's tree,
+ // within this Widget. As contents_view is inserted into RootView's tree,
// RootView assumes ownership of this view and cleaning it up. If you remove
// this view, you are responsible for its destruction. If this value is NULL,
// the caller is responsible for populating the RootView, and sizing its
@@ -106,10 +100,10 @@ class ContainerWin : public Container,
const gfx::Rect& bounds,
bool has_own_focus_manager);
- // Sets the specified view as the contents of this Container. There can only
- // be one contnets view child of this Container's RootView. This view is
- // sized to fit the entire size of the RootView. The RootView takes ownership
- // of this View, unless it is set as not being parent-owned.
+ // Sets the specified view as the contents of this Widget. There can only
+ // be one contnets view child of this Widget's RootView. This view is sized to
+ // fit the entire size of the RootView. The RootView takes ownership of this
+ // View, unless it is set as not being parent-owned.
virtual void SetContentsView(View* view);
// Sets the window styles. This is ONLY used when the window is created.
@@ -155,11 +149,11 @@ class ContainerWin : public Container,
virtual void Hide();
// Closes the window synchronously. Note that this should not be called from
- // an ATL message callback as it deletes the ContainerWin and ATL will
+ // an ATL message callback as it deletes the WidgetWin and ATL will
// dereference it after the callback is processed.
void CloseNow();
- // All classes registered by ContainerWin start with this name.
+ // All classes registered by WidgetWin start with this name.
static const wchar_t* const kBaseClassName;
BEGIN_MSG_MAP_EX(0)
@@ -242,7 +236,7 @@ class ContainerWin : public Container,
MSG_WM_WINDOWPOSCHANGED(OnWindowPosChanged)
END_MSG_MAP()
- // Overridden from Container:
+ // Overridden from Widget:
virtual void GetBounds(CRect *out, bool including_frame) const;
virtual void MoveToFront(bool should_activate);
virtual HWND GetHWND() const;
@@ -338,8 +332,8 @@ class ContainerWin : public Container,
}
// Message Handlers
- // These are all virtual so that specialized view containers can modify or
- // augment processing.
+ // These are all virtual so that specialized Widgets can modify or augment
+ // processing.
// This list is in _ALPHABETICAL_ order!
// Note: in the base class these functions must do nothing but convert point
// coordinates to client coordinates (if necessary) and forward the
@@ -485,7 +479,7 @@ class ContainerWin : public Container,
virtual RootView* CreateRootView();
- // Returns true if this ContainerWin is opaque.
+ // Returns true if this WidgetWin is opaque.
bool opaque() const { return opaque_; }
// The root of the View hierarchy attached to this window.
@@ -518,7 +512,7 @@ class ContainerWin : public Container,
// so that subclasses can do any cleanup they need to.
void OnDestroyImpl();
- // The windows procedure used by all ContainerWins.
+ // The windows procedure used by all WidgetWins.
static LRESULT CALLBACK WndProc(HWND window,
UINT message,
WPARAM w_param,
@@ -528,9 +522,9 @@ class ContainerWin : public Container,
// If necessary, this registers the window class.
std::wstring GetWindowClassName();
- // The following factory is used for calls to close the ContainerWin
+ // The following factory is used for calls to close the WidgetWin
// instance.
- ScopedRunnableMethodFactory<ContainerWin> close_container_factory_;
+ ScopedRunnableMethodFactory<WidgetWin> close_widget_factory_;
// The flags currently being used with TrackMouseEvent to track mouse
// messages. 0 if there is no active tracking. The value of this member is
@@ -589,5 +583,5 @@ class ContainerWin : public Container,
} // namespace views
-#endif // #ifndef CHROME_VIEWS_CONTAINER_WIN_H_
+#endif // #ifndef CHROME_VIEWS_WIDGET_WIN_H_
diff --git a/chrome/views/window.cc b/chrome/views/window.cc
index e5726c8..6c61ff0 100644
--- a/chrome/views/window.cc
+++ b/chrome/views/window.cc
@@ -129,7 +129,7 @@ void Window::Close() {
if (client_view_->CanClose()) {
SaveWindowPosition();
RestoreEnabledIfNecessary();
- ContainerWin::Close();
+ WidgetWin::Close();
// If the user activates another app after opening us, then comes back and
// closes us, we want our owner to gain activation. But only if the owner
// is visible. If we don't manually force that here, the other app will
@@ -221,7 +221,7 @@ gfx::Size Window::GetLocalizedContentsSize(int col_resource_id,
// Window, protected:
Window::Window(WindowDelegate* window_delegate)
- : ContainerWin(),
+ : WidgetWin(),
focus_on_creation_(true),
window_delegate_(window_delegate),
non_client_view_(NULL),
@@ -249,7 +249,7 @@ void Window::Init(HWND parent, const gfx::Rect& bounds) {
// return NULL.
owning_hwnd_ = parent;
// We call this after initializing our members since our implementations of
- // assorted ContainerWin functions may be called during initialization.
+ // assorted WidgetWin functions may be called during initialization.
is_modal_ = window_delegate_->IsModal();
if (is_modal_)
BecomeModal();
@@ -260,7 +260,7 @@ void Window::Init(HWND parent, const gfx::Rect& bounds) {
if (window_ex_style() == 0)
set_window_ex_style(CalculateWindowExStyle());
- ContainerWin::Init(parent, bounds, true);
+ WidgetWin::Init(parent, bounds, true);
win_util::SetWindowUserData(GetHWND(), this);
std::wstring window_title = window_delegate_->GetWindowTitle();
@@ -279,9 +279,9 @@ void Window::SetClientView(ClientView* client_view) {
client_view_ = client_view;
if (non_client_view_) {
// This will trigger the ClientView to be added by the non-client view.
- ContainerWin::SetContentsView(non_client_view_);
+ WidgetWin::SetContentsView(non_client_view_);
} else {
- ContainerWin::SetContentsView(client_view_);
+ WidgetWin::SetContentsView(client_view_);
}
}
@@ -313,7 +313,7 @@ void Window::RunSystemMenu(const CPoint& point) {
}
///////////////////////////////////////////////////////////////////////////////
-// Window, ContainerWin overrides:
+// Window, WidgetWin overrides:
void Window::OnActivate(UINT action, BOOL minimized, HWND window) {
if (action == WA_INACTIVE)
@@ -325,13 +325,13 @@ LRESULT Window::OnAppCommand(HWND window, short app_command, WORD device,
// We treat APPCOMMAND ids as an extension of our command namespace, and just
// let the delegate figure out what to do...
if (!window_delegate_->ExecuteWindowsCommand(app_command))
- return ContainerWin::OnAppCommand(window, app_command, device, keystate);
+ return WidgetWin::OnAppCommand(window, app_command, device, keystate);
return 0;
}
void Window::OnCommand(UINT notification_code, int command_id, HWND window) {
if (!window_delegate_->ExecuteWindowsCommand(command_id))
- ContainerWin::OnCommand(notification_code, command_id, window);
+ WidgetWin::OnCommand(notification_code, command_id, window);
}
void Window::OnDestroy() {
@@ -340,7 +340,7 @@ void Window::OnDestroy() {
window_delegate_ = NULL;
}
RestoreEnabledIfNecessary();
- ContainerWin::OnDestroy();
+ WidgetWin::OnDestroy();
}
LRESULT Window::OnNCActivate(BOOL active) {
@@ -349,7 +349,7 @@ LRESULT Window::OnNCActivate(BOOL active) {
return DefWindowProc(GetHWND(), WM_NCACTIVATE, TRUE, 0);
}
// Otherwise just do the default thing.
- return ContainerWin::OnNCActivate(active);
+ return WidgetWin::OnNCActivate(active);
}
LRESULT Window::OnNCHitTest(const CPoint& point) {
@@ -375,14 +375,14 @@ LRESULT Window::OnNCHitTest(const CPoint& point) {
void Window::OnNCLButtonDown(UINT ht_component, const CPoint& point) {
if (non_client_view_ && ht_component == HTSYSMENU)
RunSystemMenu(non_client_view_->GetSystemMenuPoint());
- ContainerWin::OnNCLButtonDown(ht_component, point);
+ WidgetWin::OnNCLButtonDown(ht_component, point);
}
void Window::OnNCRButtonDown(UINT ht_component, const CPoint& point) {
if (ht_component == HTCAPTION || ht_component == HTSYSMENU) {
RunSystemMenu(point);
} else {
- ContainerWin::OnNCRButtonDown(ht_component, point);
+ WidgetWin::OnNCRButtonDown(ht_component, point);
}
}
diff --git a/chrome/views/window.h b/chrome/views/window.h
index 9758f9f..3a3ae7b 100644
--- a/chrome/views/window.h
+++ b/chrome/views/window.h
@@ -5,7 +5,7 @@
#ifndef CHROME_VIEWS_WINDOW_H__
#define CHROME_VIEWS_WINDOW_H__
-#include "chrome/views/container_win.h"
+#include "chrome/views/widget_win.h"
namespace gfx {
class Size;
@@ -26,11 +26,11 @@ class WindowDelegate;
//
// Window
//
-// A Window is a ContainerWin that has a caption and a border. The frame is
+// A Window is a WidgetWIn that has a caption and a border. The frame is
// rendered by the operating system.
//
///////////////////////////////////////////////////////////////////////////////
-class Window : public ContainerWin {
+class Window : public WidgetWin {
public:
virtual ~Window();
@@ -146,7 +146,7 @@ class Window : public ContainerWin {
// Shows the system menu at the specified screen point.
void RunSystemMenu(const CPoint& point);
- // Overridden from ContainerWin:
+ // Overridden from WidgetWin:
virtual void OnActivate(UINT action, BOOL minimized, HWND window);
virtual LRESULT OnAppCommand(HWND window, short app_command, WORD device,
int keystate);