summaryrefslogtreecommitdiffstats
path: root/views/window
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-13 21:56:26 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-13 21:56:26 +0000
commit2fdd00a4c6a07856180347c6d147b27c10ae14ff (patch)
treefc1634a77f397665cdf20526b96fcb9801c8d144 /views/window
parentf25b8052531b1d4668d1d9ed60b1151af4ca3ab2 (diff)
downloadchromium_src-2fdd00a4c6a07856180347c6d147b27c10ae14ff.zip
chromium_src-2fdd00a4c6a07856180347c6d147b27c10ae14ff.tar.gz
chromium_src-2fdd00a4c6a07856180347c6d147b27c10ae14ff.tar.bz2
Eliminate Window completely.
BUG=72040 TEST=none Review URL: http://codereview.chromium.org/7108047 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88905 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/window')
-rw-r--r--views/window/client_view.cc4
-rw-r--r--views/window/client_view.h1
-rw-r--r--views/window/custom_frame_view.cc6
-rw-r--r--views/window/dialog_client_view.cc4
-rw-r--r--views/window/dialog_client_view.h1
-rw-r--r--views/window/dialog_delegate.cc32
-rw-r--r--views/window/dialog_delegate.h25
-rw-r--r--views/window/native_window.h51
-rw-r--r--views/window/native_window_delegate.h36
-rw-r--r--views/window/native_window_gtk.cc59
-rw-r--r--views/window/native_window_gtk.h44
-rw-r--r--views/window/native_window_views.cc46
-rw-r--r--views/window/native_window_views.h41
-rw-r--r--views/window/native_window_win.cc107
-rw-r--r--views/window/native_window_win.h60
-rw-r--r--views/window/native_window_win_unittest.cc58
-rw-r--r--views/window/non_client_view.cc1
-rw-r--r--views/window/window.cc82
-rw-r--r--views/window/window.h82
-rw-r--r--views/window/window_delegate.cc15
-rw-r--r--views/window/window_delegate.h32
21 files changed, 62 insertions, 725 deletions
diff --git a/views/window/client_view.cc b/views/window/client_view.cc
index bbea28c..6646727 100644
--- a/views/window/client_view.cc
+++ b/views/window/client_view.cc
@@ -33,6 +33,10 @@ DialogClientView* ClientView::AsDialogClientView() {
return NULL;
}
+const DialogClientView* ClientView::AsDialogClientView() const {
+ return NULL;
+}
+
bool ClientView::CanClose() {
return true;
}
diff --git a/views/window/client_view.h b/views/window/client_view.h
index de1ca7e..0af791e 100644
--- a/views/window/client_view.h
+++ b/views/window/client_view.h
@@ -35,6 +35,7 @@ class ClientView : public View {
// Manual RTTI ftw.
virtual DialogClientView* AsDialogClientView();
+ virtual const DialogClientView* AsDialogClientView() const;
// Returns true to signal that the Widget can be closed. Specialized
// ClientView subclasses can override this default behavior to allow the
diff --git a/views/window/custom_frame_view.cc b/views/window/custom_frame_view.cc
index 6f9bb8f..ff59913 100644
--- a/views/window/custom_frame_view.cc
+++ b/views/window/custom_frame_view.cc
@@ -12,16 +12,16 @@
#include "ui/gfx/canvas.h"
#include "ui/gfx/font.h"
#include "ui/gfx/path.h"
+#include "views/widget/widget_delegate.h"
#include "views/window/client_view.h"
#include "views/window/window_shape.h"
-#include "views/window/window_delegate.h"
#if defined(OS_LINUX)
#include "views/window/hit_test.h"
#endif
#if defined(OS_WIN)
-#include "views/window/native_window_win.h"
+#include "views/widget/native_widget_win.h"
#endif
namespace views {
@@ -568,7 +568,7 @@ void CustomFrameView::InitClass() {
static bool initialized = false;
if (!initialized) {
#if defined(OS_WIN)
- title_font_ = new gfx::Font(NativeWindowWin::GetWindowTitleFont());
+ title_font_ = new gfx::Font(NativeWidgetWin::GetWindowTitleFont());
#elif defined(OS_LINUX)
// TODO(ben): need to resolve what font this is.
title_font_ = new gfx::Font();
diff --git a/views/window/dialog_client_view.cc b/views/window/dialog_client_view.cc
index f4a3985..b17f370 100644
--- a/views/window/dialog_client_view.cc
+++ b/views/window/dialog_client_view.cc
@@ -302,6 +302,10 @@ DialogClientView* DialogClientView::AsDialogClientView() {
return this;
}
+const DialogClientView* DialogClientView::AsDialogClientView() const {
+ return this;
+}
+
////////////////////////////////////////////////////////////////////////////////
// DialogClientView, View overrides:
diff --git a/views/window/dialog_client_view.h b/views/window/dialog_client_view.h
index 27365b5..ad72e77 100644
--- a/views/window/dialog_client_view.h
+++ b/views/window/dialog_client_view.h
@@ -73,6 +73,7 @@ class DialogClientView : public ClientView,
virtual void WidgetClosing() OVERRIDE;
virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE;
virtual DialogClientView* AsDialogClientView() OVERRIDE;
+ virtual const DialogClientView* AsDialogClientView() const OVERRIDE;
// FocusChangeListener implementation:
virtual void FocusWillChange(View* focused_before,
diff --git a/views/window/dialog_delegate.cc b/views/window/dialog_delegate.cc
index ee22c12..13ff590 100644
--- a/views/window/dialog_delegate.cc
+++ b/views/window/dialog_delegate.cc
@@ -6,11 +6,12 @@
#include "base/logging.h"
#include "views/controls/button/native_button.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
namespace views {
-// Overridden from WindowDelegate:
+////////////////////////////////////////////////////////////////////////////////
+// DialogDelegate:
DialogDelegate* DialogDelegate::AsDialogDelegate() { return this; }
@@ -72,7 +73,7 @@ bool DialogDelegate::Accept() {
View* DialogDelegate::GetInitiallyFocusedView() {
// Focus the default button if any.
- DialogClientView* dcv = GetDialogClientView();
+ const DialogClientView* dcv = GetDialogClientView();
int default_button = GetDefaultDialogButton();
if (default_button == MessageBoxFlags::DIALOGBUTTON_NONE)
return NULL;
@@ -94,12 +95,33 @@ ClientView* DialogDelegate::CreateClientView(Widget* widget) {
return new DialogClientView(widget, GetContentsView());
}
-DialogClientView* DialogDelegate::GetDialogClientView() const {
- return window()->client_view()->AsDialogClientView();
+const DialogClientView* DialogDelegate::GetDialogClientView() const {
+ return GetWidget()->client_view()->AsDialogClientView();
+}
+
+DialogClientView* DialogDelegate::GetDialogClientView() {
+ return GetWidget()->client_view()->AsDialogClientView();
}
ui::AccessibilityTypes::Role DialogDelegate::GetAccessibleWindowRole() const {
return ui::AccessibilityTypes::ROLE_DIALOG;
}
+////////////////////////////////////////////////////////////////////////////////
+// DialogDelegateView:
+
+DialogDelegateView::DialogDelegateView() {
+}
+
+DialogDelegateView::~DialogDelegateView() {
+}
+
+Widget* DialogDelegateView::GetWidget() {
+ return View::GetWidget();
+}
+
+const Widget* DialogDelegateView::GetWidget() const {
+ return View::GetWidget();
+}
+
} // namespace views
diff --git a/views/window/dialog_delegate.h b/views/window/dialog_delegate.h
index 607132b..bfcec75 100644
--- a/views/window/dialog_delegate.h
+++ b/views/window/dialog_delegate.h
@@ -8,8 +8,8 @@
#include "ui/base/accessibility/accessibility_types.h"
#include "ui/base/message_box_flags.h"
+#include "views/widget/widget_delegate.h"
#include "views/window/dialog_client_view.h"
-#include "views/window/window_delegate.h"
using ui::MessageBoxFlags;
@@ -27,7 +27,7 @@ class View;
// certain events.
//
///////////////////////////////////////////////////////////////////////////////
-class DialogDelegate : public WindowDelegate {
+class DialogDelegate : public WidgetDelegate {
public:
virtual DialogDelegate* AsDialogDelegate();
@@ -104,13 +104,32 @@ class DialogDelegate : public WindowDelegate {
// A helper for accessing the DialogClientView object contained by this
// delegate's Window.
- DialogClientView* GetDialogClientView() const;
+ const DialogClientView* GetDialogClientView() const;
+ DialogClientView* GetDialogClientView();
protected:
// Overridden from WindowDelegate:
virtual ui::AccessibilityTypes::Role GetAccessibleWindowRole() const OVERRIDE;
};
+// A DialogDelegate implementation that is-a View. Used to override GetWidget()
+// to call View's GetWidget() for the common case where a DialogDelegate
+// implementation is-a View.
+class DialogDelegateView : public DialogDelegate,
+ public View {
+ public:
+ DialogDelegateView();
+ virtual ~DialogDelegateView();
+
+ // Overridden from DialogDelegate:
+ virtual Widget* GetWidget() OVERRIDE;
+ virtual const Widget* GetWidget() const OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DialogDelegateView);
+};
+
+
} // namespace views
#endif // VIEWS_WINDOW_DIALOG_DELEGATE_H_
diff --git a/views/window/native_window.h b/views/window/native_window.h
deleted file mode 100644
index de5cce8..0000000
--- a/views/window/native_window.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2011 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 VIEWS_WIDGET_NATIVE_WINDOW_H_
-#define VIEWS_WIDGET_NATIVE_WINDOW_H_
-#pragma once
-
-#include "ui/base/accessibility/accessibility_types.h"
-#include "ui/gfx/native_widget_types.h"
-#include "views/window/window.h"
-
-class SkBitmap;
-
-namespace gfx {
-class Rect;
-class Size;
-}
-
-namespace views {
-
-class NativeWidget;
-class NonClientFrameView;
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWindow interface
-//
-// An interface implemented by an object that encapsulates a native window.
-//
-class NativeWindow {
- public:
- virtual ~NativeWindow() {}
-
- // Creates an appropriate default NativeWindow implementation for the current
- // OS/circumstance.
- static NativeWindow* CreateNativeWindow(
- internal::NativeWindowDelegate* delegate);
-
- virtual Window* GetWindow() = 0;
- virtual const Window* GetWindow() const = 0;
-
- virtual NativeWidget* AsNativeWidget() = 0;
- virtual const NativeWidget* AsNativeWidget() const = 0;
-
- protected:
- friend class Window;
-};
-
-} // namespace views
-
-#endif // VIEWS_WIDGET_NATIVE_WINDOW_H_
diff --git a/views/window/native_window_delegate.h b/views/window/native_window_delegate.h
deleted file mode 100644
index 41621ac..0000000
--- a/views/window/native_window_delegate.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 2011 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 VIEWS_WIDGET_NATIVE_WINDOW_DELEGATE_H_
-#define VIEWS_WIDGET_NATIVE_WINDOW_DELEGATE_H_
-#pragma once
-
-namespace ui {
-class ThemeProvider;
-}
-
-namespace views {
-namespace internal {
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWindowDelegate interface
-//
-// An interface implemented by an object that receives notifications from a
-// NativeWindow implementation.
-//
-class NativeWindowDelegate {
- public:
- virtual ~NativeWindowDelegate() {}
-
- //
- virtual Window* AsWindow() = 0;
-
- //
- virtual NativeWidgetDelegate* AsNativeWidgetDelegate() = 0;
-};
-
-} // namespace internal
-} // namespace views
-
-#endif // VIEWS_WIDGET_NATIVE_WINDOW_DELEGATE_H_
diff --git a/views/window/native_window_gtk.cc b/views/window/native_window_gtk.cc
deleted file mode 100644
index 2ca707a..0000000
--- a/views/window/native_window_gtk.cc
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright (c) 2011 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.
-
-#include "views/window/native_window_gtk.h"
-
-#include "base/i18n/rtl.h"
-#include "base/utf_string_conversions.h"
-#include "ui/gfx/path.h"
-#include "ui/gfx/rect.h"
-#include "views/events/event.h"
-#include "views/window/hit_test.h"
-#include "views/window/native_window_delegate.h"
-#include "views/window/non_client_view.h"
-#include "views/window/window_delegate.h"
-
-namespace views {
-
-NativeWindowGtk::NativeWindowGtk(internal::NativeWindowDelegate* delegate)
- : NativeWidgetGtk(delegate->AsNativeWidgetDelegate()),
- delegate_(delegate) {
- is_window_ = true;
-}
-
-NativeWindowGtk::~NativeWindowGtk() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWindowGtk, NativeWindow implementation:
-
-NativeWidget* NativeWindowGtk::AsNativeWidget() {
- return this;
-}
-
-const NativeWidget* NativeWindowGtk::AsNativeWidget() const {
- return this;
-}
-
-Window* NativeWindowGtk::GetWindow() {
- return delegate_->AsWindow();
-}
-
-const Window* NativeWindowGtk::GetWindow() const {
- return delegate_->AsWindow();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWindowGtk, private:
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWindow, public:
-
-// static
-NativeWindow* NativeWindow::CreateNativeWindow(
- internal::NativeWindowDelegate* delegate) {
- return new NativeWindowGtk(delegate);
-}
-
-} // namespace views
diff --git a/views/window/native_window_gtk.h b/views/window/native_window_gtk.h
deleted file mode 100644
index 9988a23..0000000
--- a/views/window/native_window_gtk.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (c) 2011 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 VIEWS_WINDOW_NATIVE_WINDOW_GTK_H_
-#define VIEWS_WINDOW_NATIVE_WINDOW_GTK_H_
-#pragma once
-
-#include "base/basictypes.h"
-#include "views/widget/native_widget_gtk.h"
-#include "views/window/native_window.h"
-
-namespace views {
-namespace internal {
-class NativeWindowDelegate;
-}
-
-// Window implementation for Gtk.
-class NativeWindowGtk : public NativeWidgetGtk, public NativeWindow {
- public:
- explicit NativeWindowGtk(internal::NativeWindowDelegate* delegate);
- virtual ~NativeWindowGtk();
-
- virtual Window* GetWindow() OVERRIDE;
- virtual const Window* GetWindow() const OVERRIDE;
-
- protected:
- // Overridden from NativeWindow:
- virtual NativeWidget* AsNativeWidget() OVERRIDE;
- virtual const NativeWidget* AsNativeWidget() const OVERRIDE;
-
- // For the constructor.
- friend class Window;
-
- private:
- // A delegate implementation that handles events received here.
- internal::NativeWindowDelegate* delegate_;
-
- DISALLOW_COPY_AND_ASSIGN(NativeWindowGtk);
-};
-
-} // namespace views
-
-#endif // VIEWS_WINDOW_NATIVE_WINDOW_GTK_H_
diff --git a/views/window/native_window_views.cc b/views/window/native_window_views.cc
deleted file mode 100644
index 409380c..0000000
--- a/views/window/native_window_views.cc
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) 2011 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.
-
-#include "views/window/native_window_views.h"
-
-#include "views/view.h"
-
-namespace views {
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWindowViews, public:
-
-NativeWindowViews::NativeWindowViews(View* host,
- internal::NativeWindowDelegate* delegate)
- : NativeWidgetViews(host, delegate->AsNativeWidgetDelegate()),
- delegate_(delegate) {
-}
-
-NativeWindowViews::~NativeWindowViews() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWindowViews, NativeWindow implementation:
-
-Window* NativeWindowViews::GetWindow() {
- return delegate_->AsWindow();
-}
-
-const Window* NativeWindowViews::GetWindow() const {
- return delegate_->AsWindow();
-}
-
-NativeWidget* NativeWindowViews::AsNativeWidget() {
- return this;
-}
-
-const NativeWidget* NativeWindowViews::AsNativeWidget() const {
- return this;
-}
-
-void NativeWindowViews::BecomeModal() {
- NOTIMPLEMENTED();
-}
-
-} // namespace views
diff --git a/views/window/native_window_views.h b/views/window/native_window_views.h
deleted file mode 100644
index f944c00..0000000
--- a/views/window/native_window_views.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) 2011 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 VIEWS_WINDOW_NATIVE_WINDOW_VIEWS_H_
-#define VIEWS_WINDOW_NATIVE_WINDOW_VIEWS_H_
-#pragma once
-
-#include "base/message_loop.h"
-#include "views/window/native_window.h"
-#include "views/widget/native_widget_views.h"
-
-namespace views {
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWindowViews
-//
-// A NativeWindow implementation that uses another View as its native widget.
-//
-class NativeWindowViews : public NativeWidgetViews,
- public NativeWindow {
- public:
- NativeWindowViews(View* host, internal::NativeWindowDelegate* delegate);
- virtual ~NativeWindowViews();
-
- private:
- // Overridden from NativeWindow:
- virtual Window* GetWindow() OVERRIDE;
- virtual const Window* GetWindow() const OVERRIDE;
- virtual NativeWidget* AsNativeWidget() OVERRIDE;
- virtual const NativeWidget* AsNativeWidget() const OVERRIDE;
- virtual void BecomeModal() OVERRIDE;
-
- internal::NativeWindowDelegate* delegate_;
-
- DISALLOW_COPY_AND_ASSIGN(NativeWindowViews);
-};
-
-}
-
-#endif // VIEWS_WINDOW_NATIVE_WINDOW_VIEWS_H_
diff --git a/views/window/native_window_win.cc b/views/window/native_window_win.cc
deleted file mode 100644
index a902d10..0000000
--- a/views/window/native_window_win.cc
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright (c) 2011 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.
-
-#include "views/window/native_window_win.h"
-
-#include "base/i18n/rtl.h"
-#include "ui/base/accessibility/accessibility_types.h"
-#include "ui/base/keycodes/keyboard_code_conversion_win.h"
-#include "ui/base/l10n/l10n_util_win.h"
-#include "ui/base/theme_provider.h"
-#include "ui/base/win/hwnd_util.h"
-#include "ui/gfx/font.h"
-#include "ui/gfx/path.h"
-#include "views/accessibility/native_view_accessibility_win.h"
-#include "views/window/client_view.h"
-#include "views/window/native_window_delegate.h"
-#include "views/window/non_client_view.h"
-#include "views/window/window_delegate.h"
-
-namespace views {
-namespace internal {
-
-void EnsureRectIsVisibleInRect(const gfx::Rect& parent_rect,
- gfx::Rect* child_rect,
- int padding) {
- DCHECK(child_rect);
-
- // We use padding here because it allows some of the original web page to
- // bleed through around the edges.
- int twice_padding = padding * 2;
-
- // FIRST, clamp width and height so we don't open child windows larger than
- // the containing parent.
- if (child_rect->width() > (parent_rect.width() + twice_padding))
- child_rect->set_width(std::max(0, parent_rect.width() - twice_padding));
- if (child_rect->height() > parent_rect.height() + twice_padding)
- child_rect->set_height(std::max(0, parent_rect.height() - twice_padding));
-
- // SECOND, clamp x,y position to padding,padding so we don't position child
- // windows in hyperspace.
- // TODO(mpcomplete): I don't see what the second check in each 'if' does that
- // isn't handled by the LAST set of 'ifs'. Maybe we can remove it.
- if (child_rect->x() < parent_rect.x() ||
- child_rect->x() > parent_rect.right()) {
- child_rect->set_x(parent_rect.x() + padding);
- }
- if (child_rect->y() < parent_rect.y() ||
- child_rect->y() > parent_rect.bottom()) {
- child_rect->set_y(parent_rect.y() + padding);
- }
-
- // LAST, nudge the window back up into the client area if its x,y position is
- // within the parent bounds but its width/height place it off-screen.
- if (child_rect->bottom() > parent_rect.bottom())
- child_rect->set_y(parent_rect.bottom() - child_rect->height() - padding);
- if (child_rect->right() > parent_rect.right())
- child_rect->set_x(parent_rect.right() - child_rect->width() - padding);
-}
-
-} // namespace internal
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWindowWin, public:
-
-NativeWindowWin::NativeWindowWin(internal::NativeWindowDelegate* delegate)
- : NativeWidgetWin(delegate->AsNativeWidgetDelegate()),
- delegate_(delegate) {
- is_window_ = true;
- // Initialize these values to 0 so that subclasses can override the default
- // behavior before calling Init.
- set_window_style(0);
- set_window_ex_style(0);
-}
-
-NativeWindowWin::~NativeWindowWin() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWindowWin, NativeWindow implementation:
-
-Window* NativeWindowWin::GetWindow() {
- return delegate_->AsWindow();
-}
-
-const Window* NativeWindowWin::GetWindow() const {
- return delegate_->AsWindow();
-}
-
-NativeWidget* NativeWindowWin::AsNativeWidget() {
- return this;
-}
-
-const NativeWidget* NativeWindowWin::AsNativeWidget() const {
- return this;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWindow, public:
-
-// static
-NativeWindow* NativeWindow::CreateNativeWindow(
- internal::NativeWindowDelegate* delegate) {
- return new NativeWindowWin(delegate);
-}
-
-} // namespace views
diff --git a/views/window/native_window_win.h b/views/window/native_window_win.h
deleted file mode 100644
index 956a3ac..0000000
--- a/views/window/native_window_win.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) 2011 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 VIEWS_WINDOW_NATIVE_WINDOW_WIN_H_
-#define VIEWS_WINDOW_NATIVE_WINDOW_WIN_H_
-#pragma once
-
-#include "views/widget/native_widget_win.h"
-#include "views/window/native_window.h"
-
-namespace views {
-namespace internal {
-class NativeWindowDelegate;
-
-// This is exposed only for testing
-// Adjusts the value of |child_rect| if necessary to ensure that it is
-// completely visible within |parent_rect|.
-void EnsureRectIsVisibleInRect(const gfx::Rect& parent_rect,
- gfx::Rect* child_rect,
- int padding);
-
-} // namespace internal
-
-////////////////////////////////////////////////////////////////////////////////
-//
-// NativeWindowWin
-//
-// A NativeWindowWin is a NativeWidgetWin that encapsulates a window with a
-// frame. The frame may or may not be rendered by the operating system. The
-// window may or may not be top level.
-//
-////////////////////////////////////////////////////////////////////////////////
-class NativeWindowWin : public NativeWidgetWin,
- public NativeWindow {
- public:
- explicit NativeWindowWin(internal::NativeWindowDelegate* delegate);
- virtual ~NativeWindowWin();
-
- // Overridden from NativeWindow:
- virtual Window* GetWindow() OVERRIDE;
- virtual const Window* GetWindow() const OVERRIDE;
-
- protected:
- friend Window;
-
- // Overridden from NativeWindow:
- virtual NativeWidget* AsNativeWidget() OVERRIDE;
- virtual const NativeWidget* AsNativeWidget() const OVERRIDE;
-
- private:
- // A delegate implementation that handles events received here.
- internal::NativeWindowDelegate* delegate_;
-
- DISALLOW_COPY_AND_ASSIGN(NativeWindowWin);
-};
-
-} // namespace views
-
-#endif // VIEWS_WINDOW_NATIVE_WINDOW_WIN_H_
diff --git a/views/window/native_window_win_unittest.cc b/views/window/native_window_win_unittest.cc
deleted file mode 100644
index a612af5..0000000
--- a/views/window/native_window_win_unittest.cc
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (c) 2011 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.
-
-#include "views/window/native_window_win.h"
-
-#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/gfx/rect.h"
-
-namespace views {
-
-TEST(NativeWindowWinTest, EnsureRectIsVisibleInRect) {
- gfx::Rect parent_rect(0, 0, 500, 400);
-
- {
- // Child rect x < 0
- gfx::Rect child_rect(-50, 20, 100, 100);
- internal::EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10);
- EXPECT_EQ(gfx::Rect(10, 20, 100, 100), child_rect);
- }
-
- {
- // Child rect y < 0
- gfx::Rect child_rect(20, -50, 100, 100);
- internal::EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10);
- EXPECT_EQ(gfx::Rect(20, 10, 100, 100), child_rect);
- }
-
- {
- // Child rect right > parent_rect.right
- gfx::Rect child_rect(450, 20, 100, 100);
- internal::EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10);
- EXPECT_EQ(gfx::Rect(390, 20, 100, 100), child_rect);
- }
-
- {
- // Child rect bottom > parent_rect.bottom
- gfx::Rect child_rect(20, 350, 100, 100);
- internal::EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10);
- EXPECT_EQ(gfx::Rect(20, 290, 100, 100), child_rect);
- }
-
- {
- // Child rect width > parent_rect.width
- gfx::Rect child_rect(20, 20, 700, 100);
- internal::EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10);
- EXPECT_EQ(gfx::Rect(20, 20, 480, 100), child_rect);
- }
-
- {
- // Child rect height > parent_rect.height
- gfx::Rect child_rect(20, 20, 100, 700);
- internal::EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10);
- EXPECT_EQ(gfx::Rect(20, 20, 100, 380), child_rect);
- }
-}
-
-} // namespace views
diff --git a/views/window/non_client_view.cc b/views/window/non_client_view.cc
index fdf4230..1f7effa 100644
--- a/views/window/non_client_view.cc
+++ b/views/window/non_client_view.cc
@@ -8,7 +8,6 @@
#include "views/widget/root_view.h"
#include "views/widget/widget.h"
#include "views/window/client_view.h"
-#include "views/window/window.h"
#if !defined(OS_WIN)
#include "views/window/hit_test.h"
diff --git a/views/window/window.cc b/views/window/window.cc
deleted file mode 100644
index ecfaa57..0000000
--- a/views/window/window.cc
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright (c) 2011 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.
-
-#include "views/window/window.h"
-
-#include "base/string_util.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-#include "ui/gfx/font.h"
-#include "ui/gfx/rect.h"
-#include "ui/gfx/size.h"
-#include "views/widget/widget.h"
-#include "views/widget/native_widget.h"
-#include "views/window/native_window.h"
-#include "views/window/window_delegate.h"
-
-namespace views {
-
-////////////////////////////////////////////////////////////////////////////////
-// Window, public:
-
-Window::InitParams::InitParams(WindowDelegate* window_delegate)
- : window_delegate(window_delegate),
- parent_window(NULL),
- native_window(NULL),
- widget_init_params(Widget::InitParams::TYPE_WINDOW) {
-}
-
-Window::Window()
- : native_window_(NULL) {
-}
-
-Window::~Window() {
-}
-
-// static
-Window* Window::CreateChromeWindow(gfx::NativeWindow parent,
- const gfx::Rect& bounds,
- WindowDelegate* window_delegate) {
- Window* window = new Window;
- Window::InitParams params(window_delegate);
- params.parent_window = parent;
-#if defined(OS_WIN)
- params.widget_init_params.parent = parent;
-#endif
- params.widget_init_params.bounds = bounds;
- window->InitWindow(params);
- return window;
-}
-
-void Window::InitWindow(const InitParams& params) {
- native_window_ =
- params.native_window ? params.native_window
- : NativeWindow::CreateNativeWindow(this);
- InitParams modified_params = params;
- modified_params.widget_init_params.delegate = params.window_delegate;
- DCHECK(!modified_params.widget_init_params.delegate->window_);
- modified_params.widget_init_params.delegate->window_ = this;
- modified_params.widget_init_params.native_widget =
- native_window_->AsNativeWidget();
- Init(modified_params.widget_init_params);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Window, Widget overrides:
-
-Window* Window::AsWindow() {
- return this;
-}
-
-const Window* Window::AsWindow() const {
- return this;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Window, internal::NativeWindowDelegate implementation:
-
-internal::NativeWidgetDelegate* Window::AsNativeWidgetDelegate() {
- return this;
-}
-
-} // namespace views
diff --git a/views/window/window.h b/views/window/window.h
deleted file mode 100644
index e3a36d5..0000000
--- a/views/window/window.h
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright (c) 2011 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 VIEWS_WINDOW_WINDOW_H_
-#define VIEWS_WINDOW_WINDOW_H_
-#pragma once
-
-#include "ui/gfx/native_widget_types.h"
-#include "views/widget/widget.h"
-#include "views/window/native_window_delegate.h"
-
-namespace gfx {
-class Rect;
-class Size;
-} // namespace gfx
-
-namespace views {
-
-class NativeWindow;
-class Widget;
-class WindowDelegate;
-
-////////////////////////////////////////////////////////////////////////////////
-// Window class
-//
-// Encapsulates window-like behavior. See WindowDelegate.
-//
-class Window : public Widget,
- public internal::NativeWindowDelegate {
- public:
- struct InitParams {
- // |window_delegate| cannot be NULL.
- explicit InitParams(WindowDelegate* window_delegate);
-
- WindowDelegate* window_delegate;
- gfx::NativeWindow parent_window;
- NativeWindow* native_window;
- Widget::InitParams widget_init_params;
- };
-
- Window();
- virtual ~Window();
-
- // Creates an instance of an object implementing this interface.
- // TODO(beng): create a version of this function that takes a NativeView, for
- // constrained windows.
- static Window* CreateChromeWindow(gfx::NativeWindow parent,
- const gfx::Rect& bounds,
- WindowDelegate* window_delegate);
-
- // Initializes the window. Must be called before any post-configuration
- // operations are performed.
- void InitWindow(const InitParams& params);
-
- // Overridden from Widget:
- virtual Window* AsWindow() OVERRIDE;
- virtual const Window* AsWindow() const OVERRIDE;
-
- WindowDelegate* window_delegate() {
- return const_cast<WindowDelegate*>(
- const_cast<const Window*>(this)->window_delegate());
- }
- const WindowDelegate* window_delegate() const {
- return reinterpret_cast<WindowDelegate*>(widget_delegate());
- }
-
- NativeWindow* native_window() { return native_window_; }
-
- protected:
- // Overridden from NativeWindowDelegate:
- virtual internal::NativeWidgetDelegate* AsNativeWidgetDelegate() OVERRIDE;
-
- private:
- NativeWindow* native_window_;
-
- DISALLOW_COPY_AND_ASSIGN(Window);
-};
-
-} // namespace views
-
-#endif // #ifndef VIEWS_WINDOW_WINDOW_H_
diff --git a/views/window/window_delegate.cc b/views/window/window_delegate.cc
deleted file mode 100644
index d75f881..0000000
--- a/views/window/window_delegate.cc
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright (c) 2011 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.
-
-#include "views/window/window_delegate.h"
-
-namespace views {
-
-WindowDelegate::WindowDelegate() {
-}
-
-WindowDelegate::~WindowDelegate() {
-}
-
-} // namespace views
diff --git a/views/window/window_delegate.h b/views/window/window_delegate.h
deleted file mode 100644
index a7715ab..0000000
--- a/views/window/window_delegate.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright (c) 2011 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 VIEWS_WINDOW_WINDOW_DELEGATE_H_
-#define VIEWS_WINDOW_WINDOW_DELEGATE_H_
-#pragma once
-
-#include "views/widget/widget_delegate.h"
-
-namespace views {
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// WindowDelegate
-//
-// WindowDelegate is an interface implemented by objects that wish to show a
-// Window. The window that is displayed uses this interface to determine how
-// it should be displayed and notify the delegate object of certain events.
-//
-class WindowDelegate : public WidgetDelegate {
- public:
- WindowDelegate();
- virtual ~WindowDelegate();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(WindowDelegate);
-};
-
-} // namespace views
-
-#endif // VIEWS_WINDOW_WINDOW_DELEGATE_H_