diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-01 23:18:33 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-01 23:18:33 +0000 |
commit | 2eaf9dd9583136aea0dbb133f632226d8771e02c (patch) | |
tree | 7fb4f12c3ea130e91acd5a603b1b241e2b2209af /chrome/browser/instant | |
parent | f6dba747f2ab7dd162a7c2d10d69a172bebfd84d (diff) | |
download | chromium_src-2eaf9dd9583136aea0dbb133f632226d8771e02c.zip chromium_src-2eaf9dd9583136aea0dbb133f632226d8771e02c.tar.gz chromium_src-2eaf9dd9583136aea0dbb133f632226d8771e02c.tar.bz2 |
Makes instant show SSL error page. Because these end up with a
different RenderViewHost I wasn't seeing the paint, and wasn't
showing the preview. I've plumbed through notification so that I can
detect this case.
I'm writing the test for this separately.
BUG=74085
TEST=see bug
Review URL: http://codereview.chromium.org/6597056
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76458 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/instant')
-rw-r--r-- | chrome/browser/instant/instant_loader.cc | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc index 2578aaf..2163bb1 100644 --- a/chrome/browser/instant/instant_loader.cc +++ b/chrome/browser/instant/instant_loader.cc @@ -145,10 +145,6 @@ class InstantLoader::TabContentsDelegateImpl // Invoked prior to loading a new URL. void PrepareForNewLoad(); - // Invoked when removed as the delegate. Gives a chance to do any necessary - // cleanup. - void Reset(); - // Invoked when the preview paints. Invokes PreviewPainted on the loader. void PreviewPainted(); @@ -263,6 +259,9 @@ InstantLoader::TabContentsDelegateImpl::TabContentsDelegateImpl( waiting_for_new_page_(true), is_mouse_down_from_activate_(false), user_typed_before_load_(false) { + DCHECK(loader->preview_contents()); + registrar_.Add(this, NotificationType::INTERSTITIAL_ATTACHED, + Source<TabContents>(loader->preview_contents()->tab_contents())); } void InstantLoader::TabContentsDelegateImpl::PrepareForNewLoad() { @@ -272,11 +271,6 @@ void InstantLoader::TabContentsDelegateImpl::PrepareForNewLoad() { UnregisterForPaintNotifications(); } -void InstantLoader::TabContentsDelegateImpl::Reset() { - is_mouse_down_from_activate_ = false; - UnregisterForPaintNotifications(); -} - void InstantLoader::TabContentsDelegateImpl::PreviewPainted() { loader_->PreviewPainted(); } @@ -367,13 +361,19 @@ void InstantLoader::TabContentsDelegateImpl::Observe( NotificationType type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::RENDER_WIDGET_HOST_DID_PAINT) { - UnregisterForPaintNotifications(); - PreviewPainted(); - } else if (type == NotificationType::RENDER_WIDGET_HOST_DESTROYED) { - UnregisterForPaintNotifications(); - } else { - NOTREACHED() << "Got a notification we didn't register for."; + switch (type.value) { + case NotificationType::RENDER_WIDGET_HOST_DID_PAINT: + UnregisterForPaintNotifications(); + PreviewPainted(); + break; + case NotificationType::RENDER_WIDGET_HOST_DESTROYED: + UnregisterForPaintNotifications(); + break; + case NotificationType::INTERSTITIAL_ATTACHED: + PreviewPainted(); + break; + default: + NOTREACHED() << "Got a notification we didn't register for."; } } @@ -570,14 +570,11 @@ InstantLoader::InstantLoader(InstantLoaderDelegate* delegate, TemplateURLID id) template_url_id_(id), ready_(false), last_transition_type_(PageTransition::LINK) { - preview_tab_contents_delegate_.reset(new TabContentsDelegateImpl(this)); } InstantLoader::~InstantLoader() { registrar_.RemoveAll(); - preview_tab_contents_delegate_->Reset(); - // Delete the TabContents before the delegate as the TabContents holds a // reference to the delegate. preview_contents_.reset(); @@ -716,7 +713,8 @@ void InstantLoader::SetOmniboxBounds(const gfx::Rect& bounds) { } bool InstantLoader::IsMouseDownFromActivate() { - return preview_tab_contents_delegate_->is_mouse_down_from_activate(); + return preview_tab_contents_delegate_.get() && + preview_tab_contents_delegate_->is_mouse_down_from_activate(); } TabContentsWrapper* InstantLoader::ReleasePreviewContents( @@ -762,7 +760,6 @@ TabContentsWrapper* InstantLoader::ReleasePreviewContents( #endif } preview_contents_->tab_contents()->set_delegate(NULL); - preview_tab_contents_delegate_->Reset(); ready_ = false; } update_bounds_timer_.Stop(); @@ -918,6 +915,7 @@ void InstantLoader::CreatePreviewContents(TabContentsWrapper* tab_contents) { if (max_page_id != -1) preview_contents_->controller().set_max_restored_page_id(max_page_id + 1); + preview_tab_contents_delegate_.reset(new TabContentsDelegateImpl(this)); new_contents->set_delegate(preview_tab_contents_delegate_.get()); gfx::Rect tab_bounds; |