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

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: test fix Created 3 years, 10 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
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/navigation/navigation_manager_serialization_builder.h"
22 #import "ios/web/public/java_script_dialog_callback.h" 23 #import "ios/web/public/java_script_dialog_callback.h"
23 #include "ios/web/public/java_script_dialog_type.h" 24 #include "ios/web/public/java_script_dialog_type.h"
24 #import "ios/web/public/web_state/web_state.h" 25 #import "ios/web/public/web_state/web_state.h"
25 #import "ios/web/public/web_state/web_state_delegate.h" 26 #import "ios/web/public/web_state/web_state_delegate.h"
26 #include "url/gurl.h" 27 #include "url/gurl.h"
27 28
29 @class CRWNavigationManagerSerialization;
28 @class CRWWebController; 30 @class CRWWebController;
29 @protocol CRWWebViewProxy; 31 @protocol CRWWebViewProxy;
30 @class NSURLRequest; 32 @class NSURLRequest;
31 @class NSURLResponse; 33 @class NSURLResponse;
32 34
33 namespace net { 35 namespace net {
34 class HttpResponseHeaders; 36 class HttpResponseHeaders;
35 } 37 }
36 38
37 namespace web { 39 namespace web {
(...skipping 17 matching lines...) Expand all
55 // (a) By @Tab, when creating a new Tab. 57 // (a) By @Tab, when creating a new Tab.
56 // (b) By @SessionWindow, when decoding a saved session. 58 // (b) By @SessionWindow, when decoding a saved session.
57 // (c) By the Copy() method, below, used when marshalling a session 59 // (c) By the Copy() method, below, used when marshalling a session
58 // in preparation for saving. 60 // in preparation for saving.
59 // - WebControllers are the eventual long-term owners of WebStateImpls. 61 // - WebControllers are the eventual long-term owners of WebStateImpls.
60 // - SessionWindows are transient owners, passing ownership into WebControllers 62 // - SessionWindows are transient owners, passing ownership into WebControllers
61 // during session restore, and discarding owned copies of WebStateImpls after 63 // during session restore, and discarding owned copies of WebStateImpls after
62 // writing them out for session saves. 64 // writing them out for session saves.
63 class WebStateImpl : public WebState, public NavigationManagerDelegate { 65 class WebStateImpl : public WebState, public NavigationManagerDelegate {
64 public: 66 public:
67 // Constructor for WebStateImpls created for new sessions.
65 WebStateImpl(BrowserState* browser_state); 68 WebStateImpl(BrowserState* browser_state);
69 // Constructor for WebStatesImpls created for deserialized sessions
70 WebStateImpl(BrowserState* browser_state,
71 CRWNavigationManagerSerialization* serialized_session);
66 ~WebStateImpl() override; 72 ~WebStateImpl() override;
67 73
68 // Gets/Sets the CRWWebController that backs this object. 74 // Gets/Sets the CRWWebController that backs this object.
69 CRWWebController* GetWebController(); 75 CRWWebController* GetWebController();
70 void SetWebController(CRWWebController* web_controller); 76 void SetWebController(CRWWebController* web_controller);
71 77
72 // Gets or sets the delegate used to communicate with the web contents facade. 78 // Gets or sets the delegate used to communicate with the web contents facade.
73 WebStateFacadeDelegate* GetFacadeDelegate() const; 79 WebStateFacadeDelegate* GetFacadeDelegate() const;
74 void SetFacadeDelegate(WebStateFacadeDelegate* facade_delegate); 80 void SetFacadeDelegate(WebStateFacadeDelegate* facade_delegate);
75 81
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. 82 // Notifies the observers that a provisional navigation has started.
84 void OnProvisionalNavigationStarted(const GURL& url); 83 void OnProvisionalNavigationStarted(const GURL& url);
85 84
86 // Called when a navigation is committed. 85 // Called when a navigation is committed.
87 void OnNavigationCommitted(const GURL& url); 86 void OnNavigationCommitted(const GURL& url);
88 87
89 // Notifies the observers that the URL hash of the current page changed. 88 // Notifies the observers that the URL hash of the current page changed.
90 void OnUrlHashChanged(); 89 void OnUrlHashChanged();
91 90
92 // Notifies the observers that the history state of the current page changed. 91 // 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; 198 bool IsWebUsageEnabled() const override;
200 void SetWebUsageEnabled(bool enabled) override; 199 void SetWebUsageEnabled(bool enabled) override;
201 bool ShouldSuppressDialogs() const override; 200 bool ShouldSuppressDialogs() const override;
202 void SetShouldSuppressDialogs(bool should_suppress) override; 201 void SetShouldSuppressDialogs(bool should_suppress) override;
203 UIView* GetView() override; 202 UIView* GetView() override;
204 BrowserState* GetBrowserState() const override; 203 BrowserState* GetBrowserState() const override;
205 void OpenURL(const WebState::OpenURLParams& params) override; 204 void OpenURL(const WebState::OpenURLParams& params) override;
206 void Stop() override; 205 void Stop() override;
207 const NavigationManager* GetNavigationManager() const override; 206 const NavigationManager* GetNavigationManager() const override;
208 NavigationManager* GetNavigationManager() override; 207 NavigationManager* GetNavigationManager() override;
208 CRWNavigationManagerSerialization* BuildSerializedNavigationManager()
Eugene But (OOO till 7-30) 2017/01/25 19:24:30 Is this analogue of WebContentsImpl::GetSessionSto
kkhorimoto 2017/01/26 07:19:10 Yes
209 override;
209 CRWJSInjectionReceiver* GetJSInjectionReceiver() const override; 210 CRWJSInjectionReceiver* GetJSInjectionReceiver() const override;
210 void ExecuteJavaScript(const base::string16& javascript) override; 211 void ExecuteJavaScript(const base::string16& javascript) override;
211 void ExecuteJavaScript(const base::string16& javascript, 212 void ExecuteJavaScript(const base::string16& javascript,
212 const JavaScriptResultCallback& callback) override; 213 const JavaScriptResultCallback& callback) override;
213 const std::string& GetContentLanguageHeader() const override; 214 const std::string& GetContentLanguageHeader() const override;
214 const std::string& GetContentsMimeType() const override; 215 const std::string& GetContentsMimeType() const override;
215 bool ContentIsHTML() const override; 216 bool ContentIsHTML() const override;
216 const base::string16& GetTitle() const override; 217 const base::string16& GetTitle() const override;
217 bool IsLoading() const override; 218 bool IsLoading() const override;
218 double GetLoadingProgress() const override; 219 double GetLoadingProgress() const override;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 300
300 // Stores whether the web state is currently being destroyed. 301 // Stores whether the web state is currently being destroyed.
301 bool is_being_destroyed_; 302 bool is_being_destroyed_;
302 303
303 // The delegate used to pass state to the web contents facade. 304 // The delegate used to pass state to the web contents facade.
304 WebStateFacadeDelegate* facade_delegate_; 305 WebStateFacadeDelegate* facade_delegate_;
305 306
306 // The CRWWebController that backs this object. 307 // The CRWWebController that backs this object.
307 base::scoped_nsobject<CRWWebController> web_controller_; 308 base::scoped_nsobject<CRWWebController> web_controller_;
308 309
309 NavigationManagerImpl navigation_manager_; 310 // The NavigationManagerImpl that stores session info for this WebStateImpl.
311 std::unique_ptr<NavigationManagerImpl> navigation_manager_;
310 312
311 // |web::WebUIIOS| object for the current page if it is a WebUI page that 313 // |web::WebUIIOS| object for the current page if it is a WebUI page that
312 // uses the web-based WebUI framework, or nullptr otherwise. 314 // uses the web-based WebUI framework, or nullptr otherwise.
313 std::unique_ptr<web::WebUIIOS> web_ui_; 315 std::unique_ptr<web::WebUIIOS> web_ui_;
314 316
315 // A list of observers notified when page state changes. Weak references. 317 // A list of observers notified when page state changes. Weak references.
316 base::ObserverList<WebStateObserver, true> observers_; 318 base::ObserverList<WebStateObserver, true> observers_;
317 319
318 // All the WebStatePolicyDeciders asked for navigation decision. Weak 320 // All the WebStatePolicyDeciders asked for navigation decision. Weak
319 // references. 321 // references.
(...skipping 24 matching lines...) Expand all
344 // any WeakPtrs to WebStateImpl are invalidated before its member variable's 346 // any WeakPtrs to WebStateImpl are invalidated before its member variable's
345 // destructors are executed, rendering them invalid. 347 // destructors are executed, rendering them invalid.
346 base::WeakPtrFactory<WebState> weak_factory_; 348 base::WeakPtrFactory<WebState> weak_factory_;
347 349
348 // Mojo interface registry for this WebState. 350 // Mojo interface registry for this WebState.
349 std::unique_ptr<service_manager::InterfaceRegistry> mojo_interface_registry_; 351 std::unique_ptr<service_manager::InterfaceRegistry> mojo_interface_registry_;
350 352
351 // Image Fetcher used to images. 353 // Image Fetcher used to images.
352 std::unique_ptr<ImageDataFetcher> image_fetcher_; 354 std::unique_ptr<ImageDataFetcher> image_fetcher_;
353 355
356 // The serialization builder.
357 NavigationManagerSerializationBuilder serialization_builder_;
Eugene But (OOO till 7-30) 2017/01/25 19:24:30 Do we need this to be a member? Should this be a l
kkhorimoto 2017/01/26 07:19:10 Done.
358
354 DISALLOW_COPY_AND_ASSIGN(WebStateImpl); 359 DISALLOW_COPY_AND_ASSIGN(WebStateImpl);
355 }; 360 };
356 361
357 } // namespace web 362 } // namespace web
358 363
359 #endif // IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_ 364 #endif // IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698