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

Side by Side Diff: chrome/browser/search/most_visited_iframe_source.cc

Issue 2481923002: [WIP] make GURL::path() return a StringPiece (Closed)
Patch Set: thanks asan Created 4 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/search/most_visited_iframe_source.h" 5 #include "chrome/browser/search/most_visited_iframe_source.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/ref_counted_memory.h" 8 #include "base/memory/ref_counted_memory.h"
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 std::string MostVisitedIframeSource::GetSource() const { 43 std::string MostVisitedIframeSource::GetSource() const {
44 return chrome::kChromeSearchMostVisitedHost; 44 return chrome::kChromeSearchMostVisitedHost;
45 } 45 }
46 46
47 void MostVisitedIframeSource::StartDataRequest( 47 void MostVisitedIframeSource::StartDataRequest(
48 const std::string& path_and_query, 48 const std::string& path_and_query,
49 const content::ResourceRequestInfo::WebContentsGetter& wc_getter, 49 const content::ResourceRequestInfo::WebContentsGetter& wc_getter,
50 const content::URLDataSource::GotDataCallback& callback) { 50 const content::URLDataSource::GotDataCallback& callback) {
51 GURL url(chrome::kChromeSearchMostVisitedUrl + path_and_query); 51 GURL url(chrome::kChromeSearchMostVisitedUrl + path_and_query);
52 std::string path(url.path()); 52 base::StringPiece path(url.path());
53 53
54 #if !defined(GOOGLE_CHROME_BUILD) 54 #if !defined(GOOGLE_CHROME_BUILD)
55 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 55 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
56 if (command_line->HasSwitch(switches::kLocalNtpReload)) { 56 if (command_line->HasSwitch(switches::kLocalNtpReload)) {
57 std::string rel_path = "most_visited_" + path.substr(1); 57 std::string rel_path = "most_visited_" + path.substr(1).as_string();
58 if (path == kSingleJSPath) { 58 if (path == kSingleJSPath) {
59 std::string origin; 59 std::string origin;
60 if (!GetOrigin(wc_getter, &origin)) { 60 if (!GetOrigin(wc_getter, &origin)) {
61 callback.Run(nullptr); 61 callback.Run(nullptr);
62 return; 62 return;
63 } 63 }
64 local_ntp::SendLocalFileResourceWithOrigin(rel_path, origin, callback); 64 local_ntp::SendLocalFileResourceWithOrigin(rel_path, origin, callback);
65 } else { 65 } else {
66 local_ntp::SendLocalFileResource(rel_path, callback); 66 local_ntp::SendLocalFileResource(rel_path, callback);
67 } 67 }
(...skipping 28 matching lines...) Expand all
96 } 96 }
97 } 97 }
98 98
99 bool MostVisitedIframeSource::ServesPath(const std::string& path) const { 99 bool MostVisitedIframeSource::ServesPath(const std::string& path) const {
100 return path == kTitleHTMLPath || path == kTitleCSSPath || 100 return path == kTitleHTMLPath || path == kTitleCSSPath ||
101 path == kTitleJSPath || path == kThumbnailHTMLPath || 101 path == kTitleJSPath || path == kThumbnailHTMLPath ||
102 path == kThumbnailCSSPath || path == kThumbnailJSPath || 102 path == kThumbnailCSSPath || path == kThumbnailJSPath ||
103 path == kSingleHTMLPath || path == kSingleCSSPath || 103 path == kSingleHTMLPath || path == kSingleCSSPath ||
104 path == kSingleJSPath || path == kUtilJSPath || path == kCommonCSSPath; 104 path == kSingleJSPath || path == kUtilJSPath || path == kCommonCSSPath;
105 } 105 }
OLDNEW
« no previous file with comments | « chrome/browser/search/iframe_source.cc ('k') | chrome/browser/supervised_user/supervised_user_url_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698