Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(715)

Unified Diff: ios/web/web_state/web_state_impl.mm

Issue 1851003003: [ios] Added web// public API to let embedder observe loading progress. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed compilation Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/web/web_state/web_state_impl.h ('k') | ios/web/web_state/web_state_impl_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/web_state/web_state_impl.mm
diff --git a/ios/web/web_state/web_state_impl.mm b/ios/web/web_state/web_state_impl.mm
index f8d9071ee4057382deb5413ef20afae91161654d..281be04734354ded9271881a608a6b278ad83db1 100644
--- a/ios/web/web_state/web_state_impl.mm
+++ b/ios/web/web_state/web_state_impl.mm
@@ -19,6 +19,7 @@
#include "ios/web/public/web_client.h"
#include "ios/web/public/web_state/credential.h"
#include "ios/web/public/web_state/ui/crw_content_view.h"
+#include "ios/web/public/web_state/web_state_delegate.h"
#include "ios/web/public/web_state/web_state_observer.h"
#include "ios/web/public/web_state/web_state_policy_decider.h"
#include "ios/web/web_state/global_web_state_event_tracker.h"
@@ -33,7 +34,8 @@
namespace web {
WebStateImpl::WebStateImpl(BrowserState* browser_state)
- : is_loading_(false),
+ : delegate_(nullptr),
+ is_loading_(false),
is_being_destroyed_(false),
facade_delegate_(nullptr),
web_controller_(nil),
@@ -65,6 +67,22 @@ WebStateImpl::~WebStateImpl() {
DCHECK(script_command_callbacks_.empty());
if (request_tracker_.get())
CloseRequestTracker();
+ SetDelegate(nullptr);
+}
+
+WebStateDelegate* WebStateImpl::GetDelegate() {
+ return delegate_;
+}
+
+void WebStateImpl::SetDelegate(WebStateDelegate* delegate) {
+ if (delegate == delegate_)
+ return;
+ if (delegate_)
+ delegate_->Detach(this);
+ delegate_ = delegate;
+ if (delegate_) {
+ delegate_->Attach(this);
+ }
}
void WebStateImpl::AddObserver(WebStateObserver* observer) {
@@ -379,6 +397,12 @@ void WebStateImpl::ClearTransientContentView() {
[web_controller_ clearTransientContentView];
}
+void WebStateImpl::SendChangeLoadProgress(double progress) {
+ if (delegate_) {
+ delegate_->LoadProgressChanged(this, progress);
+ }
+}
+
WebUIIOS* WebStateImpl::CreateWebUIIOS(const GURL& url) {
WebUIIOSControllerFactory* factory =
WebUIIOSControllerFactoryRegistry::GetInstance();
« no previous file with comments | « ios/web/web_state/web_state_impl.h ('k') | ios/web/web_state/web_state_impl_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698