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

Unified Diff: ios/chrome/browser/ui/preload_controller.h

Issue 2775623002: [ios] WebStateList owns all WebState it manages. (Closed)
Patch Set: Fix gn check Created 3 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
Index: ios/chrome/browser/ui/preload_controller.h
diff --git a/ios/chrome/browser/ui/preload_controller.h b/ios/chrome/browser/ui/preload_controller.h
index ec6f4a37ed95dc0c25ceb0968ba52ba7168dc89a..8c865a8dd7cee8fdaf9230a4e1754c65fd1ee1d0 100644
--- a/ios/chrome/browser/ui/preload_controller.h
+++ b/ios/chrome/browser/ui/preload_controller.h
@@ -9,7 +9,6 @@
#include <memory>
-#include "base/mac/scoped_nsobject.h"
#include "components/prefs/pref_change_registrar.h"
#import "ios/chrome/browser/net/connection_type_observer_bridge.h"
#import "ios/chrome/browser/prefs/pref_observer_bridge.h"
@@ -21,13 +20,15 @@
#include "ui/base/page_transition_types.h"
#include "url/gurl.h"
+@protocol PreloadControllerDelegate;
+
namespace ios {
class ChromeBrowserState;
}
-class PrefetchDelegate;
-@protocol PreloadControllerDelegate;
-@class Tab;
+namespace web {
+class WebState;
+}
// ID of the URLFetcher responsible for prefetches.
extern const int kPreloadControllerURLFetcherID;
@@ -43,62 +44,7 @@ extern const int kPreloadControllerURLFetcherID;
PrefObserverDelegate,
PreloadProvider,
TabDelegate,
- CRConnectionTypeObserverBridge> {
- @private
- ios::ChromeBrowserState* browserState_; // Weak.
-
- // The prerendered tab. Can be nil.
- base::scoped_nsobject<Tab> tab_;
-
- // The URL that is prerendered in |tab_|. This can be different from the
- // value returned by |tab_.url|, for example in cases where there was a
- // redirect.
- //
- // When choosing whether or not to use a prerendered Tab,
- // BrowserViewController compares the URL being loaded by the omnibox with the
- // URL of the prerendered Tab. Comparing against the Tab's currently URL
- // could return false negatives in cases of redirect, hence the need to store
- // the originally prerendered URL.
- GURL prerenderedURL_;
-
- // The URL that is scheduled to be prerendered, its associated transition and
- // referrer. |scheduledTransition_| and |scheduledReferrer_| are not valid
- // when |scheduledURL_| is empty.
- GURL scheduledURL_;
- ui::PageTransition scheduledTransition_;
- web::Referrer scheduledReferrer_;
-
- // The most-recently prefetched URL, or nil if there have been no prefetched
- // URLs.
- GURL prefetchedURL_;
-
- // The URLFetcher and associated delegate used to prefetch URLs. The delegate
- // simply forwards callbacks from URLFetcher back to the PrerenderController.
- std::unique_ptr<PrefetchDelegate> prefetcherDelegate_;
- std::unique_ptr<net::URLFetcher> prefetcher_;
-
- // Bridge to listen to pref changes.
- std::unique_ptr<PrefObserverBridge> observerBridge_;
- // Registrar for pref changes notifications.
- PrefChangeRegistrar prefChangeRegistrar_;
- // Observer for the WWAN setting. Contains a valid object only if the
- // instant setting is set to wifi-only.
- std::unique_ptr<ConnectionTypeObserverBridge> connectionTypeObserverBridge_;
-
- // Whether or not the preference is enabled.
- BOOL enabled_;
- // Whether or not prerendering is only when on wifi.
- BOOL wifiOnly_;
- // Whether or not the current connection is using WWAN.
- BOOL usingWWAN_;
-
- // Number of successful prerenders (i.e. the user viewed the prerendered page)
- // during the lifetime of this controller.
- int successfulPrerendersPerSessionCount_;
-
- id<PreloadControllerDelegate> delegate_; // weak
-}
-
+ CRConnectionTypeObserverBridge>
// The URL of the currently prerendered Tab. Empty if there is no prerendered
// Tab.
@property(nonatomic, readonly, assign) GURL prerenderedURL;
@@ -114,10 +60,10 @@ extern const int kPreloadControllerURLFetcherID;
// destroyed.
- (void)browserStateDestroyed;
-// Returns the currently prerendered Tab, or nil if none exists. The caller
-// must retain the returned Tab if needed. After this method is called, the
-// PrerenderController reverts to a non-prerendering state.
-- (Tab*)releasePrerenderContents;
+// Returns the currently prerendered WebState, or nil if none exists. After
+// this method is called, the PrerenderController reverts to a non-prerendering
+// state.
+- (std::unique_ptr<web::WebState>)releasePrerenderContents;
// Returns true if the content of |url| has been prefetched.
- (BOOL)hasPrefetchedURL:(const GURL&)url;
« no previous file with comments | « ios/chrome/browser/ui/overscroll_actions/overscroll_actions_controller.mm ('k') | ios/chrome/browser/ui/preload_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698