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

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

Issue 1274123003: Update SplitString calls to new form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no media changes Created 5 years, 4 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
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 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 // Normally we want to base the filename on the page title, or if it doesn't 1210 // Normally we want to base the filename on the page title, or if it doesn't
1211 // exist, on the URL. It's not easy to tell if the page has no title, because 1211 // exist, on the URL. It's not easy to tell if the page has no title, because
1212 // if the page has no title, WebContents::GetTitle() will return the page's 1212 // if the page has no title, WebContents::GetTitle() will return the page's
1213 // URL (adjusted for display purposes). Therefore, we convert the "title" 1213 // URL (adjusted for display purposes). Therefore, we convert the "title"
1214 // back to a URL, and if it matches the original page URL, we know the page 1214 // back to a URL, and if it matches the original page URL, we know the page
1215 // had no title (or had a title equal to its URL, which is fine to treat 1215 // had no title (or had a title equal to its URL, which is fine to treat
1216 // similarly). 1216 // similarly).
1217 if (title_ == net::FormatUrl(page_url_, accept_langs)) { 1217 if (title_ == net::FormatUrl(page_url_, accept_langs)) {
1218 std::string url_path; 1218 std::string url_path;
1219 if (!page_url_.SchemeIs(url::kDataScheme)) { 1219 if (!page_url_.SchemeIs(url::kDataScheme)) {
1220 std::vector<std::string> url_parts; 1220 std::vector<std::string> url_parts = base::SplitString(
1221 base::SplitString(page_url_.path(), '/', &url_parts); 1221 page_url_.path(), "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
1222 if (!url_parts.empty()) { 1222 if (!url_parts.empty()) {
1223 for (int i = static_cast<int>(url_parts.size()) - 1; i >= 0; --i) { 1223 for (int i = static_cast<int>(url_parts.size()) - 1; i >= 0; --i) {
1224 url_path = url_parts[i]; 1224 url_path = url_parts[i];
1225 if (!url_path.empty()) 1225 if (!url_path.empty())
1226 break; 1226 break;
1227 } 1227 }
1228 } 1228 }
1229 if (url_path.empty()) 1229 if (url_path.empty())
1230 url_path = page_url_.host(); 1230 url_path = page_url_.host();
1231 } else { 1231 } else {
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1434 1434
1435 void SavePackage::FinalizeDownloadEntry() { 1435 void SavePackage::FinalizeDownloadEntry() {
1436 DCHECK(download_); 1436 DCHECK(download_);
1437 DCHECK(download_manager_); 1437 DCHECK(download_manager_);
1438 1438
1439 download_manager_->OnSavePackageSuccessfullyFinished(download_); 1439 download_manager_->OnSavePackageSuccessfullyFinished(download_);
1440 StopObservation(); 1440 StopObservation();
1441 } 1441 }
1442 1442
1443 } // namespace content 1443 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/file_metadata_unittest_linux.cc ('k') | content/browser/loader/resource_dispatcher_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698