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

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

Issue 9594012: Move TabContentsDragWin to content and rename it to WebContentsDragWin. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: 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 #ifndef CONTENT_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_UTIL_H_ 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_UTIL_H_
6 #define CONTENT_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_UTIL_H_ 6 #define CONTENT_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_UTIL_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/string16.h" 11 #include "base/string16.h"
12 #include "content/browser/download/drag_download_file.h" 12 #include "content/browser/download/drag_download_file.h"
13 #include "content/common/content_export.h"
14 #include "ui/base/dragdrop/download_file_interface.h" 13 #include "ui/base/dragdrop/download_file_interface.h"
15 14
16 class FilePath; 15 class FilePath;
17 class GURL; 16 class GURL;
18 namespace net { 17 namespace net {
19 class FileStream; 18 class FileStream;
20 } 19 }
21 20
22 namespace drag_download_util { 21 namespace drag_download_util {
23 22
24 // Parse the download metadata set in DataTransfer.setData. The metadata 23 // Parse the download metadata set in DataTransfer.setData. The metadata
25 // consists of a set of the following values separated by ":" 24 // consists of a set of the following values separated by ":"
26 // * MIME type 25 // * MIME type
27 // * File name 26 // * File name
28 // * URL 27 // * URL
29 // If the file name contains special characters, they need to be escaped 28 // If the file name contains special characters, they need to be escaped
30 // appropriately. 29 // appropriately.
31 // For example, we can have 30 // For example, we can have
32 // text/plain:example.txt:http://example.com/example.txt 31 // text/plain:example.txt:http://example.com/example.txt
33 CONTENT_EXPORT bool ParseDownloadMetadata(const string16& metadata, 32 bool ParseDownloadMetadata(const string16& metadata,
34 string16* mime_type, 33 string16* mime_type,
35 FilePath* file_name, 34 FilePath* file_name,
36 GURL* url); 35 GURL* url);
37 36
38 // Create a new file at the specified path. If the file already exists, try to 37 // Create a new file at the specified path. If the file already exists, try to
39 // insert the sequential unifier to produce a new file, like foo-01.txt. 38 // insert the sequential unifier to produce a new file, like foo-01.txt.
40 // Return a FileStream if successful. 39 // Return a FileStream if successful.
41 // |net_log| is a NetLog for the stream. 40 // |net_log| is a NetLog for the stream.
42 CONTENT_EXPORT net::FileStream* CreateFileStreamForDrop( 41 net::FileStream* CreateFileStreamForDrop(
43 FilePath* file_path, net::NetLog* net_log); 42 FilePath* file_path, net::NetLog* net_log);
44 43
45 // Implementation of DownloadFileObserver to finalize the download process. 44 // Implementation of DownloadFileObserver to finalize the download process.
46 class CONTENT_EXPORT PromiseFileFinalizer : public ui::DownloadFileObserver { 45 class PromiseFileFinalizer : public ui::DownloadFileObserver {
47 public: 46 public:
48 explicit PromiseFileFinalizer(DragDownloadFile* drag_file_downloader); 47 explicit PromiseFileFinalizer(DragDownloadFile* drag_file_downloader);
49 virtual ~PromiseFileFinalizer(); 48 virtual ~PromiseFileFinalizer();
50 49
51 // DownloadFileObserver methods. 50 // DownloadFileObserver methods.
52 virtual void OnDownloadCompleted(const FilePath& file_path) OVERRIDE; 51 virtual void OnDownloadCompleted(const FilePath& file_path) OVERRIDE;
53 virtual void OnDownloadAborted() OVERRIDE; 52 virtual void OnDownloadAborted() OVERRIDE;
54 53
55 private: 54 private:
56 void Cleanup(); 55 void Cleanup();
57 56
58 scoped_refptr<DragDownloadFile> drag_file_downloader_; 57 scoped_refptr<DragDownloadFile> drag_file_downloader_;
59 58
60 DISALLOW_COPY_AND_ASSIGN(PromiseFileFinalizer); 59 DISALLOW_COPY_AND_ASSIGN(PromiseFileFinalizer);
61 }; 60 };
62 61
63 } // namespace drag_download_util 62 } // namespace drag_download_util
64 63
65 #endif // CONTENT_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_UTIL_H_ 64 #endif // CONTENT_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_UTIL_H_
OLDNEW
« no previous file with comments | « content/browser/download/drag_download_file.h ('k') | content/browser/tab_contents/web_contents_drag_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698