| 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/google/google_util.h" | 5 #include "chrome/browser/google/google_util.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/strings/string_split.h" | 13 #include "base/strings/string_split.h" |
| 14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/browser/google/google_url_tracker.h" | 17 #include "chrome/browser/google/google_url_tracker.h" |
| 18 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
| 19 #include "chrome/installer/util/google_update_settings.h" | 19 #include "chrome/installer/util/google_update_settings.h" |
| 20 #include "content/public/browser/navigation_entry.h" |
| 21 #include "content/public/common/page_transition_types.h" |
| 20 #include "googleurl/src/gurl.h" | 22 #include "googleurl/src/gurl.h" |
| 21 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 23 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| 22 #include "net/base/url_util.h" | 24 #include "net/base/url_util.h" |
| 23 | 25 |
| 24 #if defined(OS_MACOSX) | 26 #if defined(OS_MACOSX) |
| 25 #include "chrome/browser/mac/keystone_glue.h" | 27 #include "chrome/browser/mac/keystone_glue.h" |
| 26 #elif defined(OS_CHROMEOS) | 28 #elif defined(OS_CHROMEOS) |
| 27 #include "chrome/browser/google/google_util_chromeos.h" | 29 #include "chrome/browser/google/google_util_chromeos.h" |
| 28 #endif | 30 #endif |
| 29 | 31 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 return true; | 147 return true; |
| 146 } | 148 } |
| 147 | 149 |
| 148 bool GetReactivationBrand(std::string* brand) { | 150 bool GetReactivationBrand(std::string* brand) { |
| 149 brand->clear(); | 151 brand->clear(); |
| 150 return true; | 152 return true; |
| 151 } | 153 } |
| 152 | 154 |
| 153 #endif | 155 #endif |
| 154 | 156 |
| 157 bool IsOmniboxGoogleSearchNavigation(const content::NavigationEntry& entry) { |
| 158 const content::PageTransition stripped_transition = |
| 159 PageTransitionStripQualifier(entry.GetTransitionType()); |
| 160 DCHECK(IsGoogleSearchUrl(entry.GetURL().spec())); |
| 161 return stripped_transition == content::PAGE_TRANSITION_GENERATED; |
| 162 } |
| 163 |
| 155 bool IsGoogleDomainUrl(const std::string& url, | 164 bool IsGoogleDomainUrl(const std::string& url, |
| 156 SubdomainPermission subdomain_permission, | 165 SubdomainPermission subdomain_permission, |
| 157 PortPermission port_permission) { | 166 PortPermission port_permission) { |
| 158 GURL original_url(url); | 167 GURL original_url(url); |
| 159 if (!original_url.is_valid() || | 168 if (!original_url.is_valid() || |
| 160 !(original_url.SchemeIs("http") || original_url.SchemeIs("https"))) | 169 !(original_url.SchemeIs("http") || original_url.SchemeIs("https"))) |
| 161 return false; | 170 return false; |
| 162 | 171 |
| 163 // If we have the Instant URL overridden with a command line flag, accept | 172 // If we have the Instant URL overridden with a command line flag, accept |
| 164 // its domain/port combination as well. | 173 // its domain/port combination as well. |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 const char* const kBrands[] = { | 303 const char* const kBrands[] = { |
| 295 "CHIQ", "CHSG", "HLJY", "NTMO", "OOBA", "OOBB", "OOBC", "OOBD", "OOBE", | 304 "CHIQ", "CHSG", "HLJY", "NTMO", "OOBA", "OOBB", "OOBC", "OOBD", "OOBE", |
| 296 "OOBF", "OOBG", "OOBH", "OOBI", "OOBJ", "IDCM", | 305 "OOBF", "OOBG", "OOBH", "OOBI", "OOBJ", "IDCM", |
| 297 }; | 306 }; |
| 298 const char* const* end = &kBrands[arraysize(kBrands)]; | 307 const char* const* end = &kBrands[arraysize(kBrands)]; |
| 299 const char* const* found = std::find(&kBrands[0], end, brand); | 308 const char* const* found = std::find(&kBrands[0], end, brand); |
| 300 return found != end; | 309 return found != end; |
| 301 } | 310 } |
| 302 | 311 |
| 303 } // namespace google_util | 312 } // namespace google_util |
| OLD | NEW |