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

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

Issue 1874903003: Reversed WebState <-> CRWWebController ownership. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Self review Created 4 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 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
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 // in preparation for saving. 55 // in preparation for saving.
56 // - WebControllers are the eventual long-term owners of WebStateImpls. 56 // - WebControllers are the eventual long-term owners of WebStateImpls.
57 // - SessionWindows are transient owners, passing ownership into WebControllers 57 // - SessionWindows are transient owners, passing ownership into WebControllers
58 // during session restore, and discarding owned copies of WebStateImpls after 58 // during session restore, and discarding owned copies of WebStateImpls after
59 // writing them out for session saves. 59 // writing them out for session saves.
60 class WebStateImpl : public WebState, public NavigationManagerDelegate { 60 class WebStateImpl : public WebState, public NavigationManagerDelegate {
61 public: 61 public:
62 WebStateImpl(BrowserState* browser_state); 62 WebStateImpl(BrowserState* browser_state);
63 ~WebStateImpl() override; 63 ~WebStateImpl() override;
64 64
65 // Sets the CRWWebController that backs this object. Typically 65 // Gets/Sets the CRWWebController that backs this object.
66 // |web_controller| will also take ownership of this object. This will also 66 CRWWebController* GetWebController();
67 // create the WebContentsIOS facade.
68 void SetWebController(CRWWebController* web_controller); 67 void SetWebController(CRWWebController* web_controller);
69 68
70 // Gets or sets the delegate used to communicate with the web contents facade. 69 // Gets or sets the delegate used to communicate with the web contents facade.
71 WebStateFacadeDelegate* GetFacadeDelegate() const; 70 WebStateFacadeDelegate* GetFacadeDelegate() const;
72 void SetFacadeDelegate(WebStateFacadeDelegate* facade_delegate); 71 void SetFacadeDelegate(WebStateFacadeDelegate* facade_delegate);
73 72
74 // Returns a WebStateImpl that doesn't have a browser context, web 73 // Returns a WebStateImpl that doesn't have a browser context, web
75 // controller, or facade set, but which otherwise has the same state variables 74 // controller, or facade set, but which otherwise has the same state variables
76 // as the calling object (including copies of the NavigationManager and its 75 // as the calling object (including copies of the NavigationManager and its
77 // attendant CRWSessionController). 76 // attendant CRWSessionController).
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 279
281 // Stores whether the web state is currently loading a page. 280 // Stores whether the web state is currently loading a page.
282 bool is_loading_; 281 bool is_loading_;
283 282
284 // Stores whether the web state is currently being destroyed. 283 // Stores whether the web state is currently being destroyed.
285 bool is_being_destroyed_; 284 bool is_being_destroyed_;
286 285
287 // The delegate used to pass state to the web contents facade. 286 // The delegate used to pass state to the web contents facade.
288 WebStateFacadeDelegate* facade_delegate_; 287 WebStateFacadeDelegate* facade_delegate_;
289 288
290 // The CRWWebController that backs and owns this object. 289 // The CRWWebController that backs and owns this object.
Jackie Quinn 2016/04/12 20:03:46 Comment needs update.
Eugene But (OOO till 7-30) 2016/04/12 20:47:39 Done.
291 CRWWebController* web_controller_; 290 base::scoped_nsobject<CRWWebController> web_controller_;
292 291
293 NavigationManagerImpl navigation_manager_; 292 NavigationManagerImpl navigation_manager_;
294 293
295 // |web::WebUIIOS| object for the current page if it is a WebUI page that 294 // |web::WebUIIOS| object for the current page if it is a WebUI page that
296 // uses the web-based WebUI framework, or nullptr otherwise. 295 // uses the web-based WebUI framework, or nullptr otherwise.
297 std::unique_ptr<web::WebUIIOS> web_ui_; 296 std::unique_ptr<web::WebUIIOS> web_ui_;
298 297
299 // A list of observers notified when page state changes. Weak references. 298 // A list of observers notified when page state changes. Weak references.
300 base::ObserverList<WebStateObserver, true> observers_; 299 base::ObserverList<WebStateObserver, true> observers_;
301 300
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 // any WeakPtrs to WebStateImpl are invalidated before its member variable's 335 // any WeakPtrs to WebStateImpl are invalidated before its member variable's
337 // destructors are executed, rendering them invalid. 336 // destructors are executed, rendering them invalid.
338 base::WeakPtrFactory<WebState> weak_factory_; 337 base::WeakPtrFactory<WebState> weak_factory_;
339 338
340 DISALLOW_COPY_AND_ASSIGN(WebStateImpl); 339 DISALLOW_COPY_AND_ASSIGN(WebStateImpl);
341 }; 340 };
342 341
343 } // namespace web 342 } // namespace web
344 343
345 #endif // IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_ 344 #endif // IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_
OLDNEW
« no previous file with comments | « ios/web/web_state/ui/crw_wk_web_view_web_controller.mm ('k') | ios/web/web_state/web_state_impl.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698