Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_ | 5 #ifndef IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_ |
| 6 #define IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_ | 6 #define IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 } | 34 } |
| 35 | 35 |
| 36 namespace web { | 36 namespace web { |
| 37 | 37 |
| 38 class BrowserState; | 38 class BrowserState; |
| 39 struct Credential; | 39 struct Credential; |
| 40 struct FaviconURL; | 40 struct FaviconURL; |
| 41 struct LoadCommittedDetails; | 41 struct LoadCommittedDetails; |
| 42 class NavigationManager; | 42 class NavigationManager; |
| 43 class WebInterstitialImpl; | 43 class WebInterstitialImpl; |
| 44 class WebStateDelegate; | |
| 44 class WebStateFacadeDelegate; | 45 class WebStateFacadeDelegate; |
| 45 class WebStatePolicyDecider; | 46 class WebStatePolicyDecider; |
| 46 class WebUIIOS; | 47 class WebUIIOS; |
| 47 | 48 |
| 48 // Implementation of WebState. | 49 // Implementation of WebState. |
| 49 // Generally mirrors //content's WebContents implementation. | 50 // Generally mirrors //content's WebContents implementation. |
| 50 // General notes on expected WebStateImpl ownership patterns: | 51 // General notes on expected WebStateImpl ownership patterns: |
| 51 // - Outside of tests, WebStateImpls are created | 52 // - Outside of tests, WebStateImpls are created |
| 52 // (a) By @Tab, when creating a new Tab. | 53 // (a) By @Tab, when creating a new Tab. |
| 53 // (b) By @SessionWindow, when decoding a saved session. | 54 // (b) By @SessionWindow, when decoding a saved session. |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 209 RequestTrackerImpl* GetRequestTracker(); | 210 RequestTrackerImpl* GetRequestTracker(); |
| 210 | 211 |
| 211 // Lazily creates (if necessary) and returns |request_group_id_|. | 212 // Lazily creates (if necessary) and returns |request_group_id_|. |
| 212 // IMPORTANT: This should not be used for anything other than associating this | 213 // IMPORTANT: This should not be used for anything other than associating this |
| 213 // instance to network requests. | 214 // instance to network requests. |
| 214 // This function is only intended to be used in web/. | 215 // This function is only intended to be used in web/. |
| 215 // TODO(stuartmorgan): Move this method in an implementation file in web/. | 216 // TODO(stuartmorgan): Move this method in an implementation file in web/. |
| 216 NSString* GetRequestGroupID(); | 217 NSString* GetRequestGroupID(); |
| 217 | 218 |
| 218 // WebState: | 219 // WebState: |
| 220 WebStateDelegate* GetDelegate() override; | |
| 221 void SetDelegate(WebStateDelegate* delegate) override; | |
| 219 UIView* GetView() override; | 222 UIView* GetView() override; |
| 220 BrowserState* GetBrowserState() const override; | 223 BrowserState* GetBrowserState() const override; |
| 221 void OpenURL(const WebState::OpenURLParams& params) override; | 224 void OpenURL(const WebState::OpenURLParams& params) override; |
| 222 NavigationManager* GetNavigationManager() override; | 225 NavigationManager* GetNavigationManager() override; |
| 223 CRWJSInjectionReceiver* GetJSInjectionReceiver() const override; | 226 CRWJSInjectionReceiver* GetJSInjectionReceiver() const override; |
| 224 const std::string& GetContentLanguageHeader() const override; | 227 const std::string& GetContentLanguageHeader() const override; |
| 225 const std::string& GetContentsMimeType() const override; | 228 const std::string& GetContentsMimeType() const override; |
| 226 bool ContentIsHTML() const override; | 229 bool ContentIsHTML() const override; |
| 227 const base::string16& GetTitle() const override; | 230 const base::string16& GetTitle() const override; |
| 228 bool IsLoading() const override; | 231 bool IsLoading() const override; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 243 bool bypass_cache, | 246 bool bypass_cache, |
| 244 const ImageDownloadCallback& callback) override; | 247 const ImageDownloadCallback& callback) override; |
| 245 base::WeakPtr<WebState> AsWeakPtr() override; | 248 base::WeakPtr<WebState> AsWeakPtr() override; |
| 246 | 249 |
| 247 // Adds |interstitial|'s view to the web controller's content view. | 250 // Adds |interstitial|'s view to the web controller's content view. |
| 248 void ShowWebInterstitial(WebInterstitialImpl* interstitial); | 251 void ShowWebInterstitial(WebInterstitialImpl* interstitial); |
| 249 | 252 |
| 250 // Called to dismiss the currently-displayed transient content view. | 253 // Called to dismiss the currently-displayed transient content view. |
| 251 void ClearTransientContentView(); | 254 void ClearTransientContentView(); |
| 252 | 255 |
| 256 // Notifies the delegate that the load progress was updated. | |
| 257 void SendChangeLoadProgress(double progress); | |
| 258 | |
| 253 // NavigationManagerDelegate: | 259 // NavigationManagerDelegate: |
| 254 void NavigateToPendingEntry() override; | 260 void NavigateToPendingEntry() override; |
| 255 void LoadURLWithParams(const NavigationManager::WebLoadParams&) override; | 261 void LoadURLWithParams(const NavigationManager::WebLoadParams&) override; |
| 256 void OnNavigationItemsPruned(size_t pruned_item_count) override; | 262 void OnNavigationItemsPruned(size_t pruned_item_count) override; |
| 257 void OnNavigationItemChanged() override; | 263 void OnNavigationItemChanged() override; |
| 258 void OnNavigationItemCommitted( | 264 void OnNavigationItemCommitted( |
| 259 const LoadCommittedDetails& load_details) override; | 265 const LoadCommittedDetails& load_details) override; |
| 260 WebState* GetWebState() override; | 266 WebState* GetWebState() override; |
| 261 | 267 |
| 262 protected: | 268 protected: |
| 263 void AddObserver(WebStateObserver* observer) override; | 269 void AddObserver(WebStateObserver* observer) override; |
| 264 void RemoveObserver(WebStateObserver* observer) override; | 270 void RemoveObserver(WebStateObserver* observer) override; |
| 265 void AddPolicyDecider(WebStatePolicyDecider* decider) override; | 271 void AddPolicyDecider(WebStatePolicyDecider* decider) override; |
| 266 void RemovePolicyDecider(WebStatePolicyDecider* decider) override; | 272 void RemovePolicyDecider(WebStatePolicyDecider* decider) override; |
| 267 | 273 |
| 268 private: | 274 private: |
| 275 // Unowned delegate. | |
|
rohitrao (ping after 24h)
2016/04/13 12:01:13
We generally use "weak" instead of "unowned".
Eugene But (OOO till 7-30)
2016/04/13 15:03:53
Agree that Bling generally use "weak". But "weak"
| |
| 276 WebStateDelegate* delegate_; | |
| 277 | |
| 269 // Creates a WebUIIOS object for |url| that is owned by the caller. Returns | 278 // Creates a WebUIIOS object for |url| that is owned by the caller. Returns |
| 270 // nullptr if |url| does not correspond to a WebUI page. | 279 // nullptr if |url| does not correspond to a WebUI page. |
| 271 WebUIIOS* CreateWebUIIOS(const GURL& url); | 280 WebUIIOS* CreateWebUIIOS(const GURL& url); |
| 272 | 281 |
| 273 // Updates the HTTP response headers for the main page using the headers | 282 // Updates the HTTP response headers for the main page using the headers |
| 274 // passed to the OnHttpResponseHeadersReceived() function below. | 283 // passed to the OnHttpResponseHeadersReceived() function below. |
| 275 // GetHttpResponseHeaders() can be used to get the headers. | 284 // GetHttpResponseHeaders() can be used to get the headers. |
| 276 void UpdateHttpResponseHeaders(const GURL& url); | 285 void UpdateHttpResponseHeaders(const GURL& url); |
| 277 | 286 |
| 278 // Returns true if |web_controller_| has been set. | 287 // Returns true if |web_controller_| has been set. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 336 // any WeakPtrs to WebStateImpl are invalidated before its member variable's | 345 // any WeakPtrs to WebStateImpl are invalidated before its member variable's |
| 337 // destructors are executed, rendering them invalid. | 346 // destructors are executed, rendering them invalid. |
| 338 base::WeakPtrFactory<WebState> weak_factory_; | 347 base::WeakPtrFactory<WebState> weak_factory_; |
| 339 | 348 |
| 340 DISALLOW_COPY_AND_ASSIGN(WebStateImpl); | 349 DISALLOW_COPY_AND_ASSIGN(WebStateImpl); |
| 341 }; | 350 }; |
| 342 | 351 |
| 343 } // namespace web | 352 } // namespace web |
| 344 | 353 |
| 345 #endif // IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_ | 354 #endif // IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_ |
| OLD | NEW |