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

Side by Side Diff: content/browser/download/drag_download_util.cc

Issue 9558012: Cleanup: IWYU for BrowserThread. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix win Created 8 years, 9 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 | Annotate | Revision Log
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 "content/browser/download/drag_download_util.h" 5 #include "content/browser/download/drag_download_util.h"
6 6
7 #include <string>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/file_path.h" 10 #include "base/file_path.h"
9 #include "base/file_util.h" 11 #include "base/file_util.h"
10 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
11 #include "base/string_number_conversions.h" 13 #include "base/string_number_conversions.h"
12 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "base/threading/thread_restrictions.h"
13 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
14 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
15 #include "googleurl/src/gurl.h" 18 #include "googleurl/src/gurl.h"
16 #include "net/base/file_stream.h" 19 #include "net/base/file_stream.h"
17 #include "net/base/net_errors.h" 20 #include "net/base/net_errors.h"
18 21
19 using content::BrowserThread; 22 using content::BrowserThread;
20 using net::FileStream; 23 using net::FileStream;
21 24
22 namespace drag_download_util { 25 namespace drag_download_util {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 FileStream* CreateFileStreamForDrop(FilePath* file_path, net::NetLog* net_log) { 62 FileStream* CreateFileStreamForDrop(FilePath* file_path, net::NetLog* net_log) {
60 DCHECK(file_path && !file_path->empty()); 63 DCHECK(file_path && !file_path->empty());
61 64
62 scoped_ptr<FileStream> file_stream(new FileStream(net_log)); 65 scoped_ptr<FileStream> file_stream(new FileStream(net_log));
63 const int kMaxSeq = 99; 66 const int kMaxSeq = 99;
64 for (int seq = 0; seq <= kMaxSeq; seq++) { 67 for (int seq = 0; seq <= kMaxSeq; seq++) {
65 FilePath new_file_path; 68 FilePath new_file_path;
66 if (seq == 0) { 69 if (seq == 0) {
67 new_file_path = *file_path; 70 new_file_path = *file_path;
68 } else { 71 } else {
69 #if defined(OS_WIN) 72 #if defined(OS_WIN)
70 string16 suffix = ASCIIToUTF16("-") + base::IntToString16(seq); 73 string16 suffix = ASCIIToUTF16("-") + base::IntToString16(seq);
71 #else 74 #else
72 std::string suffix = std::string("-") + base::IntToString(seq); 75 std::string suffix = std::string("-") + base::IntToString(seq);
73 #endif 76 #endif
74 new_file_path = file_path->InsertBeforeExtension(suffix); 77 new_file_path = file_path->InsertBeforeExtension(suffix);
75 } 78 }
76 79
77 // http://crbug.com/110709 80 // http://crbug.com/110709
78 base::ThreadRestrictions::ScopedAllowIO allow_io; 81 base::ThreadRestrictions::ScopedAllowIO allow_io;
79 82
80 // Explicitly (and redundantly check) for file -- despite the fact that our 83 // Explicitly (and redundantly check) for file -- despite the fact that our
81 // open won't overwrite -- just to avoid log spew. 84 // open won't overwrite -- just to avoid log spew.
82 if (!file_util::PathExists(new_file_path) && 85 if (!file_util::PathExists(new_file_path) &&
83 file_stream->OpenSync(new_file_path, base::PLATFORM_FILE_CREATE | 86 file_stream->OpenSync(new_file_path, base::PLATFORM_FILE_CREATE |
(...skipping 24 matching lines...) Expand all
108 base::Bind(&PromiseFileFinalizer::Cleanup, this)); 111 base::Bind(&PromiseFileFinalizer::Cleanup, this));
109 } 112 }
110 113
111 void PromiseFileFinalizer::OnDownloadAborted() { 114 void PromiseFileFinalizer::OnDownloadAborted() {
112 BrowserThread::PostTask( 115 BrowserThread::PostTask(
113 BrowserThread::UI, FROM_HERE, 116 BrowserThread::UI, FROM_HERE,
114 base::Bind(&PromiseFileFinalizer::Cleanup, this)); 117 base::Bind(&PromiseFileFinalizer::Cleanup, this));
115 } 118 }
116 119
117 } // namespace drag_download_util 120 } // namespace drag_download_util
OLDNEW
« no previous file with comments | « content/browser/browser_thread_impl.cc ('k') | content/browser/in_process_webkit/indexed_db_quota_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698