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

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

Issue 562603002: Move PageTransition from //content/public/common to //ui/base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 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 (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/content_settings/host_content_settings_map.h" 9 #include "chrome/browser/content_settings/host_content_settings_map.h"
10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 10 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 // is possible that queued up downloads for the page before the pending 198 // is possible that queued up downloads for the page before the pending
199 // navigation will be delivered to us after we process this request. If this 199 // navigation will be delivered to us after we process this request. If this
200 // happens we may let a download through that we shouldn't have. But this is 200 // happens we may let a download through that we shouldn't have. But this is
201 // rather rare, and it is difficult to get 100% right, so we don't deal with 201 // rather rare, and it is difficult to get 100% right, so we don't deal with
202 // it. 202 // it.
203 NavigationEntry* entry = controller->GetPendingEntry(); 203 NavigationEntry* entry = controller->GetPendingEntry();
204 if (!entry) 204 if (!entry)
205 return; 205 return;
206 206
207 // Redirects don't count. 207 // Redirects don't count.
208 if (content::PageTransitionIsRedirect(entry->GetTransitionType())) 208 if (ui::PageTransitionIsRedirect(entry->GetTransitionType()))
209 return; 209 return;
210 210
211 if (status_ == DownloadRequestLimiter::ALLOW_ALL_DOWNLOADS || 211 if (status_ == DownloadRequestLimiter::ALLOW_ALL_DOWNLOADS ||
212 status_ == DownloadRequestLimiter::DOWNLOADS_NOT_ALLOWED) { 212 status_ == DownloadRequestLimiter::DOWNLOADS_NOT_ALLOWED) {
213 // User has either allowed all downloads or canceled all downloads. Only 213 // User has either allowed all downloads or canceled all downloads. Only
214 // reset the download state if the user is navigating to a different host 214 // reset the download state if the user is navigating to a different host
215 // (or host is empty). 215 // (or host is empty).
216 if (!initial_page_host_.empty() && !entry->GetURL().host().empty() && 216 if (!initial_page_host_.empty() && !entry->GetURL().host().empty() &&
217 entry->GetURL().host() == initial_page_host_) 217 entry->GetURL().host() == initial_page_host_)
218 return; 218 return;
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 BrowserThread::PostTask( 456 BrowserThread::PostTask(
457 BrowserThread::IO, FROM_HERE, base::Bind(callback, allow)); 457 BrowserThread::IO, FROM_HERE, base::Bind(callback, allow));
458 } 458 }
459 459
460 void DownloadRequestLimiter::Remove(TabDownloadState* state, 460 void DownloadRequestLimiter::Remove(TabDownloadState* state,
461 content::WebContents* contents) { 461 content::WebContents* contents) {
462 DCHECK(ContainsKey(state_map_, contents)); 462 DCHECK(ContainsKey(state_map_, contents));
463 state_map_.erase(contents); 463 state_map_.erase(contents);
464 delete state; 464 delete state;
465 } 465 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_browsertest.cc ('k') | chrome/browser/download/download_shelf_context_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698