| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/download/save_package.h" | 5 #include "chrome/browser/download/save_package.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/i18n/file_util_icu.h" | 10 #include "base/i18n/file_util_icu.h" |
| (...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1126 // URL (adjusted for display purposes). Therefore, we convert the "title" | 1126 // URL (adjusted for display purposes). Therefore, we convert the "title" |
| 1127 // back to a URL, and if it matches the original page URL, we know the page | 1127 // back to a URL, and if it matches the original page URL, we know the page |
| 1128 // had no title (or had a title equal to its URL, which is fine to treat | 1128 // had no title (or had a title equal to its URL, which is fine to treat |
| 1129 // similarly). | 1129 // similarly). |
| 1130 GURL fixed_up_title_url = | 1130 GURL fixed_up_title_url = |
| 1131 URLFixerUpper::FixupURL(UTF16ToUTF8(title_), std::string()); | 1131 URLFixerUpper::FixupURL(UTF16ToUTF8(title_), std::string()); |
| 1132 | 1132 |
| 1133 if (page_url_ == fixed_up_title_url) { | 1133 if (page_url_ == fixed_up_title_url) { |
| 1134 std::string url_path; | 1134 std::string url_path; |
| 1135 std::vector<std::string> url_parts; | 1135 std::vector<std::string> url_parts; |
| 1136 SplitString(page_url_.path(), '/', &url_parts); | 1136 base::SplitString(page_url_.path(), '/', &url_parts); |
| 1137 if (!url_parts.empty()) { | 1137 if (!url_parts.empty()) { |
| 1138 for (int i = static_cast<int>(url_parts.size()) - 1; i >= 0; --i) { | 1138 for (int i = static_cast<int>(url_parts.size()) - 1; i >= 0; --i) { |
| 1139 url_path = url_parts[i]; | 1139 url_path = url_parts[i]; |
| 1140 if (!url_path.empty()) | 1140 if (!url_path.empty()) |
| 1141 break; | 1141 break; |
| 1142 } | 1142 } |
| 1143 } | 1143 } |
| 1144 if (url_path.empty()) | 1144 if (url_path.empty()) |
| 1145 url_path = page_url_.host(); | 1145 url_path = page_url_.host(); |
| 1146 name_with_proper_ext = FilePath::FromWStringHack(UTF8ToWide(url_path)); | 1146 name_with_proper_ext = FilePath::FromWStringHack(UTF8ToWide(url_path)); |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1396 int index, void* params) { | 1396 int index, void* params) { |
| 1397 SavePackageParam* save_params = reinterpret_cast<SavePackageParam*>(params); | 1397 SavePackageParam* save_params = reinterpret_cast<SavePackageParam*>(params); |
| 1398 ContinueSave(save_params, path, index); | 1398 ContinueSave(save_params, path, index); |
| 1399 delete save_params; | 1399 delete save_params; |
| 1400 } | 1400 } |
| 1401 | 1401 |
| 1402 void SavePackage::FileSelectionCanceled(void* params) { | 1402 void SavePackage::FileSelectionCanceled(void* params) { |
| 1403 SavePackageParam* save_params = reinterpret_cast<SavePackageParam*>(params); | 1403 SavePackageParam* save_params = reinterpret_cast<SavePackageParam*>(params); |
| 1404 delete save_params; | 1404 delete save_params; |
| 1405 } | 1405 } |
| OLD | NEW |