diff options
Diffstat (limited to 'chrome/browser/views/input_window.cc')
-rw-r--r-- | chrome/browser/views/input_window.cc | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/chrome/browser/views/input_window.cc b/chrome/browser/views/input_window.cc index 058e29d..f4c560e 100644 --- a/chrome/browser/views/input_window.cc +++ b/chrome/browser/views/input_window.cc @@ -51,13 +51,10 @@ class ContentView : public ChromeViews::View, public: explicit ContentView(InputWindowDelegate* delegate) : delegate_(delegate), - window_(NULL), focus_grabber_factory_(this) { DCHECK(delegate_); } - void set_window(ChromeViews::Window* window) { window_ = window; } - // ChromeViews::DialogDelegate overrides: virtual bool IsDialogButtonEnabled(DialogButton button) const; virtual bool Accept(); @@ -65,6 +62,7 @@ class ContentView : public ChromeViews::View, virtual void WindowClosing(); virtual std::wstring GetWindowTitle() const; virtual bool IsModal() const { return true; } + virtual ChromeViews::View* GetContentsView(); // ChromeViews::TextField::Controller overrides: virtual void ContentsChanged(ChromeViews::TextField* sender, @@ -91,9 +89,6 @@ class ContentView : public ChromeViews::View, // caller. InputWindowDelegate* delegate_; - // The Window that owns this view. - ChromeViews::Window* window_; - // Helps us set focus to the first TextField in the window. ScopedRunnableMethodFactory<ContentView> focus_grabber_factory_; @@ -127,12 +122,16 @@ std::wstring ContentView::GetWindowTitle() const { return delegate_->GetWindowTitle(); } +ChromeViews::View* ContentView::GetContentsView() { + return this; +} + /////////////////////////////////////////////////////////////////////////////// // ContentView, ChromeViews::TextField::Controller implementation: void ContentView::ContentsChanged(ChromeViews::TextField* sender, const std::wstring& new_contents) { - window_->UpdateDialogButtons(); + window()->UpdateDialogButtons(); } /////////////////////////////////////////////////////////////////////////////// @@ -185,10 +184,9 @@ void ContentView::FocusFirstFocusableControl() { ChromeViews::Window* CreateInputWindow(HWND parent_hwnd, InputWindowDelegate* delegate) { - ContentView* cv = new ContentView(delegate); - ChromeViews::Window* window = ChromeViews::Window::CreateChromeWindow( - parent_hwnd, gfx::Rect(), cv, cv); - cv->set_window(window); + ChromeViews::Window* window = + ChromeViews::Window::CreateChromeWindow(parent_hwnd, gfx::Rect(), + new ContentView(delegate)); window->UpdateDialogButtons(); return window; } |