| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/google_util.h" | 5 #include "chrome/browser/google_util.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 repl.SetQueryStr(query); | 26 repl.SetQueryStr(query); |
| 27 return url.ReplaceComponents(repl); | 27 return url.ReplaceComponents(repl); |
| 28 } | 28 } |
| 29 | 29 |
| 30 } // anonymous namespace | 30 } // anonymous namespace |
| 31 | 31 |
| 32 namespace google_util { | 32 namespace google_util { |
| 33 | 33 |
| 34 GURL AppendGoogleLocaleParam(const GURL& url) { | 34 GURL AppendGoogleLocaleParam(const GURL& url) { |
| 35 return AppendParam(url, "hl", | 35 return AppendParam(url, "hl", |
| 36 WideToUTF8(g_browser_process->GetApplicationLocale())); | 36 g_browser_process->GetApplicationLocale()); |
| 37 } | 37 } |
| 38 | 38 |
| 39 GURL AppendGoogleTLDParam(const GURL& url) { | 39 GURL AppendGoogleTLDParam(const GURL& url) { |
| 40 const std::string google_domain( | 40 const std::string google_domain( |
| 41 net::RegistryControlledDomainService::GetDomainAndRegistry( | 41 net::RegistryControlledDomainService::GetDomainAndRegistry( |
| 42 GoogleURLTracker::GoogleURL())); | 42 GoogleURLTracker::GoogleURL())); |
| 43 const size_t first_dot = google_domain.find('.'); | 43 const size_t first_dot = google_domain.find('.'); |
| 44 if (first_dot == std::string::npos) { | 44 if (first_dot == std::string::npos) { |
| 45 NOTREACHED(); | 45 NOTREACHED(); |
| 46 return url; | 46 return url; |
| 47 } | 47 } |
| 48 return AppendParam(url, "sd", google_domain.substr(first_dot + 1)); | 48 return AppendParam(url, "sd", google_domain.substr(first_dot + 1)); |
| 49 } | 49 } |
| 50 | 50 |
| 51 } // namespace google_util | 51 } // namespace google_util |
| OLD | NEW |