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

Side by Side Diff: chrome/browser/download/download_request_limiter.cc

Issue 2478573004: Convert GURL::{host,path} to GURL::{host_piece,path_piece} for ==. (Closed)
Patch Set: rebase to #431874 Created 4 years, 1 month 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/browser/download/download_request_limiter.h" 5 #include "chrome/browser/download/download_request_limiter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 (status_ == PROMPT_BEFORE_DOWNLOAD || status_ == DOWNLOADS_NOT_ALLOWED)) { 82 (status_ == PROMPT_BEFORE_DOWNLOAD || status_ == DOWNLOADS_NOT_ALLOWED)) {
83 return; 83 return;
84 } 84 }
85 85
86 if (status_ == DownloadRequestLimiter::ALLOW_ALL_DOWNLOADS || 86 if (status_ == DownloadRequestLimiter::ALLOW_ALL_DOWNLOADS ||
87 status_ == DownloadRequestLimiter::DOWNLOADS_NOT_ALLOWED) { 87 status_ == DownloadRequestLimiter::DOWNLOADS_NOT_ALLOWED) {
88 // User has either allowed all downloads or blocked all downloads. Only 88 // User has either allowed all downloads or blocked all downloads. Only
89 // reset the download state if the user is navigating to a different host 89 // reset the download state if the user is navigating to a different host
90 // (or host is empty). 90 // (or host is empty).
91 if (!initial_page_host_.empty() && 91 if (!initial_page_host_.empty() &&
92 navigation_handle->GetURL().host() == initial_page_host_) { 92 navigation_handle->GetURL().host_piece() == initial_page_host_) {
93 return; 93 return;
94 } 94 }
95 } 95 }
96 96
97 NotifyCallbacks(false); 97 NotifyCallbacks(false);
98 host_->Remove(this, web_contents()); 98 host_->Remove(this, web_contents());
99 } 99 }
100 100
101 void DownloadRequestLimiter::TabDownloadState::DidFinishNavigation( 101 void DownloadRequestLimiter::TabDownloadState::DidFinishNavigation(
102 content::NavigationHandle* navigation_handle) { 102 content::NavigationHandle* navigation_handle) {
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 NOTREACHED(); 466 NOTREACHED();
467 } 467 }
468 } 468 }
469 469
470 void DownloadRequestLimiter::Remove(TabDownloadState* state, 470 void DownloadRequestLimiter::Remove(TabDownloadState* state,
471 content::WebContents* contents) { 471 content::WebContents* contents) {
472 DCHECK(base::ContainsKey(state_map_, contents)); 472 DCHECK(base::ContainsKey(state_map_, contents));
473 state_map_.erase(contents); 473 state_map_.erase(contents);
474 delete state; 474 delete state;
475 } 475 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698