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

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

Issue 2644103004: Remove RequestTracker from WebStateImpl. (Closed)
Patch Set: 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
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/net/request_tracker_impl.h" 22 #import "ios/web/net/request_tracker_impl.h"
Eugene But (OOO till 7-30) 2017/01/19 19:05:55 nit: Do we still need this include?
sdefresne 2017/01/20 11:31:28 Removed.
23 #import "ios/web/public/java_script_dialog_callback.h" 23 #import "ios/web/public/java_script_dialog_callback.h"
24 #include "ios/web/public/java_script_dialog_type.h" 24 #include "ios/web/public/java_script_dialog_type.h"
25 #import "ios/web/public/web_state/web_state.h" 25 #import "ios/web/public/web_state/web_state.h"
26 #include "url/gurl.h" 26 #include "url/gurl.h"
27 27
28 @protocol CRWRequestTrackerDelegate; 28 @protocol CRWRequestTrackerDelegate;
29 @class CRWWebController; 29 @class CRWWebController;
30 @protocol CRWWebViewProxy; 30 @protocol CRWWebViewProxy;
31 @class NSURLRequest; 31 @class NSURLRequest;
32 @class NSURLResponse; 32 @class NSURLResponse;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 // that is the point where MIME type is set from HTTP headers. 185 // that is the point where MIME type is set from HTTP headers.
186 void SetContentsMimeType(const std::string& mime_type); 186 void SetContentsMimeType(const std::string& mime_type);
187 187
188 // Returns whether the navigation corresponding to |request| should be allowed 188 // Returns whether the navigation corresponding to |request| should be allowed
189 // to continue by asking its policy deciders. Defaults to true. 189 // to continue by asking its policy deciders. Defaults to true.
190 bool ShouldAllowRequest(NSURLRequest* request); 190 bool ShouldAllowRequest(NSURLRequest* request);
191 // Returns whether the navigation corresponding to |response| should be 191 // Returns whether the navigation corresponding to |response| should be
192 // allowed to continue by asking its policy deciders. Defaults to true. 192 // allowed to continue by asking its policy deciders. Defaults to true.
193 bool ShouldAllowResponse(NSURLResponse* response); 193 bool ShouldAllowResponse(NSURLResponse* response);
194 194
195 // Request tracker management. For now, this exposes the RequestTracker for
196 // embedders to use.
197 // TODO(stuartmorgan): RequestTracker should become an internal detail of this
198 // class.
199
200 // Create a new tracker using |delegate| as its delegate.
201 void InitializeRequestTracker(id<CRWRequestTrackerDelegate> delegate);
202
203 // Close the request tracker and delete it.
204 void CloseRequestTracker();
205
206 // Returns the tracker for this WebStateImpl.
207 RequestTrackerImpl* GetRequestTracker();
208
209 // Lazily creates (if necessary) and returns |request_group_id_|.
210 // IMPORTANT: This should not be used for anything other than associating this
211 // instance to network requests.
212 // This function is only intended to be used in web/.
213 // TODO(stuartmorgan): Move this method in an implementation file in web/.
214 NSString* GetRequestGroupID();
215
216 // WebState: 195 // WebState:
217 WebStateDelegate* GetDelegate() override; 196 WebStateDelegate* GetDelegate() override;
218 void SetDelegate(WebStateDelegate* delegate) override; 197 void SetDelegate(WebStateDelegate* delegate) override;
219 bool IsWebUsageEnabled() const override; 198 bool IsWebUsageEnabled() const override;
220 void SetWebUsageEnabled(bool enabled) override; 199 void SetWebUsageEnabled(bool enabled) override;
221 bool ShouldSuppressDialogs() const override; 200 bool ShouldSuppressDialogs() const override;
222 void SetShouldSuppressDialogs(bool should_suppress) override; 201 void SetShouldSuppressDialogs(bool should_suppress) override;
223 UIView* GetView() override; 202 UIView* GetView() override;
224 BrowserState* GetBrowserState() const override; 203 BrowserState* GetBrowserState() const override;
225 void OpenURL(const WebState::OpenURLParams& params) override; 204 void OpenURL(const WebState::OpenURLParams& params) override;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 scoped_refptr<net::HttpResponseHeaders> http_response_headers_; 323 scoped_refptr<net::HttpResponseHeaders> http_response_headers_;
345 std::string mime_type_; 324 std::string mime_type_;
346 std::string content_language_header_; 325 std::string content_language_header_;
347 326
348 // Weak pointer to the interstitial page being displayed, if any. 327 // Weak pointer to the interstitial page being displayed, if any.
349 WebInterstitialImpl* interstitial_; 328 WebInterstitialImpl* interstitial_;
350 329
351 // Returned by reference. 330 // Returned by reference.
352 base::string16 empty_string16_; 331 base::string16 empty_string16_;
353 332
354 // Request tracker associted with this object.
355 scoped_refptr<RequestTrackerImpl> request_tracker_;
356
357 // A number identifying this object. This number is injected into the user
358 // agent to allow the network layer to know which web view requests originated
359 // from.
360 base::scoped_nsobject<NSString> request_group_id_;
361
362 // Callbacks associated to command prefixes. 333 // Callbacks associated to command prefixes.
363 std::map<std::string, ScriptCommandCallback> script_command_callbacks_; 334 std::map<std::string, ScriptCommandCallback> script_command_callbacks_;
364 335
365 // Member variables should appear before the WeakPtrFactory<> to ensure that 336 // Member variables should appear before the WeakPtrFactory<> to ensure that
366 // any WeakPtrs to WebStateImpl are invalidated before its member variable's 337 // any WeakPtrs to WebStateImpl are invalidated before its member variable's
367 // destructors are executed, rendering them invalid. 338 // destructors are executed, rendering them invalid.
368 base::WeakPtrFactory<WebState> weak_factory_; 339 base::WeakPtrFactory<WebState> weak_factory_;
369 340
370 // Mojo interface registry for this WebState. 341 // Mojo interface registry for this WebState.
371 std::unique_ptr<service_manager::InterfaceRegistry> mojo_interface_registry_; 342 std::unique_ptr<service_manager::InterfaceRegistry> mojo_interface_registry_;
372 343
373 // Image Fetcher used to images. 344 // Image Fetcher used to images.
374 std::unique_ptr<ImageDataFetcher> image_fetcher_; 345 std::unique_ptr<ImageDataFetcher> image_fetcher_;
375 346
376 DISALLOW_COPY_AND_ASSIGN(WebStateImpl); 347 DISALLOW_COPY_AND_ASSIGN(WebStateImpl);
377 }; 348 };
378 349
379 } // namespace web 350 } // namespace web
380 351
381 #endif // IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_ 352 #endif // IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698