| 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 // Some Google related utility functions. | 5 // Some Google related utility functions. |
| 6 | 6 |
| 7 #ifndef CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ | 7 #ifndef CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ |
| 8 #define CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ | 8 #define CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 | 13 |
| 14 namespace content { |
| 15 class NavigationEntry; |
| 16 } |
| 17 |
| 14 class GURL; | 18 class GURL; |
| 15 class Profile; | 19 class Profile; |
| 16 | 20 |
| 17 // This namespace provides various helpers around handling Google-related URLs | 21 // This namespace provides various helpers around handling Google-related URLs |
| 18 // and state relating to Google Chrome distributions (such as RLZ). | 22 // and state relating to Google Chrome distributions (such as RLZ). |
| 19 namespace google_util { | 23 namespace google_util { |
| 20 | 24 |
| 21 // True iff |str| contains a "q=" query parameter with a non-empty value. | 25 // True iff |str| contains a "q=" query parameter with a non-empty value. |
| 22 // |str| should be a query or a hash fragment, without the ? or # (as | 26 // |str| should be a query or a hash fragment, without the ? or # (as |
| 23 // returned by GURL::query() or GURL::ref(). | 27 // returned by GURL::query() or GURL::ref(). |
| (...skipping 18 matching lines...) Expand all Loading... |
| 42 | 46 |
| 43 // Returns in |brand| the brand code or distribution tag that has been | 47 // Returns in |brand| the brand code or distribution tag that has been |
| 44 // assigned to a partner. Returns false if the information is not available. | 48 // assigned to a partner. Returns false if the information is not available. |
| 45 bool GetBrand(std::string* brand); | 49 bool GetBrand(std::string* brand); |
| 46 | 50 |
| 47 // Returns in |brand| the reactivation brand code or distribution tag | 51 // Returns in |brand| the reactivation brand code or distribution tag |
| 48 // that has been assigned to a partner for reactivating a dormant chrome | 52 // that has been assigned to a partner for reactivating a dormant chrome |
| 49 // install. Returns false if the information is not available. | 53 // install. Returns false if the information is not available. |
| 50 bool GetReactivationBrand(std::string* brand); | 54 bool GetReactivationBrand(std::string* brand); |
| 51 | 55 |
| 56 // Returns true iff |entry| represents a Google search from the Omnibox. |
| 57 // This method assumes that we have already verified that |entry|'s URL is a |
| 58 // Google search URL. |
| 59 bool IsOmniboxGoogleSearchNavigation(const content::NavigationEntry& entry); |
| 60 |
| 52 // WARNING: The following IsGoogleXXX() functions use heuristics to rule out | 61 // WARNING: The following IsGoogleXXX() functions use heuristics to rule out |
| 53 // "obviously false" answers. They do NOT guarantee that the string in question | 62 // "obviously false" answers. They do NOT guarantee that the string in question |
| 54 // is actually on a Google-owned domain, just that it looks plausible. If you | 63 // is actually on a Google-owned domain, just that it looks plausible. If you |
| 55 // need to restrict some behavior to only happen on Google's officially-owned | 64 // need to restrict some behavior to only happen on Google's officially-owned |
| 56 // domains, use TransportSecurityState::IsGooglePinnedProperty() instead. | 65 // domains, use TransportSecurityState::IsGooglePinnedProperty() instead. |
| 57 | 66 |
| 58 // Designate whether or not a URL checking function also checks for specific | 67 // Designate whether or not a URL checking function also checks for specific |
| 59 // subdomains, or only "www" and empty subdomains. | 68 // subdomains, or only "www" and empty subdomains. |
| 60 enum SubdomainPermission { | 69 enum SubdomainPermission { |
| 61 ALLOW_SUBDOMAIN, | 70 ALLOW_SUBDOMAIN, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 ~BrandForTesting(); | 114 ~BrandForTesting(); |
| 106 | 115 |
| 107 private: | 116 private: |
| 108 std::string brand_; | 117 std::string brand_; |
| 109 DISALLOW_COPY_AND_ASSIGN(BrandForTesting); | 118 DISALLOW_COPY_AND_ASSIGN(BrandForTesting); |
| 110 }; | 119 }; |
| 111 | 120 |
| 112 } // namespace google_util | 121 } // namespace google_util |
| 113 | 122 |
| 114 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ | 123 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ |
| OLD | NEW |