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

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: Merged with origin/master 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 280
282 // Stores whether the web state is currently loading a page. 281 // Stores whether the web state is currently loading a page.
283 bool is_loading_; 282 bool is_loading_;
284 283
285 // Stores whether the web state is currently being destroyed. 284 // Stores whether the web state is currently being destroyed.
286 bool is_being_destroyed_; 285 bool is_being_destroyed_;
287 286
288 // The delegate used to pass state to the web contents facade. 287 // The delegate used to pass state to the web contents facade.
289 WebStateFacadeDelegate* facade_delegate_; 288 WebStateFacadeDelegate* facade_delegate_;
290 289
291 // The CRWWebController that backs and owns this object. 290 // The CRWWebController that backs this object.
292 CRWWebController* web_controller_; 291 base::scoped_nsobject<CRWWebController> web_controller_;
293 292
294 NavigationManagerImpl navigation_manager_; 293 NavigationManagerImpl navigation_manager_;
295 294
296 // |web::WebUIIOS| object for the current page if it is a WebUI page that 295 // |web::WebUIIOS| object for the current page if it is a WebUI page that
297 // uses the web-based WebUI framework, or nullptr otherwise. 296 // uses the web-based WebUI framework, or nullptr otherwise.
298 std::unique_ptr<web::WebUIIOS> web_ui_; 297 std::unique_ptr<web::WebUIIOS> web_ui_;
299 298
300 // A list of observers notified when page state changes. Weak references. 299 // A list of observers notified when page state changes. Weak references.
301 base::ObserverList<WebStateObserver, true> observers_; 300 base::ObserverList<WebStateObserver, true> observers_;
302 301
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 // any WeakPtrs to WebStateImpl are invalidated before its member variable's 336 // any WeakPtrs to WebStateImpl are invalidated before its member variable's
338 // destructors are executed, rendering them invalid. 337 // destructors are executed, rendering them invalid.
339 base::WeakPtrFactory<WebState> weak_factory_; 338 base::WeakPtrFactory<WebState> weak_factory_;
340 339
341 DISALLOW_COPY_AND_ASSIGN(WebStateImpl); 340 DISALLOW_COPY_AND_ASSIGN(WebStateImpl);
342 }; 341 };
343 342
344 } // namespace web 343 } // namespace web
345 344
346 #endif // IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_ 345 #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