| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_engines/search_terms_data.h" | 5 #include "chrome/browser/search_engines/search_terms_data.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/google/google_url_tracker.h" | 10 #include "chrome/browser/google/google_url_tracker.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 } | 26 } |
| 27 | 27 |
| 28 std::string SearchTermsData::GoogleBaseSuggestURLValue() const { | 28 std::string SearchTermsData::GoogleBaseSuggestURLValue() const { |
| 29 // Start with the Google base URL. | 29 // Start with the Google base URL. |
| 30 const GURL base_url(GoogleBaseURLValue()); | 30 const GURL base_url(GoogleBaseURLValue()); |
| 31 DCHECK(base_url.is_valid()); | 31 DCHECK(base_url.is_valid()); |
| 32 | 32 |
| 33 GURL::Replacements repl; | 33 GURL::Replacements repl; |
| 34 | 34 |
| 35 // Replace any existing path with "/complete/". | 35 // Replace any existing path with "/complete/". |
| 36 static const std::string suggest_path("/complete/"); | 36 // SetPathStr() requires its argument to stay in scope as long as |repl| is, |
| 37 // so "/complete/" can't be passed to SetPathStr() directly, it needs to be in |
| 38 // a variable. |
| 39 const std::string suggest_path("/complete/"); |
| 37 repl.SetPathStr(suggest_path); | 40 repl.SetPathStr(suggest_path); |
| 38 | 41 |
| 39 // Clear the query and ref. | 42 // Clear the query and ref. |
| 40 repl.ClearQuery(); | 43 repl.ClearQuery(); |
| 41 repl.ClearRef(); | 44 repl.ClearRef(); |
| 42 return base_url.ReplaceComponents(repl).spec(); | 45 return base_url.ReplaceComponents(repl).spec(); |
| 43 } | 46 } |
| 44 | 47 |
| 45 std::string SearchTermsData::InstantFieldTrialUrlParam() const { | 48 std::string SearchTermsData::InstantFieldTrialUrlParam() const { |
| 46 return std::string(); | 49 return std::string(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 DCHECK(!BrowserThread::IsWellKnownThread(BrowserThread::UI) || | 95 DCHECK(!BrowserThread::IsWellKnownThread(BrowserThread::UI) || |
| 93 BrowserThread::CurrentlyOn(BrowserThread::UI)); | 96 BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 94 return InstantFieldTrial::GetGroupAsUrlParam(profile_); | 97 return InstantFieldTrial::GetGroupAsUrlParam(profile_); |
| 95 } | 98 } |
| 96 | 99 |
| 97 // static | 100 // static |
| 98 void UIThreadSearchTermsData::SetGoogleBaseURL(std::string* google_base_url) { | 101 void UIThreadSearchTermsData::SetGoogleBaseURL(std::string* google_base_url) { |
| 99 delete google_base_url_; | 102 delete google_base_url_; |
| 100 google_base_url_ = google_base_url; | 103 google_base_url_ = google_base_url; |
| 101 } | 104 } |
| OLD | NEW |