Chromium Code Reviews| Index: chrome/browser/ui/views/html_dialog_view.h |
| diff --git a/chrome/browser/ui/views/html_dialog_view.h b/chrome/browser/ui/views/html_dialog_view.h |
| index 38e59aadab4254e09cfcba1e2944c3163b10dfb9..f9bc9db886c69eff3249ef4045b94d6462613921 100644 |
| --- a/chrome/browser/ui/views/html_dialog_view.h |
| +++ b/chrome/browser/ui/views/html_dialog_view.h |
| @@ -11,6 +11,8 @@ |
| #include "chrome/browser/ui/views/dom_view.h" |
| #include "chrome/browser/ui/webui/html_dialog_tab_contents_delegate.h" |
| #include "chrome/browser/ui/webui/html_dialog_ui.h" |
| +#include "content/common/notification_observer.h" |
| +#include "content/common/notification_registrar.h" |
| #include "ui/gfx/size.h" |
| #include "views/window/window_delegate.h" |
| @@ -36,7 +38,8 @@ class HtmlDialogView |
| : public DOMView, |
| public HtmlDialogTabContentsDelegate, |
| public HtmlDialogUIDelegate, |
| - public views::WindowDelegate { |
| + public views::WindowDelegate, |
| + public NotificationObserver { |
| public: |
| HtmlDialogView(Profile* profile, HtmlDialogUIDelegate* delegate); |
| virtual ~HtmlDialogView(); |
| @@ -47,6 +50,7 @@ class HtmlDialogView |
| // Overridden from views::View: |
| virtual gfx::Size GetPreferredSize(); |
| virtual bool AcceleratorPressed(const views::Accelerator& accelerator); |
| + virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child); |
| // Overridden from views::WindowDelegate: |
| virtual bool CanResize() const; |
| @@ -76,13 +80,37 @@ class HtmlDialogView |
| virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); |
| virtual void CloseContents(TabContents* source); |
| + // Overridden from NotificationObserver |
| + virtual void Observe(NotificationType type, |
| + const NotificationSource& source, |
| + const NotificationDetails& details); |
|
sky
2011/06/07 15:41:17
OVERRIDE
|
| + |
| + protected: |
| + // Register accelerators for this dialog. |
| + virtual void RegisterDialogAccelerators(); |
| + |
| private: |
| + // A state used to ensure that we show the window only after the |
| + // renderer painted the full page. |
| + enum DialogState { |
| + NONE, |
| + INITIALIZED, // FreezeUpdates property is set to prevent WM from showing |
| + // the window until the property is remoevd. |
| + LOADED, // Renderer loaded the page. |
| + PAINTED, // 1st paint event after the page is loaded. |
| + // FreezeUpdates property is removed to tell WM to shows |
| + // the window. |
| + }; |
| + DialogState state_; |
|
sky
2011/06/07 15:41:17
newline between 103 and 104
|
| + |
| // This view is a delegate to the HTML content since it needs to get notified |
| // about when the dialog is closing. For all other actions (besides dialog |
| // closing) we delegate to the creator of this view, which we keep track of |
| // using this variable. |
| HtmlDialogUIDelegate* delegate_; |
| + NotificationRegistrar notification_registrar_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(HtmlDialogView); |
| }; |