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

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: Created 5 years, 2 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 <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 // (a) By @Tab, when creating a new Tab. 48 // (a) By @Tab, when creating a new Tab.
49 // (b) By @SessionWindow, when decoding a saved session. 49 // (b) By @SessionWindow, when decoding a saved session.
50 // (c) By the Copy() method, below, used when marshalling a session 50 // (c) By the Copy() method, below, used when marshalling a session
51 // in preparation for saving. 51 // in preparation for saving.
52 // - WebControllers are the eventual long-term owners of WebStateImpls. 52 // - WebControllers are the eventual long-term owners of WebStateImpls.
53 // - SessionWindows are transient owners, passing ownership into WebControllers 53 // - SessionWindows are transient owners, passing ownership into WebControllers
54 // during session restore, and discarding owned copies of WebStateImpls after 54 // during session restore, and discarding owned copies of WebStateImpls after
55 // writing them out for session saves. 55 // writing them out for session saves.
56 class WebStateImpl : public WebState, public NavigationManagerDelegate { 56 class WebStateImpl : public WebState, public NavigationManagerDelegate {
57 public: 57 public:
58 // Constructor for WebStateImpls created for new sessions.
58 WebStateImpl(BrowserState* browser_state); 59 WebStateImpl(BrowserState* browser_state);
60 // Constructor for WebStatesImpls created for deserialized or copied
61 // NavigationManagerImpls.
62 WebStateImpl(BrowserState* browser_State,
Eugene But (OOO till 7-30) 2015/09/23 16:33:44 s/browser_State/browser_state/
kkhorimoto 2015/09/24 18:12:59 Done.
63 scoped_ptr<NavigationManagerImpl> navigation_manager);
59 ~WebStateImpl() override; 64 ~WebStateImpl() override;
60 65
61 // Sets the CRWWebController that backs this object. Typically 66 // Sets the CRWWebController that backs this object. Typically
62 // |web_controller| will also take ownership of this object. This will also 67 // |web_controller| will also take ownership of this object. This will also
63 // create the WebContentsIOS facade. 68 // create the WebContentsIOS facade.
64 void SetWebController(CRWWebController* web_controller); 69 void SetWebController(CRWWebController* web_controller);
65 70
66 // Gets or sets the delegate used to communicate with the web contents facade. 71 // Gets or sets the delegate used to communicate with the web contents facade.
67 WebStateFacadeDelegate* GetFacadeDelegate() const; 72 WebStateFacadeDelegate* GetFacadeDelegate() const;
68 void SetFacadeDelegate(WebStateFacadeDelegate* facade_delegate); 73 void SetFacadeDelegate(WebStateFacadeDelegate* facade_delegate);
69 74
70 // Returns a WebStateImpl that doesn't have a browser context, web 75 // Returns a WebStateImpl that doesn't have a browser context, web
71 // controller, or facade set, but which otherwise has the same state variables 76 // controller, or facade set, but which otherwise has the same state variables
72 // as the calling object (including copies of the NavigationManager and its 77 // as the calling object (including copies of the NavigationManager and its
73 // attendant CRWSessionController). 78 // attendant CRWSessionController).
74 // TODO(marq): Revisit this function and the ownership model described above; 79 // TODO(marq): Revisit this function and the ownership model described above;
75 // too this depends on and interacts directly with above-the-web-level 80 // too this depends on and interacts directly with above-the-web-level
76 // information. 81 // information.
77 WebStateImpl* CopyForSessionWindow(); 82 scoped_ptr<WebStateImpl> CopyForSerialization() const;
78 83
79 // Notifies the observers that a provisional navigation has started. 84 // Notifies the observers that a provisional navigation has started.
80 void OnProvisionalNavigationStarted(const GURL& url); 85 void OnProvisionalNavigationStarted(const GURL& url);
81 86
82 // 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.
83 void OnUrlHashChanged(); 88 void OnUrlHashChanged();
84 89
85 // 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.
86 void OnHistoryStateChanged(); 91 void OnHistoryStateChanged();
87 92
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 277
273 // Stores whether the web state is currently loading a page. 278 // Stores whether the web state is currently loading a page.
274 bool is_loading_; 279 bool is_loading_;
275 280
276 // The delegate used to pass state to the web contents facade. 281 // The delegate used to pass state to the web contents facade.
277 WebStateFacadeDelegate* facade_delegate_; 282 WebStateFacadeDelegate* facade_delegate_;
278 283
279 // The CRWWebController that backs and owns this object. 284 // The CRWWebController that backs and owns this object.
280 CRWWebController* web_controller_; 285 CRWWebController* web_controller_;
281 286
282 NavigationManagerImpl navigation_manager_; 287 // The NavigationManagerImpl that stores session info for this WebStateImpl.
288 scoped_ptr<NavigationManagerImpl> navigation_manager_;
283 289
284 // |web::WebUIIOS| object for the current page if it is a WebUI page that 290 // |web::WebUIIOS| object for the current page if it is a WebUI page that
285 // uses the web-based WebUI framework, or nullptr otherwise. 291 // uses the web-based WebUI framework, or nullptr otherwise.
286 scoped_ptr<web::WebUIIOS> web_ui_; 292 scoped_ptr<web::WebUIIOS> web_ui_;
287 293
288 // A list of observers notified when page state changes. Weak references. 294 // A list of observers notified when page state changes. Weak references.
289 base::ObserverList<WebStateObserver, true> observers_; 295 base::ObserverList<WebStateObserver, true> observers_;
290 296
291 // All the WebStatePolicyDeciders asked for navigation decision. Weak 297 // All the WebStatePolicyDeciders asked for navigation decision. Weak
292 // references. 298 // references.
(...skipping 30 matching lines...) Expand all
323 329
324 // Callbacks associated to command prefixes. 330 // Callbacks associated to command prefixes.
325 std::map<std::string, ScriptCommandCallback> script_command_callbacks_; 331 std::map<std::string, ScriptCommandCallback> script_command_callbacks_;
326 332
327 DISALLOW_COPY_AND_ASSIGN(WebStateImpl); 333 DISALLOW_COPY_AND_ASSIGN(WebStateImpl);
328 }; 334 };
329 335
330 } // namespace web 336 } // namespace web
331 337
332 #endif // IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_ 338 #endif // IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698