Index: chrome/browser/ui/views/html_dialog_view.cc |
diff --git a/chrome/browser/ui/views/html_dialog_view.cc b/chrome/browser/ui/views/html_dialog_view.cc |
index 116795d73965d413d07973ecbe64916382642fe0..74aa2c5afc9c70f1f6bcd91d44a21f2b8623e6b3 100644 |
--- a/chrome/browser/ui/views/html_dialog_view.cc |
+++ b/chrome/browser/ui/views/html_dialog_view.cc |
@@ -47,7 +47,7 @@ HtmlDialogView::HtmlDialogView(Profile* profile, |
HtmlDialogUIDelegate* delegate) |
: DOMView(), |
HtmlDialogTabContentsDelegate(profile), |
- state_(NONE), |
+ initialized_(false), |
delegate_(delegate) { |
} |
@@ -74,8 +74,8 @@ bool HtmlDialogView::AcceleratorPressed(const views::Accelerator& accelerator) { |
void HtmlDialogView::ViewHierarchyChanged( |
bool is_add, View* parent, View* child) { |
DOMView::ViewHierarchyChanged(is_add, parent, child); |
- if (is_add && GetWidget() && state_ == NONE) { |
- state_ = INITIALIZED; |
+ if (is_add && GetWidget() && !initialized_) { |
+ initialized_ = true; |
#if defined(OS_CHROMEOS) && defined(TOOLKIT_USES_GTK) |
CHECK( |
static_cast<views::NativeWidgetGtk*>( |
@@ -241,52 +241,19 @@ void HtmlDialogView::InitDialog() { |
TabContents* tab_contents = dom_contents_->tab_contents(); |
tab_contents->set_delegate(this); |
- // Set the delegate. This must be done before loading the page. See |
- // the comment above HtmlDialogUI in its header file for why. |
- HtmlDialogUI::GetPropertyAccessor().SetProperty( |
- tab_contents->property_bag(), this); |
- notification_registrar_.Add( |
- this, |
- content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, |
- content::Source<TabContents>(tab_contents)); |
- notification_registrar_.Add( |
- this, |
- content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
- content::Source<TabContents>(tab_contents)); |
- |
DOMView::LoadURL(GetDialogContentURL()); |
} |
-void HtmlDialogView::Observe(int type, |
- const content::NotificationSource& source, |
- const content::NotificationDetails& details) { |
- switch (type) { |
- case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB: { |
- RenderWidgetHost* rwh = content::Details<RenderWidgetHost>(details).ptr(); |
- notification_registrar_.Add( |
- this, |
- content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, |
- content::Source<RenderWidgetHost>(rwh)); |
- break; |
- } |
- case content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME: |
- if (state_ == INITIALIZED) |
- state_ = LOADED; |
- break; |
- case content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT: |
- if (state_ == LOADED) { |
- state_ = PAINTED; |
+void HtmlDialogView::OnTabMainFrameFirstRender() { |
#if defined(OS_CHROMEOS) && defined(TOOLKIT_USES_GTK) |
- views::NativeWidgetGtk::UpdateFreezeUpdatesProperty( |
- GTK_WINDOW(GetWidget()->GetNativeView()), false); |
-#endif |
- } |
- break; |
- default: |
- NOTREACHED() << "unknown type" << type; |
+ if (initialized_) { |
+ views::NativeWidgetGtk::UpdateFreezeUpdatesProperty( |
+ GTK_WINDOW(GetWidget()->GetNativeView()), false); |
} |
+#endif |
} |
oshima
2011/10/27 20:49:30
nit: remove empty line
xiyuan
2011/10/27 21:48:07
Done.
|
+ |
void HtmlDialogView::RegisterDialogAccelerators() { |
// Pressing the ESC key will close the dialog. |
AddAccelerator(views::Accelerator(ui::VKEY_ESCAPE, false, false, false)); |