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

Side by Side Diff: ios/web/web_state/web_state_impl.h

Issue 1360993002: Moved NavigationManagerImpl serialization out of CRWSessionController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: compilation fix after rebase Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « ios/web/public/web_state/web_state.h ('k') | ios/web/web_state/web_state_impl.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include <map> 11 #include <map>
12 #include <memory> 12 #include <memory>
13 #include <string> 13 #include <string>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
18 #include "base/observer_list.h" 18 #include "base/observer_list.h"
19 #include "base/values.h" 19 #include "base/values.h"
20 #import "ios/web/navigation/navigation_manager_delegate.h" 20 #import "ios/web/navigation/navigation_manager_delegate.h"
21 #import "ios/web/navigation/navigation_manager_impl.h" 21 #import "ios/web/navigation/navigation_manager_impl.h"
22 #import "ios/web/public/java_script_dialog_callback.h" 22 #import "ios/web/public/java_script_dialog_callback.h"
23 #include "ios/web/public/java_script_dialog_type.h" 23 #include "ios/web/public/java_script_dialog_type.h"
24 #import "ios/web/public/web_state/web_state.h" 24 #import "ios/web/public/web_state/web_state.h"
25 #import "ios/web/public/web_state/web_state_delegate.h" 25 #import "ios/web/public/web_state/web_state_delegate.h"
26 #include "url/gurl.h" 26 #include "url/gurl.h"
27 27
28 @class CRWNavigationManagerStorage;
28 @class CRWWebController; 29 @class CRWWebController;
29 @protocol CRWWebViewProxy; 30 @protocol CRWWebViewProxy;
30 @class NSURLRequest; 31 @class NSURLRequest;
31 @class NSURLResponse; 32 @class NSURLResponse;
32 33
33 namespace net { 34 namespace net {
34 class HttpResponseHeaders; 35 class HttpResponseHeaders;
35 } 36 }
36 37
37 namespace web { 38 namespace web {
(...skipping 17 matching lines...) Expand all
55 // (a) By @Tab, when creating a new Tab. 56 // (a) By @Tab, when creating a new Tab.
56 // (b) By @SessionWindow, when decoding a saved session. 57 // (b) By @SessionWindow, when decoding a saved session.
57 // (c) By the Copy() method, below, used when marshalling a session 58 // (c) By the Copy() method, below, used when marshalling a session
58 // in preparation for saving. 59 // in preparation for saving.
59 // - WebControllers are the eventual long-term owners of WebStateImpls. 60 // - WebControllers are the eventual long-term owners of WebStateImpls.
60 // - SessionWindows are transient owners, passing ownership into WebControllers 61 // - SessionWindows are transient owners, passing ownership into WebControllers
61 // during session restore, and discarding owned copies of WebStateImpls after 62 // during session restore, and discarding owned copies of WebStateImpls after
62 // writing them out for session saves. 63 // writing them out for session saves.
63 class WebStateImpl : public WebState, public NavigationManagerDelegate { 64 class WebStateImpl : public WebState, public NavigationManagerDelegate {
64 public: 65 public:
66 // Constructor for WebStateImpls created for new sessions.
65 WebStateImpl(BrowserState* browser_state); 67 WebStateImpl(BrowserState* browser_state);
68 // Constructor for WebStatesImpls created for deserialized sessions
69 WebStateImpl(BrowserState* browser_state,
70 CRWNavigationManagerStorage* session_storage);
66 ~WebStateImpl() override; 71 ~WebStateImpl() override;
67 72
68 // Gets/Sets the CRWWebController that backs this object. 73 // Gets/Sets the CRWWebController that backs this object.
69 CRWWebController* GetWebController(); 74 CRWWebController* GetWebController();
70 void SetWebController(CRWWebController* web_controller); 75 void SetWebController(CRWWebController* web_controller);
71 76
72 // Gets or sets the delegate used to communicate with the web contents facade. 77 // Gets or sets the delegate used to communicate with the web contents facade.
73 WebStateFacadeDelegate* GetFacadeDelegate() const; 78 WebStateFacadeDelegate* GetFacadeDelegate() const;
74 void SetFacadeDelegate(WebStateFacadeDelegate* facade_delegate); 79 void SetFacadeDelegate(WebStateFacadeDelegate* facade_delegate);
75 80
76 // Returns a WebStateImpl that doesn't have a browser context, web
77 // controller, or facade set, but which otherwise has the same state variables
78 // as the calling object (including copies of the NavigationManager and its
79 // attendant CRWSessionController).
80 // TODO(crbug.com/546377): Clean up this method.
81 WebStateImpl* CopyForSessionWindow();
82
83 // Notifies the observers that a provisional navigation has started. 81 // Notifies the observers that a provisional navigation has started.
84 void OnProvisionalNavigationStarted(const GURL& url); 82 void OnProvisionalNavigationStarted(const GURL& url);
85 83
86 // Called when a navigation is committed. 84 // Called when a navigation is committed.
87 void OnNavigationCommitted(const GURL& url); 85 void OnNavigationCommitted(const GURL& url);
88 86
89 // Notifies the observers that the URL hash of the current page changed. 87 // Notifies the observers that the URL hash of the current page changed.
90 void OnUrlHashChanged(); 88 void OnUrlHashChanged();
91 89
92 // Notifies the observers that the history state of the current page changed. 90 // Notifies the observers that the history state of the current page changed.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 bool IsWebUsageEnabled() const override; 197 bool IsWebUsageEnabled() const override;
200 void SetWebUsageEnabled(bool enabled) override; 198 void SetWebUsageEnabled(bool enabled) override;
201 bool ShouldSuppressDialogs() const override; 199 bool ShouldSuppressDialogs() const override;
202 void SetShouldSuppressDialogs(bool should_suppress) override; 200 void SetShouldSuppressDialogs(bool should_suppress) override;
203 UIView* GetView() override; 201 UIView* GetView() override;
204 BrowserState* GetBrowserState() const override; 202 BrowserState* GetBrowserState() const override;
205 void OpenURL(const WebState::OpenURLParams& params) override; 203 void OpenURL(const WebState::OpenURLParams& params) override;
206 void Stop() override; 204 void Stop() override;
207 const NavigationManager* GetNavigationManager() const override; 205 const NavigationManager* GetNavigationManager() const override;
208 NavigationManager* GetNavigationManager() override; 206 NavigationManager* GetNavigationManager() override;
207 CRWNavigationManagerStorage* BuildSerializedNavigationManager() override;
209 CRWJSInjectionReceiver* GetJSInjectionReceiver() const override; 208 CRWJSInjectionReceiver* GetJSInjectionReceiver() const override;
210 void ExecuteJavaScript(const base::string16& javascript) override; 209 void ExecuteJavaScript(const base::string16& javascript) override;
211 void ExecuteJavaScript(const base::string16& javascript, 210 void ExecuteJavaScript(const base::string16& javascript,
212 const JavaScriptResultCallback& callback) override; 211 const JavaScriptResultCallback& callback) override;
213 const std::string& GetContentLanguageHeader() const override; 212 const std::string& GetContentLanguageHeader() const override;
214 const std::string& GetContentsMimeType() const override; 213 const std::string& GetContentsMimeType() const override;
215 bool ContentIsHTML() const override; 214 bool ContentIsHTML() const override;
216 const base::string16& GetTitle() const override; 215 const base::string16& GetTitle() const override;
217 bool IsLoading() const override; 216 bool IsLoading() const override;
218 double GetLoadingProgress() const override; 217 double GetLoadingProgress() const override;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 301
303 // Stores whether the web state is currently being destroyed. 302 // Stores whether the web state is currently being destroyed.
304 bool is_being_destroyed_; 303 bool is_being_destroyed_;
305 304
306 // The delegate used to pass state to the web contents facade. 305 // The delegate used to pass state to the web contents facade.
307 WebStateFacadeDelegate* facade_delegate_; 306 WebStateFacadeDelegate* facade_delegate_;
308 307
309 // The CRWWebController that backs this object. 308 // The CRWWebController that backs this object.
310 base::scoped_nsobject<CRWWebController> web_controller_; 309 base::scoped_nsobject<CRWWebController> web_controller_;
311 310
312 NavigationManagerImpl navigation_manager_; 311 // The NavigationManagerImpl that stores session info for this WebStateImpl.
312 std::unique_ptr<NavigationManagerImpl> navigation_manager_;
313 313
314 // |web::WebUIIOS| object for the current page if it is a WebUI page that 314 // |web::WebUIIOS| object for the current page if it is a WebUI page that
315 // uses the web-based WebUI framework, or nullptr otherwise. 315 // uses the web-based WebUI framework, or nullptr otherwise.
316 std::unique_ptr<web::WebUIIOS> web_ui_; 316 std::unique_ptr<web::WebUIIOS> web_ui_;
317 317
318 // A list of observers notified when page state changes. Weak references. 318 // A list of observers notified when page state changes. Weak references.
319 base::ObserverList<WebStateObserver, true> observers_; 319 base::ObserverList<WebStateObserver, true> observers_;
320 320
321 // All the WebStatePolicyDeciders asked for navigation decision. Weak 321 // All the WebStatePolicyDeciders asked for navigation decision. Weak
322 // references. 322 // references.
(...skipping 30 matching lines...) Expand all
353 353
354 // Image Fetcher used to images. 354 // Image Fetcher used to images.
355 std::unique_ptr<ImageDataFetcher> image_fetcher_; 355 std::unique_ptr<ImageDataFetcher> image_fetcher_;
356 356
357 DISALLOW_COPY_AND_ASSIGN(WebStateImpl); 357 DISALLOW_COPY_AND_ASSIGN(WebStateImpl);
358 }; 358 };
359 359
360 } // namespace web 360 } // namespace web
361 361
362 #endif // IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_ 362 #endif // IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_
OLDNEW
« no previous file with comments | « ios/web/public/web_state/web_state.h ('k') | ios/web/web_state/web_state_impl.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698