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

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

Issue 3245005: GTTF: Clean up DownloadFileManager (Closed)
Patch Set: fixes 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/download/base_file.h ('k') | chrome/browser/download/base_file_unittest.cc » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/base_file.h" 5 #include "chrome/browser/download/base_file.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "net/base/file_stream.h" 9 #include "net/base/file_stream.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
11 #include "chrome/browser/chrome_thread.h" 11 #include "chrome/browser/chrome_thread.h"
12 #include "chrome/browser/download/download_util.h" 12 #include "chrome/browser/download/download_util.h"
13 13
14 #if defined(OS_WIN) 14 #if defined(OS_WIN)
15 #include "chrome/common/win_safe_util.h" 15 #include "chrome/common/win_safe_util.h"
16 #elif defined(OS_MACOSX) 16 #elif defined(OS_MACOSX)
17 #include "chrome/browser/cocoa/file_metadata.h" 17 #include "chrome/browser/cocoa/file_metadata.h"
18 #endif 18 #endif
19 19
20 BaseFile::BaseFile(const FilePath& full_path, 20 BaseFile::BaseFile(const FilePath& full_path,
21 const GURL& source_url, 21 const GURL& source_url,
22 const GURL& referrer_url, 22 const GURL& referrer_url,
23 int64 received_bytes,
23 const linked_ptr<net::FileStream>& file_stream) 24 const linked_ptr<net::FileStream>& file_stream)
24 : full_path_(full_path), 25 : full_path_(full_path),
25 path_renamed_(false), 26 path_renamed_(false),
26 source_url_(source_url), 27 source_url_(source_url),
27 referrer_url_(referrer_url), 28 referrer_url_(referrer_url),
28 file_stream_(file_stream), 29 file_stream_(file_stream),
29 bytes_so_far_(0), 30 bytes_so_far_(received_bytes),
30 power_save_blocker_(true) { 31 power_save_blocker_(true) {
31 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); 32 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE));
32 } 33 }
33 34
34 BaseFile::~BaseFile() { 35 BaseFile::~BaseFile() {
35 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); 36 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE));
36 if (in_progress()) 37 if (in_progress())
37 Cancel(); 38 Cancel();
38 Close(); 39 Close();
39 } 40 }
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 if (file_stream_.get()) { 187 if (file_stream_.get()) {
187 #if defined(OS_CHROMEOS) 188 #if defined(OS_CHROMEOS)
188 // Currently we don't really care about the return value, since if it fails 189 // Currently we don't really care about the return value, since if it fails
189 // theres not much we can do. But we might in the future. 190 // theres not much we can do. But we might in the future.
190 file_stream_->Flush(); 191 file_stream_->Flush();
191 #endif 192 #endif
192 file_stream_->Close(); 193 file_stream_->Close();
193 file_stream_.reset(); 194 file_stream_.reset();
194 } 195 }
195 } 196 }
OLDNEW
« no previous file with comments | « chrome/browser/download/base_file.h ('k') | chrome/browser/download/base_file_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698