summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-29 06:02:19 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-29 06:02:19 +0000
commit17dee5e7005a82e08d11be50d56477939124a6b7 (patch)
tree7133a5d7a086ce238057cb82e0e81d332dafba8f /chrome
parentbf0136d62bfe02f57821ce026c04b6e8204eb482 (diff)
downloadchromium_src-17dee5e7005a82e08d11be50d56477939124a6b7.zip
chromium_src-17dee5e7005a82e08d11be50d56477939124a6b7.tar.gz
chromium_src-17dee5e7005a82e08d11be50d56477939124a6b7.tar.bz2
Refactors HWNDView, NativeViewHostGtk and NativeViewHost so that they match the NativeControl pattern established for NativeButtons. NativeViewHost is a platform-neutral class that clients instantiate. Behind the scenes the platform instantiates the appropriate NativeViewHostWrapper implementation, either NativeViewHostGtk (as before) or NativeViewHostWin (replaces HWNDView).
BUG=none TEST=none Review URL: http://codereview.chromium.org/114059 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17169 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/extensions/extension_view.cc6
-rw-r--r--chrome/browser/extensions/extension_view.h13
-rw-r--r--chrome/browser/views/about_ipc_dialog.cc4
-rw-r--r--chrome/browser/views/about_ipc_dialog.h4
-rw-r--r--chrome/browser/views/constrained_window_impl.cc1
-rw-r--r--chrome/browser/views/constrained_window_impl.h1
-rw-r--r--chrome/browser/views/dom_view.cc2
-rw-r--r--chrome/browser/views/dom_view.h4
-rw-r--r--chrome/browser/views/location_bar_view.cc12
-rw-r--r--chrome/browser/views/location_bar_view.h9
-rw-r--r--chrome/browser/views/tab_contents/native_tab_contents_container_gtk.cc4
-rw-r--r--chrome/browser/views/tab_contents/native_tab_contents_container_gtk.h2
-rw-r--r--chrome/browser/views/tab_contents/native_tab_contents_container_win.cc4
-rw-r--r--chrome/browser/views/tab_contents/native_tab_contents_container_win.h4
-rw-r--r--chrome/common/temp_scaffolding_stubs.h24
15 files changed, 28 insertions, 66 deletions
diff --git a/chrome/browser/extensions/extension_view.cc b/chrome/browser/extensions/extension_view.cc
index a3a6bc5..0db813b 100644
--- a/chrome/browser/extensions/extension_view.cc
+++ b/chrome/browser/extensions/extension_view.cc
@@ -20,13 +20,13 @@ ExtensionView::ExtensionView(ExtensionHost* host, Browser* browser,
}
ExtensionView::~ExtensionView() {
- if (GetHWND())
+ if (native_view())
Detach();
}
void ExtensionView::SetVisible(bool is_visible) {
if (is_visible != IsVisible()) {
- HWNDView::SetVisible(is_visible);
+ NativeViewHost::SetVisible(is_visible);
// Also tell RenderWidgetHostView the new visibility. Despite its name, it
// is not part of the View heirarchy and does not know about the change
@@ -47,7 +47,7 @@ void ExtensionView::DidChangeBounds(const gfx::Rect& previous,
if (render_view_host()->view() && !current.IsEmpty())
render_view_host()->view()->SetSize(gfx::Size(width(), height()));
// Layout is where the HWND is properly positioned.
- // TODO(erikkay) - perhaps this should be in HWNDView
+ // TODO(erikkay) - perhaps this should be in NativeViewHost
Layout();
}
diff --git a/chrome/browser/extensions/extension_view.h b/chrome/browser/extensions/extension_view.h
index 6f27249..06e200d 100644
--- a/chrome/browser/extensions/extension_view.h
+++ b/chrome/browser/extensions/extension_view.h
@@ -11,14 +11,7 @@
#include "chrome/browser/extensions/extension_host.h"
#include "googleurl/src/gurl.h"
#include "third_party/skia/include/core/SkBitmap.h"
-
-// TODO(port): Port these files.
-#if defined(OS_WIN)
-#include "views/controls/hwnd_view.h"
-#else
-#include "views/view.h"
-#include "chrome/common/temp_scaffolding_stubs.h"
-#endif
+#include "views/controls/native/native_view_host.h"
class Browser;
class Extension;
@@ -33,7 +26,7 @@ class ExtensionContainer {
};
// This handles the display portion of an ExtensionHost.
-class ExtensionView : public views::HWNDView {
+class ExtensionView : public views::NativeViewHost {
public:
ExtensionView(ExtensionHost* host, Browser* browser, const GURL& content_url);
~ExtensionView();
@@ -54,7 +47,7 @@ class ExtensionView : public views::HWNDView {
// Sets the container for this view.
void SetContainer(ExtensionContainer* container) { container_ = container; }
- // views::HWNDView
+ // Overridden from views::NativeViewHost:
virtual void SetVisible(bool is_visible);
virtual void DidChangeBounds(const gfx::Rect& previous,
const gfx::Rect& current);
diff --git a/chrome/browser/views/about_ipc_dialog.cc b/chrome/browser/views/about_ipc_dialog.cc
index 27987b1..cb21069 100644
--- a/chrome/browser/views/about_ipc_dialog.cc
+++ b/chrome/browser/views/about_ipc_dialog.cc
@@ -29,7 +29,7 @@
#include "net/url_request/url_request_job_tracker.h"
#include "views/grid_layout.h"
#include "views/controls/button/text_button.h"
-#include "views/controls/hwnd_view.h"
+#include "views/controls/native/native_view_host.h"
#include "views/standard_layout.h"
#include "views/widget/root_view.h"
#include "views/widget/widget.h"
@@ -316,7 +316,7 @@ void AboutIPCDialog::SetupControls() {
clear_button_ = new views::TextButton(this, kClearLabel);
filter_button_ = new views::TextButton(this, kFilterLabel);
- table_ = new views::HWNDView();
+ table_ = new views::NativeViewHost;
static const int first_column_set = 1;
views::ColumnSet* column_set = layout->AddColumnSet(first_column_set);
diff --git a/chrome/browser/views/about_ipc_dialog.h b/chrome/browser/views/about_ipc_dialog.h
index db9d39a..d111eac 100644
--- a/chrome/browser/views/about_ipc_dialog.h
+++ b/chrome/browser/views/about_ipc_dialog.h
@@ -15,8 +15,8 @@
class Profile;
namespace views {
+class NativeViewHost;
class TextButton;
-class HWNDView;
} // namespace views
class AboutIPCDialog : public views::DialogDelegate,
@@ -59,7 +59,7 @@ class AboutIPCDialog : public views::DialogDelegate,
views::TextButton* track_toggle_;
views::TextButton* clear_button_;
views::TextButton* filter_button_;
- views::HWNDView* table_;
+ views::NativeViewHost* table_;
// Set to true when we're tracking network status.
bool tracking_;
diff --git a/chrome/browser/views/constrained_window_impl.cc b/chrome/browser/views/constrained_window_impl.cc
index 596321e..af40fc5 100644
--- a/chrome/browser/views/constrained_window_impl.cc
+++ b/chrome/browser/views/constrained_window_impl.cc
@@ -31,7 +31,6 @@
#include "grit/theme_resources.h"
#include "net/base/net_util.h"
#include "views/controls/button/image_button.h"
-#include "views/controls/hwnd_view.h"
#include "views/focus/focus_manager.h"
#include "views/window/client_view.h"
#include "views/window/non_client_view.h"
diff --git a/chrome/browser/views/constrained_window_impl.h b/chrome/browser/views/constrained_window_impl.h
index bb29031..0760a4d 100644
--- a/chrome/browser/views/constrained_window_impl.h
+++ b/chrome/browser/views/constrained_window_impl.h
@@ -14,7 +14,6 @@ class ConstrainedTabContentsWindowDelegate;
class ConstrainedWindowAnimation;
class ConstrainedWindowFrameView;
namespace views {
-class HWNDView;
class WindowDelegate;
}
diff --git a/chrome/browser/views/dom_view.cc b/chrome/browser/views/dom_view.cc
index 7213bcf..d38a412 100644
--- a/chrome/browser/views/dom_view.cc
+++ b/chrome/browser/views/dom_view.cc
@@ -23,7 +23,7 @@ bool DOMView::Init(Profile* profile, SiteInstance* instance) {
initialized_ = true;
tab_contents_.reset(new TabContents(profile, instance,
MSG_ROUTING_NONE, NULL));
- views::HWNDView::Attach(tab_contents_->GetNativeView());
+ views::NativeViewHost::Attach(tab_contents_->GetNativeView());
return true;
}
diff --git a/chrome/browser/views/dom_view.h b/chrome/browser/views/dom_view.h
index 303e57d..ac59bd9 100644
--- a/chrome/browser/views/dom_view.h
+++ b/chrome/browser/views/dom_view.h
@@ -10,14 +10,14 @@
#include "base/scoped_ptr.h"
#include "googleurl/src/gurl.h"
-#include "views/controls/hwnd_view.h"
+#include "views/controls/native/native_view_host.h"
#include "views/event.h"
class Profile;
class SiteInstance;
class TabContents;
-class DOMView : public views::HWNDView {
+class DOMView : public views::NativeViewHost {
public:
// Construct a DOMView to display the given data: URL.
explicit DOMView();
diff --git a/chrome/browser/views/location_bar_view.cc b/chrome/browser/views/location_bar_view.cc
index c4a82dc..ac2ebc6 100644
--- a/chrome/browser/views/location_bar_view.cc
+++ b/chrome/browser/views/location_bar_view.cc
@@ -138,22 +138,22 @@ void LocationBarView::Init() {
profile_, command_updater_,
popup_window_mode_,
popup_positioner_));
- location_entry_view_ = new views::HWNDView;
#else
location_entry_.reset(new AutocompleteEditViewGtk(this, model_, profile_,
command_updater_,
popup_positioner_));
- location_entry_view_ = new views::NativeViewHostGtk;
#endif
- DCHECK(location_entry_view_) << "LocationBarView::Init - OOM!";
+ location_entry_view_ = new views::NativeViewHost;
location_entry_view_->SetID(VIEW_ID_AUTOCOMPLETE);
AddChildView(location_entry_view_);
- location_entry_view_->SetAssociatedFocusView(this);
+ location_entry_view_->set_focus_view(this);
+ location_entry_view_->Attach(
#if defined(OS_WIN)
- location_entry_view_->Attach(location_entry_->m_hWnd);
+ location_entry_->m_hWnd
#else
- location_entry_view_->Attach(location_entry_->widget());
+ location_entry_->widget()
#endif
+ );
AddChildView(&selected_keyword_view_);
selected_keyword_view_.SetFont(font_);
diff --git a/chrome/browser/views/location_bar_view.h b/chrome/browser/views/location_bar_view.h
index ff52a43..de3d9bf 100644
--- a/chrome/browser/views/location_bar_view.h
+++ b/chrome/browser/views/location_bar_view.h
@@ -17,14 +17,13 @@
#include "chrome/browser/views/info_bubble.h"
#include "views/controls/image_view.h"
#include "views/controls/label.h"
+#include "views/controls/native/native_view_host.h"
#include "views/painter.h"
#if defined(OS_WIN)
#include "chrome/browser/autocomplete/autocomplete_edit_view_win.h"
-#include "views/controls/hwnd_view.h"
#else
#include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h"
-#include "views/controls/native_view_host_gtk.h"
#endif
class AutocompletePopupPositioner;
@@ -467,11 +466,7 @@ class LocationBarView : public LocationBar,
gfx::Font font_;
// Location_entry view wrapper
-#if defined(OS_WIN)
- views::HWNDView* location_entry_view_;
-#else
- views::NativeViewHostGtk* location_entry_view_;
-#endif
+ views::NativeViewHost* location_entry_view_;
// The following views are used to provide hints and remind the user as to
// what is going in the edit. They are all added a children of the
diff --git a/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.cc b/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.cc
index 55e73dd..9ca9b8c 100644
--- a/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.cc
+++ b/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.cc
@@ -30,7 +30,7 @@ void NativeTabContentsContainerGtk::AttachContents(TabContents* contents) {
// We need to register the tab contents window with the BrowserContainer so
// that the BrowserContainer is the focused view when the focus is on the
// TabContents window (for the TabContents case).
- SetAssociatedFocusView(this);
+ set_focus_view(this);
Attach(contents->GetNativeView());
@@ -45,7 +45,7 @@ void NativeTabContentsContainerGtk::AttachContents(TabContents* contents) {
void NativeTabContentsContainerGtk::DetachContents(TabContents* contents) {
// TODO(port): figure out focus interception
#if defined(OS_WIN)
- // TODO(brettw) should this move to HWNDView::Detach which is called below?
+ // TODO(brettw) should this move to NativeViewHost::Detach which is called below?
// It needs cleanup regardless.
HWND container_hwnd = contents->GetNativeView();
diff --git a/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.h b/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.h
index e4e245d..16d9c5f 100644
--- a/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.h
+++ b/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.h
@@ -9,7 +9,7 @@
#include "views/controls/native_view_host_gtk.h"
class NativeTabContentsContainerGtk : public NativeTabContentsContainer,
- public views::NativeViewHostGtk {
+ public views::NativeViewHost {
public:
explicit NativeTabContentsContainerGtk(TabContentsContainer* container);
virtual ~NativeTabContentsContainerGtk();
diff --git a/chrome/browser/views/tab_contents/native_tab_contents_container_win.cc b/chrome/browser/views/tab_contents/native_tab_contents_container_win.cc
index eb6e75f..42a4357 100644
--- a/chrome/browser/views/tab_contents/native_tab_contents_container_win.cc
+++ b/chrome/browser/views/tab_contents/native_tab_contents_container_win.cc
@@ -30,7 +30,7 @@ void NativeTabContentsContainerWin::AttachContents(TabContents* contents) {
// We need to register the tab contents window with the BrowserContainer so
// that the BrowserContainer is the focused view when the focus is on the
// TabContents window (for the TabContents case).
- SetAssociatedFocusView(this);
+ set_focus_view(this);
Attach(contents->GetNativeView());
HWND contents_hwnd = contents->GetContentNativeView();
@@ -39,7 +39,7 @@ void NativeTabContentsContainerWin::AttachContents(TabContents* contents) {
}
void NativeTabContentsContainerWin::DetachContents(TabContents* contents) {
- // TODO(brettw) should this move to HWNDView::Detach which is called below?
+ // TODO(brettw) should this move to NativeViewHost::Detach which is called below?
// It needs cleanup regardless.
HWND container_hwnd = contents->GetNativeView();
diff --git a/chrome/browser/views/tab_contents/native_tab_contents_container_win.h b/chrome/browser/views/tab_contents/native_tab_contents_container_win.h
index 819ba30..301c26b 100644
--- a/chrome/browser/views/tab_contents/native_tab_contents_container_win.h
+++ b/chrome/browser/views/tab_contents/native_tab_contents_container_win.h
@@ -6,10 +6,10 @@
#define CHROME_BROWSER_VIEWS_TAB_CONTENTS_NATIVE_TAB_CONTENTS_CONTAINER_WIN_H_
#include "chrome/browser/views/tab_contents/native_tab_contents_container.h"
-#include "views/controls/hwnd_view.h"
+#include "views/controls/native/native_view_host.h"
class NativeTabContentsContainerWin : public NativeTabContentsContainer,
- public views::HWNDView {
+ public views::NativeViewHost {
public:
explicit NativeTabContentsContainerWin(TabContentsContainer* container);
virtual ~NativeTabContentsContainerWin();
diff --git a/chrome/common/temp_scaffolding_stubs.h b/chrome/common/temp_scaffolding_stubs.h
index 7af52bc..662e166 100644
--- a/chrome/common/temp_scaffolding_stubs.h
+++ b/chrome/common/temp_scaffolding_stubs.h
@@ -423,28 +423,4 @@ class OSExchangeData {
class BaseDragSource {
};
-//---------------------------------------------------------------------------
-// These stubs are for extensions
-
-namespace views {
-class HWNDView {
- public:
- int width() { NOTIMPLEMENTED(); return 0; }
- int height() { NOTIMPLEMENTED(); return 0; }
- void InitHidden() { NOTIMPLEMENTED(); }
- void SetPreferredSize(const gfx::Size& size) { NOTIMPLEMENTED(); }
- virtual void SetBackground(const SkBitmap&) { NOTIMPLEMENTED(); }
- virtual void SetVisible(bool flag) { NOTIMPLEMENTED(); }
- void SizeToPreferredSize() { NOTIMPLEMENTED(); }
- bool IsVisible() const { NOTIMPLEMENTED(); return false; }
- void Layout() { NOTIMPLEMENTED(); }
- void SchedulePaint() { NOTIMPLEMENTED(); }
- HWNDView* GetParent() const { NOTIMPLEMENTED(); return NULL; }
- virtual gfx::Size GetPreferredSize() { NOTIMPLEMENTED(); return gfx::Size(); }
- gfx::NativeWindow GetHWND() { NOTIMPLEMENTED(); return 0; }
- void Detach() { NOTIMPLEMENTED(); }
- gfx::Widget* GetWidget() { NOTIMPLEMENTED(); return NULL; }
-};
-} // namespace views
-
#endif // CHROME_COMMON_TEMP_SCAFFOLDING_STUBS_H_