OLD | NEW |
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 "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" |
11 #include "chrome/browser/instant/instant_controller.h" | 11 #include "chrome/browser/instant/instant_controller.h" |
12 #include "chrome/browser/instant/instant_field_trial.h" | 12 #include "chrome/browser/instant/instant_field_trial.h" |
13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
15 | 15 |
16 #if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) | 16 #if defined(ENABLE_RLZ) |
17 #include "chrome/browser/google/google_util.h" | 17 #include "chrome/browser/google/google_util.h" |
18 #include "chrome/browser/rlz/rlz.h" | 18 #include "chrome/browser/rlz/rlz.h" |
19 #endif | 19 #endif |
20 | 20 |
21 using content::BrowserThread; | 21 using content::BrowserThread; |
22 | 22 |
23 SearchTermsData::SearchTermsData() { | 23 SearchTermsData::SearchTermsData() { |
24 } | 24 } |
25 | 25 |
26 SearchTermsData::~SearchTermsData() { | 26 SearchTermsData::~SearchTermsData() { |
(...skipping 20 matching lines...) Expand all Loading... |
47 // Clear the query and ref. | 47 // Clear the query and ref. |
48 repl.ClearQuery(); | 48 repl.ClearQuery(); |
49 repl.ClearRef(); | 49 repl.ClearRef(); |
50 return base_url.ReplaceComponents(repl).spec(); | 50 return base_url.ReplaceComponents(repl).spec(); |
51 } | 51 } |
52 | 52 |
53 std::string SearchTermsData::GetApplicationLocale() const { | 53 std::string SearchTermsData::GetApplicationLocale() const { |
54 return "en"; | 54 return "en"; |
55 } | 55 } |
56 | 56 |
57 #if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) | 57 #if defined(ENABLE_RLZ) |
58 string16 SearchTermsData::GetRlzParameterValue() const { | 58 string16 SearchTermsData::GetRlzParameterValue() const { |
59 return string16(); | 59 return string16(); |
60 } | 60 } |
61 #endif | 61 #endif |
62 | 62 |
63 std::string SearchTermsData::InstantEnabledParam() const { | 63 std::string SearchTermsData::InstantEnabledParam() const { |
64 return std::string(); | 64 return std::string(); |
65 } | 65 } |
66 | 66 |
67 std::string SearchTermsData::InstantFieldTrialUrlParam() const { | 67 std::string SearchTermsData::InstantFieldTrialUrlParam() const { |
(...skipping 14 matching lines...) Expand all Loading... |
82 return google_base_url_ ? | 82 return google_base_url_ ? |
83 (*google_base_url_) : GoogleURLTracker::GoogleURL().spec(); | 83 (*google_base_url_) : GoogleURLTracker::GoogleURL().spec(); |
84 } | 84 } |
85 | 85 |
86 std::string UIThreadSearchTermsData::GetApplicationLocale() const { | 86 std::string UIThreadSearchTermsData::GetApplicationLocale() const { |
87 DCHECK(!BrowserThread::IsWellKnownThread(BrowserThread::UI) || | 87 DCHECK(!BrowserThread::IsWellKnownThread(BrowserThread::UI) || |
88 BrowserThread::CurrentlyOn(BrowserThread::UI)); | 88 BrowserThread::CurrentlyOn(BrowserThread::UI)); |
89 return g_browser_process->GetApplicationLocale(); | 89 return g_browser_process->GetApplicationLocale(); |
90 } | 90 } |
91 | 91 |
92 #if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) | 92 #if defined(ENABLE_RLZ) |
93 string16 UIThreadSearchTermsData::GetRlzParameterValue() const { | 93 string16 UIThreadSearchTermsData::GetRlzParameterValue() const { |
94 DCHECK(!BrowserThread::IsWellKnownThread(BrowserThread::UI) || | 94 DCHECK(!BrowserThread::IsWellKnownThread(BrowserThread::UI) || |
95 BrowserThread::CurrentlyOn(BrowserThread::UI)); | 95 BrowserThread::CurrentlyOn(BrowserThread::UI)); |
96 string16 rlz_string; | 96 string16 rlz_string; |
97 // For organic brandcodes do not use rlz at all. Empty brandcode usually | 97 // For organic brandcodes do not use rlz at all. Empty brandcode usually |
98 // means a chromium install. This is ok. | 98 // means a chromium install. This is ok. |
99 std::string brand; | 99 std::string brand; |
100 if (google_util::GetBrand(&brand) && !brand.empty() && | 100 if (google_util::GetBrand(&brand) && !brand.empty() && |
101 !google_util::IsOrganic(brand)) { | 101 !google_util::IsOrganic(brand)) { |
102 // This call will return false the first time(s) it is called until the | 102 // This call will return false the first time(s) it is called until the |
(...skipping 17 matching lines...) Expand all Loading... |
120 DCHECK(!BrowserThread::IsWellKnownThread(BrowserThread::UI) || | 120 DCHECK(!BrowserThread::IsWellKnownThread(BrowserThread::UI) || |
121 BrowserThread::CurrentlyOn(BrowserThread::UI)); | 121 BrowserThread::CurrentlyOn(BrowserThread::UI)); |
122 return InstantFieldTrial::GetGroupAsUrlParam(profile_); | 122 return InstantFieldTrial::GetGroupAsUrlParam(profile_); |
123 } | 123 } |
124 | 124 |
125 // static | 125 // static |
126 void UIThreadSearchTermsData::SetGoogleBaseURL(std::string* google_base_url) { | 126 void UIThreadSearchTermsData::SetGoogleBaseURL(std::string* google_base_url) { |
127 delete google_base_url_; | 127 delete google_base_url_; |
128 google_base_url_ = google_base_url; | 128 google_base_url_ = google_base_url; |
129 } | 129 } |
OLD | NEW |