OLD | NEW |
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> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "base/threading/thread_restrictions.h" | 16 #include "base/threading/thread_restrictions.h" |
17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
18 #include "net/base/file_stream.h" | 18 #include "net/base/file_stream.h" |
19 #include "net/base/net_errors.h" | 19 #include "net/base/net_errors.h" |
20 #include "url/gurl.h" | 20 #include "url/gurl.h" |
21 | 21 |
22 using net::FileStream; | 22 using net::FileStream; |
23 | 23 |
24 namespace content { | 24 namespace content { |
25 | 25 |
26 bool ParseDownloadMetadata(const base::string16& metadata, | 26 bool ParseDownloadMetadata(const base::string16& metadata, |
27 base::string16* mime_type, | 27 base::string16* mime_type, |
28 base::FilePath* file_name, | 28 base::FilePath* file_name, |
29 GURL* url) { | 29 GURL* url) { |
30 const char16 separator = L':'; | 30 const base::char16 separator = L':'; |
31 | 31 |
32 size_t mime_type_end_pos = metadata.find(separator); | 32 size_t mime_type_end_pos = metadata.find(separator); |
33 if (mime_type_end_pos == base::string16::npos) | 33 if (mime_type_end_pos == base::string16::npos) |
34 return false; | 34 return false; |
35 | 35 |
36 size_t file_name_end_pos = metadata.find(separator, mime_type_end_pos + 1); | 36 size_t file_name_end_pos = metadata.find(separator, mime_type_end_pos + 1); |
37 if (file_name_end_pos == base::string16::npos) | 37 if (file_name_end_pos == base::string16::npos) |
38 return false; | 38 return false; |
39 | 39 |
40 GURL parsed_url = GURL(metadata.substr(file_name_end_pos + 1)); | 40 GURL parsed_url = GURL(metadata.substr(file_name_end_pos + 1)); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 } | 113 } |
114 | 114 |
115 PromiseFileFinalizer::~PromiseFileFinalizer() {} | 115 PromiseFileFinalizer::~PromiseFileFinalizer() {} |
116 | 116 |
117 void PromiseFileFinalizer::Cleanup() { | 117 void PromiseFileFinalizer::Cleanup() { |
118 if (drag_file_downloader_.get()) | 118 if (drag_file_downloader_.get()) |
119 drag_file_downloader_ = NULL; | 119 drag_file_downloader_ = NULL; |
120 } | 120 } |
121 | 121 |
122 } // namespace content | 122 } // namespace content |
OLD | NEW |