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

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

Issue 12213066: Use base namespace for FilePath in content/browser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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_file.h" 5 #include "content/browser/download/drag_download_file.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "content/browser/download/download_stats.h" 10 #include "content/browser/download/download_stats.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 download_item_(NULL), 48 download_item_(NULL),
49 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { 49 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {
50 DCHECK(on_completed_loop_); 50 DCHECK(on_completed_loop_);
51 DCHECK(!on_completed_.is_null()); 51 DCHECK(!on_completed_.is_null());
52 DCHECK(web_contents_); 52 DCHECK(web_contents_);
53 // May be called on any thread. 53 // May be called on any thread.
54 // Do not call weak_ptr_factory_.GetWeakPtr() outside the UI thread. 54 // Do not call weak_ptr_factory_.GetWeakPtr() outside the UI thread.
55 } 55 }
56 56
57 void InitiateDownload(scoped_ptr<net::FileStream> file_stream, 57 void InitiateDownload(scoped_ptr<net::FileStream> file_stream,
58 const FilePath& file_path) { 58 const base::FilePath& file_path) {
59 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 59 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
60 DownloadManager* download_manager = 60 DownloadManager* download_manager =
61 BrowserContext::GetDownloadManager(web_contents_->GetBrowserContext()); 61 BrowserContext::GetDownloadManager(web_contents_->GetBrowserContext());
62 62
63 RecordDownloadSource(INITIATED_BY_DRAG_N_DROP); 63 RecordDownloadSource(INITIATED_BY_DRAG_N_DROP);
64 scoped_ptr<content::DownloadUrlParameters> params( 64 scoped_ptr<content::DownloadUrlParameters> params(
65 DownloadUrlParameters::FromWebContents(web_contents_, url_)); 65 DownloadUrlParameters::FromWebContents(web_contents_, url_));
66 params->set_referrer(referrer_); 66 params->set_referrer(referrer_);
67 params->set_referrer_encoding(referrer_encoding_); 67 params->set_referrer_encoding(referrer_encoding_);
68 params->set_callback(base::Bind(&DragDownloadFileUI::OnDownloadStarted, 68 params->set_callback(base::Bind(&DragDownloadFileUI::OnDownloadStarted,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 std::string referrer_encoding_; 139 std::string referrer_encoding_;
140 WebContents* web_contents_; 140 WebContents* web_contents_;
141 DownloadItem* download_item_; 141 DownloadItem* download_item_;
142 142
143 // Only used in the callback from DownloadManager::DownloadUrl(). 143 // Only used in the callback from DownloadManager::DownloadUrl().
144 base::WeakPtrFactory<DragDownloadFileUI> weak_ptr_factory_; 144 base::WeakPtrFactory<DragDownloadFileUI> weak_ptr_factory_;
145 145
146 DISALLOW_COPY_AND_ASSIGN(DragDownloadFileUI); 146 DISALLOW_COPY_AND_ASSIGN(DragDownloadFileUI);
147 }; 147 };
148 148
149 DragDownloadFile::DragDownloadFile(const FilePath& file_path, 149 DragDownloadFile::DragDownloadFile(const base::FilePath& file_path,
150 scoped_ptr<net::FileStream> file_stream, 150 scoped_ptr<net::FileStream> file_stream,
151 const GURL& url, 151 const GURL& url,
152 const Referrer& referrer, 152 const Referrer& referrer,
153 const std::string& referrer_encoding, 153 const std::string& referrer_encoding,
154 WebContents* web_contents) 154 WebContents* web_contents)
155 : file_path_(file_path), 155 : file_path_(file_path),
156 file_stream_(file_stream.Pass()), 156 file_stream_(file_stream.Pass()),
157 drag_message_loop_(MessageLoop::current()), 157 drag_message_loop_(MessageLoop::current()),
158 state_(INITIALIZED), 158 state_(INITIALIZED),
159 drag_ui_(NULL), 159 drag_ui_(NULL),
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 231
232 void DragDownloadFile::CheckThread() { 232 void DragDownloadFile::CheckThread() {
233 #if defined(OS_WIN) 233 #if defined(OS_WIN)
234 DCHECK(drag_message_loop_ == MessageLoop::current()); 234 DCHECK(drag_message_loop_ == MessageLoop::current());
235 #else 235 #else
236 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 236 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
237 #endif 237 #endif
238 } 238 }
239 239
240 } // namespace content 240 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/drag_download_file.h ('k') | content/browser/download/drag_download_file_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698