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

Side by Side Diff: chrome/browser/renderer_host/download_resource_handler.cc

Issue 3347018: GTTF: Clean up DownloadFileManager (Closed)
Patch Set: shutdowns Created 10 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
« no previous file with comments | « chrome/browser/profile_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/renderer_host/download_resource_handler.h" 5 #include "chrome/browser/renderer_host/download_resource_handler.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/chrome_thread.h" 8 #include "chrome/browser/chrome_thread.h"
9 #include "chrome/browser/download/download_item.h" 9 #include "chrome/browser/download/download_item.h"
10 #include "chrome/browser/download/download_file_manager.h" 10 #include "chrome/browser/download/download_file_manager.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 !response->response_head.headers->GetMimeType(&content_type_header)) 85 !response->response_head.headers->GetMimeType(&content_type_header))
86 content_type_header = ""; 86 content_type_header = "";
87 info->original_mime_type = content_type_header; 87 info->original_mime_type = content_type_header;
88 88
89 info->prompt_user_for_save_location = 89 info->prompt_user_for_save_location =
90 save_as_ && save_info_.file_path.empty(); 90 save_as_ && save_info_.file_path.empty();
91 info->is_dangerous = false; 91 info->is_dangerous = false;
92 info->referrer_charset = request_->context()->referrer_charset(); 92 info->referrer_charset = request_->context()->referrer_charset();
93 info->save_info = save_info_; 93 info->save_info = save_info_;
94 ChromeThread::PostTask( 94 ChromeThread::PostTask(
95 ChromeThread::FILE, FROM_HERE, 95 ChromeThread::UI, FROM_HERE,
96 NewRunnableMethod( 96 NewRunnableMethod(
97 download_file_manager_, &DownloadFileManager::StartDownload, info)); 97 download_file_manager_, &DownloadFileManager::StartDownload, info));
98
99 // We can't start saving the data before we create the file on disk.
100 // The request will be un-paused in DownloadFileManager::CreateDownloadFile.
101 rdh_->PauseRequest(global_id_.child_id, global_id_.request_id, true);
102
98 return true; 103 return true;
99 } 104 }
100 105
101 bool DownloadResourceHandler::OnWillStart(int request_id, 106 bool DownloadResourceHandler::OnWillStart(int request_id,
102 const GURL& url, 107 const GURL& url,
103 bool* defer) { 108 bool* defer) {
104 return true; 109 return true;
105 } 110 }
106 111
107 // Create a new buffer, which will be handed to the download thread for file 112 // Create a new buffer, which will be handed to the download thread for file
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 } 211 }
207 212
208 DownloadResourceHandler::~DownloadResourceHandler() { 213 DownloadResourceHandler::~DownloadResourceHandler() {
209 } 214 }
210 215
211 void DownloadResourceHandler::StartPauseTimer() { 216 void DownloadResourceHandler::StartPauseTimer() {
212 if (!pause_timer_.IsRunning()) 217 if (!pause_timer_.IsRunning())
213 pause_timer_.Start(base::TimeDelta::FromMilliseconds(kThrottleTimeMs), this, 218 pause_timer_.Start(base::TimeDelta::FromMilliseconds(kThrottleTimeMs), this,
214 &DownloadResourceHandler::CheckWriteProgress); 219 &DownloadResourceHandler::CheckWriteProgress);
215 } 220 }
OLDNEW
« no previous file with comments | « chrome/browser/profile_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698