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

Side by Side Diff: components/search_engines/search_terms_data.cc

Issue 889463003: GURL::Replacements methods accept a StringPiece instead of std::string&. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase (fixed some merge conflicts). Created 5 years, 10 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 | « components/omnibox/autocomplete_match.cc ('k') | components/search_engines/template_url.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/search_engines/search_terms_data.h" 5 #include "components/search_engines/search_terms_data.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "components/google/core/browser/google_url_tracker.h" 8 #include "components/google/core/browser/google_url_tracker.h"
9 #include "url/gurl.h" 9 #include "url/gurl.h"
10 10
11 SearchTermsData::SearchTermsData() { 11 SearchTermsData::SearchTermsData() {
12 } 12 }
13 13
14 SearchTermsData::~SearchTermsData() { 14 SearchTermsData::~SearchTermsData() {
15 } 15 }
16 16
17 std::string SearchTermsData::GoogleBaseURLValue() const { 17 std::string SearchTermsData::GoogleBaseURLValue() const {
18 return GoogleURLTracker::kDefaultGoogleHomepage; 18 return GoogleURLTracker::kDefaultGoogleHomepage;
19 } 19 }
20 20
21 std::string SearchTermsData::GoogleBaseSuggestURLValue() const { 21 std::string SearchTermsData::GoogleBaseSuggestURLValue() const {
22 // Start with the Google base URL. 22 // Start with the Google base URL.
23 const GURL base_url(GoogleBaseURLValue()); 23 const GURL base_url(GoogleBaseURLValue());
24 DCHECK(base_url.is_valid()); 24 DCHECK(base_url.is_valid());
25 25
26 GURL::Replacements repl; 26 GURL::Replacements repl;
27 27
28 // Replace any existing path with "/complete/". 28 // Replace any existing path with "/complete/".
29 // SetPathStr() requires its argument to stay in scope as long as |repl| is, 29 repl.SetPathStr("/complete/");
30 // so "/complete/" can't be passed to SetPathStr() directly, it needs to be in
31 // a variable.
32 const std::string suggest_path("/complete/");
33 repl.SetPathStr(suggest_path);
34 30
35 // Clear the query and ref. 31 // Clear the query and ref.
36 repl.ClearQuery(); 32 repl.ClearQuery();
37 repl.ClearRef(); 33 repl.ClearRef();
38 return base_url.ReplaceComponents(repl).spec(); 34 return base_url.ReplaceComponents(repl).spec();
39 } 35 }
40 36
41 std::string SearchTermsData::GetApplicationLocale() const { 37 std::string SearchTermsData::GetApplicationLocale() const {
42 return "en"; 38 return "en";
43 } 39 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 return 0; 76 return 0;
81 } 77 }
82 78
83 std::string SearchTermsData::NTPIsThemedParam() const { 79 std::string SearchTermsData::NTPIsThemedParam() const {
84 return std::string(); 80 return std::string();
85 } 81 }
86 82
87 std::string SearchTermsData::GoogleImageSearchSource() const { 83 std::string SearchTermsData::GoogleImageSearchSource() const {
88 return std::string(); 84 return std::string();
89 } 85 }
OLDNEW
« no previous file with comments | « components/omnibox/autocomplete_match.cc ('k') | components/search_engines/template_url.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698