Commit a2e7dbf0 authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Commit Bot

Allow WebStateObserver to observe N WebStates [31/N].

Convert PagePlaceholderTabHelper to directly track
the registration with the observed WebState instead
of relying on the deprecated code in WebStateObserver.

Bug: 775684
Change-Id: I9784be30ecab75126349d401bfe75bc3114dd703
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Reviewed-on: https://chromium-review.googlesource.com/768815
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#517108}
parent aa2c2abf
...@@ -19,9 +19,9 @@ DEFINE_WEB_STATE_USER_DATA_KEY(PagePlaceholderTabHelper); ...@@ -19,9 +19,9 @@ DEFINE_WEB_STATE_USER_DATA_KEY(PagePlaceholderTabHelper);
PagePlaceholderTabHelper::PagePlaceholderTabHelper( PagePlaceholderTabHelper::PagePlaceholderTabHelper(
web::WebState* web_state, web::WebState* web_state,
id<PagePlaceholderTabHelperDelegate> delegate) id<PagePlaceholderTabHelperDelegate> delegate)
: web::WebStateObserver(web_state), : delegate_(delegate), weak_factory_(this) {
delegate_(delegate), web_state->AddObserver(this);
weak_factory_(this) {} }
PagePlaceholderTabHelper::~PagePlaceholderTabHelper() { PagePlaceholderTabHelper::~PagePlaceholderTabHelper() {
RemovePlaceholder(); RemovePlaceholder();
...@@ -58,6 +58,7 @@ void PagePlaceholderTabHelper::PageLoaded(web::WebState* web_state, ...@@ -58,6 +58,7 @@ void PagePlaceholderTabHelper::PageLoaded(web::WebState* web_state,
} }
void PagePlaceholderTabHelper::WebStateDestroyed(web::WebState* web_state) { void PagePlaceholderTabHelper::WebStateDestroyed(web::WebState* web_state) {
web_state->RemoveObserver(this);
RemovePlaceholder(); RemovePlaceholder();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment