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

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

Issue 637493002: Clean up ifdef around FilePath creation in /src/content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 | « no previous file | content/renderer/pepper/pepper_file_chooser_host.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) 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/save_package.h" 5 #include "content/browser/download/save_package.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1285 static const struct { 1285 static const struct {
1286 const base::FilePath::CharType *mime_type; 1286 const base::FilePath::CharType *mime_type;
1287 const base::FilePath::CharType *suggested_extension; 1287 const base::FilePath::CharType *suggested_extension;
1288 } extensions[] = { 1288 } extensions[] = {
1289 { FILE_PATH_LITERAL("text/html"), kDefaultHtmlExtension }, 1289 { FILE_PATH_LITERAL("text/html"), kDefaultHtmlExtension },
1290 { FILE_PATH_LITERAL("text/xml"), FILE_PATH_LITERAL("xml") }, 1290 { FILE_PATH_LITERAL("text/xml"), FILE_PATH_LITERAL("xml") },
1291 { FILE_PATH_LITERAL("application/xhtml+xml"), FILE_PATH_LITERAL("xhtml") }, 1291 { FILE_PATH_LITERAL("application/xhtml+xml"), FILE_PATH_LITERAL("xhtml") },
1292 { FILE_PATH_LITERAL("text/plain"), FILE_PATH_LITERAL("txt") }, 1292 { FILE_PATH_LITERAL("text/plain"), FILE_PATH_LITERAL("txt") },
1293 { FILE_PATH_LITERAL("text/css"), FILE_PATH_LITERAL("css") }, 1293 { FILE_PATH_LITERAL("text/css"), FILE_PATH_LITERAL("css") },
1294 }; 1294 };
1295 #if defined(OS_POSIX) 1295 base::FilePath::StringType mime_type =
1296 base::FilePath::StringType mime_type(contents_mime_type); 1296 base::FilePath::StringType::FromUTF8Unsafe(contents_mime_type);
jochen (gone - plz use gerrit) 2014/10/08 14:10:32 please clang-format this
1297 #elif defined(OS_WIN)
1298 base::FilePath::StringType mime_type(base::UTF8ToWide(contents_mime_type));
1299 #endif // OS_WIN
1300 for (uint32 i = 0; i < ARRAYSIZE_UNSAFE(extensions); ++i) { 1297 for (uint32 i = 0; i < ARRAYSIZE_UNSAFE(extensions); ++i) {
1301 if (mime_type == extensions[i].mime_type) 1298 if (mime_type == extensions[i].mime_type)
1302 return extensions[i].suggested_extension; 1299 return extensions[i].suggested_extension;
1303 } 1300 }
1304 return FILE_PATH_LITERAL(""); 1301 return FILE_PATH_LITERAL("");
1305 } 1302 }
1306 1303
1307 void SavePackage::GetSaveInfo() { 1304 void SavePackage::GetSaveInfo() {
1308 // Can't use web_contents_ in the file thread, so get the data that we need 1305 // Can't use web_contents_ in the file thread, so get the data that we need
1309 // before calling to it. 1306 // before calling to it.
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1436 1433
1437 void SavePackage::FinalizeDownloadEntry() { 1434 void SavePackage::FinalizeDownloadEntry() {
1438 DCHECK(download_); 1435 DCHECK(download_);
1439 DCHECK(download_manager_); 1436 DCHECK(download_manager_);
1440 1437
1441 download_manager_->OnSavePackageSuccessfullyFinished(download_); 1438 download_manager_->OnSavePackageSuccessfullyFinished(download_);
1442 StopObservation(); 1439 StopObservation();
1443 } 1440 }
1444 1441
1445 } // namespace content 1442 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/pepper/pepper_file_chooser_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698