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

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

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 #import "ios/web/web_state/web_state_impl.h" 5 #import "ios/web/web_state/web_state_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/metrics/histogram_macros.h" 11 #include "base/metrics/histogram_macros.h"
12 #include "base/strings/sys_string_conversions.h" 12 #include "base/strings/sys_string_conversions.h"
13 #import "ios/web/interstitials/web_interstitial_impl.h" 13 #import "ios/web/interstitials/web_interstitial_impl.h"
14 #import "ios/web/navigation/crw_session_controller.h" 14 #import "ios/web/navigation/crw_session_controller.h"
15 #import "ios/web/navigation/crw_session_entry.h" 15 #import "ios/web/navigation/crw_session_entry.h"
16 #import "ios/web/navigation/navigation_item_impl.h" 16 #import "ios/web/navigation/navigation_item_impl.h"
17 #import "ios/web/net/request_group_util.h"
18 #include "ios/web/public/browser_state.h" 17 #include "ios/web/public/browser_state.h"
19 #import "ios/web/public/image_fetcher/image_data_fetcher.h" 18 #import "ios/web/public/image_fetcher/image_data_fetcher.h"
20 #import "ios/web/public/java_script_dialog_presenter.h" 19 #import "ios/web/public/java_script_dialog_presenter.h"
21 #import "ios/web/public/navigation_item.h" 20 #import "ios/web/public/navigation_item.h"
22 #include "ios/web/public/url_util.h" 21 #include "ios/web/public/url_util.h"
23 #import "ios/web/public/web_client.h" 22 #import "ios/web/public/web_client.h"
24 #import "ios/web/public/web_state/context_menu_params.h" 23 #import "ios/web/public/web_state/context_menu_params.h"
25 #include "ios/web/public/web_state/credential.h" 24 #include "ios/web/public/web_state/credential.h"
26 #import "ios/web/public/web_state/ui/crw_content_view.h" 25 #import "ios/web/public/web_state/ui/crw_content_view.h"
27 #include "ios/web/public/web_state/web_state_delegate.h" 26 #include "ios/web/public/web_state/web_state_delegate.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 84
86 for (auto& observer : observers_) 85 for (auto& observer : observers_)
87 observer.WebStateDestroyed(); 86 observer.WebStateDestroyed();
88 for (auto& observer : observers_) 87 for (auto& observer : observers_)
89 observer.ResetWebState(); 88 observer.ResetWebState();
90 for (auto& observer : policy_deciders_) 89 for (auto& observer : policy_deciders_)
91 observer.WebStateDestroyed(); 90 observer.WebStateDestroyed();
92 for (auto& observer : policy_deciders_) 91 for (auto& observer : policy_deciders_)
93 observer.ResetWebState(); 92 observer.ResetWebState();
94 DCHECK(script_command_callbacks_.empty()); 93 DCHECK(script_command_callbacks_.empty());
95 if (request_tracker_.get())
96 CloseRequestTracker();
97 SetDelegate(nullptr); 94 SetDelegate(nullptr);
98 } 95 }
99 96
100 WebStateDelegate* WebStateImpl::GetDelegate() { 97 WebStateDelegate* WebStateImpl::GetDelegate() {
101 return delegate_; 98 return delegate_;
102 } 99 }
103 100
104 void WebStateImpl::SetDelegate(WebStateDelegate* delegate) { 101 void WebStateImpl::SetDelegate(WebStateDelegate* delegate) {
105 if (delegate == delegate_) 102 if (delegate == delegate_)
106 return; 103 return;
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 bool WebStateImpl::ShouldAllowResponse(NSURLResponse* response) { 502 bool WebStateImpl::ShouldAllowResponse(NSURLResponse* response) {
506 for (auto& policy_decider : policy_deciders_) { 503 for (auto& policy_decider : policy_deciders_) {
507 if (!policy_decider.ShouldAllowResponse(response)) 504 if (!policy_decider.ShouldAllowResponse(response))
508 return false; 505 return false;
509 } 506 }
510 return true; 507 return true;
511 } 508 }
512 509
513 #pragma mark - RequestTracker management 510 #pragma mark - RequestTracker management
514 511
515 void WebStateImpl::InitializeRequestTracker(
516 id<CRWRequestTrackerDelegate> delegate) {
517 BrowserState* browser_state = navigation_manager_.GetBrowserState();
518 request_tracker_ = RequestTrackerImpl::CreateTrackerForRequestGroupID(
519 GetRequestGroupID(), browser_state, browser_state->GetRequestContext(),
520 delegate);
521 }
522
523 void WebStateImpl::CloseRequestTracker() {
524 request_tracker_->Close();
525 request_tracker_ = NULL;
526 }
527
528 RequestTrackerImpl* WebStateImpl::GetRequestTracker() {
529 DCHECK(request_tracker_.get());
530 return request_tracker_.get();
531 }
532
533 NSString* WebStateImpl::GetRequestGroupID() {
534 if (request_group_id_.get() == nil)
535 request_group_id_.reset([GenerateNewRequestGroupID() copy]);
536
537 return request_group_id_;
538 }
539
540 int WebStateImpl::DownloadImage( 512 int WebStateImpl::DownloadImage(
541 const GURL& url, 513 const GURL& url,
542 bool is_favicon, 514 bool is_favicon,
543 uint32_t max_bitmap_size, 515 uint32_t max_bitmap_size,
544 bool bypass_cache, 516 bool bypass_cache,
545 const ImageDownloadCallback& callback) { 517 const ImageDownloadCallback& callback) {
546 // |is_favicon| specifies whether the download of the image occurs with 518 // |is_favicon| specifies whether the download of the image occurs with
547 // cookies or not. Currently, only downloads without cookies are supported. 519 // cookies or not. Currently, only downloads without cookies are supported.
548 // |bypass_cache| is ignored since the downloads never go through a cache. 520 // |bypass_cache| is ignored since the downloads never go through a cache.
549 DCHECK(is_favicon); 521 DCHECK(is_favicon);
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 const LoadCommittedDetails& load_details) { 706 const LoadCommittedDetails& load_details) {
735 for (auto& observer : observers_) 707 for (auto& observer : observers_)
736 observer.NavigationItemCommitted(load_details); 708 observer.NavigationItemCommitted(load_details);
737 } 709 }
738 710
739 WebState* WebStateImpl::GetWebState() { 711 WebState* WebStateImpl::GetWebState() {
740 return this; 712 return this;
741 } 713 }
742 714
743 } // namespace web 715 } // namespace web
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698