Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: chrome/browser/google/google_util.h

Issue 10908028: Allow the X-Chrome-Variations header to transmit to all ports. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fix up some tests Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/google/google_url_tracker.cc ('k') | chrome/browser/google/google_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // need to restrict some behavior to only happen on Google's officially-owned 51 // need to restrict some behavior to only happen on Google's officially-owned
52 // domains, use TransportSecurityState::IsGooglePinnedProperty() instead. 52 // domains, use TransportSecurityState::IsGooglePinnedProperty() instead.
53 53
54 // Designate whether or not a URL checking function also checks for specific 54 // Designate whether or not a URL checking function also checks for specific
55 // subdomains, or only "www" and empty subdomains. 55 // subdomains, or only "www" and empty subdomains.
56 enum SubdomainPermission { 56 enum SubdomainPermission {
57 ALLOW_SUBDOMAIN, 57 ALLOW_SUBDOMAIN,
58 DISALLOW_SUBDOMAIN, 58 DISALLOW_SUBDOMAIN,
59 }; 59 };
60 60
61 // True if |url| is an HTTP[S] request with host "[www.]google.<TLD>" and no 61 // Designate whether or not a URL checking function also checks for standard
62 // explicit port. If |permission| is ALLOW_SUBDOMAIN, we check against host 62 // ports (80 for http, 443 for https), or if it allows all port numbers.
Ilya Sherman 2012/08/31 03:05:42 This isn't quite right -- http://www.google.com:80
SteveT 2012/08/31 13:29:31 So the GURL code actually parses out port 80 on ht
Ilya Sherman 2012/08/31 19:26:52 Ah, ok, lovely :)
SteveT 2012/08/31 21:58:17 Sounds good!
63 enum PortPermission {
64 ALLOW_ALL_PORTS,
65 ALLOW_STANDARD_PORTS,
Ilya Sherman 2012/08/31 03:05:42 nit: Perhaps these should be ALLOW_EXPLICIT_PORTS
SteveT 2012/08/31 13:29:31 See comments above... they sort of explain why I u
Ilya Sherman 2012/08/31 19:26:52 Ok. I still think it's useful to frame this as al
SteveT 2012/08/31 21:58:17 Done.
66 };
67
68 // True if |url| is an HTTP[S] request with host "[www.]google.<TLD>". If
69 // |subdomain_permission| is ALLOW_SUBDOMAIN, we check against host
70 // "*.google.<TLD>" instead. If |port_permission| is ALLOW_STANDARD_PORTS, we
71 // disallow explicit ports.
SteveT 2012/08/31 13:29:31 I guess we could change this comment up if the wor
72 bool IsGoogleDomainUrl(const std::string& url,
73 SubdomainPermission subdomain_permission,
74 PortPermission port_permission);
75 // True if |host| is "[www.]google.<TLD>" with a valid TLD. If
76 // |subdomain_permission| is ALLOW_SUBDOMAIN, we check against host
63 // "*.google.<TLD>" instead. 77 // "*.google.<TLD>" instead.
64 bool IsGoogleDomainUrl(const std::string& url, SubdomainPermission permission); 78 bool IsGoogleHostname(const std::string& host,
65 // True if |host| is "[www.]google.<TLD>" with a valid TLD. If 79 SubdomainPermission subdomain_permission);
66 // |permission| is ALLOW_SUBDOMAIN, we check against host "*.google.<TLD>"
67 // instead.
68 bool IsGoogleHostname(const std::string& host, SubdomainPermission permission);
69 // True if |url| represents a valid Google home page URL. 80 // True if |url| represents a valid Google home page URL.
70 bool IsGoogleHomePageUrl(const std::string& url); 81 bool IsGoogleHomePageUrl(const std::string& url);
71 // True if |url| represents a valid Google search URL. 82 // True if |url| represents a valid Google search URL.
72 bool IsGoogleSearchUrl(const std::string& url); 83 bool IsGoogleSearchUrl(const std::string& url);
73 // True if |url| represents a valid Google search URL used by the Instant 84 // True if |url| represents a valid Google search URL used by the Instant
74 // Extended API. 85 // Extended API.
75 bool IsInstantExtendedAPIGoogleSearchUrl(const std::string& url); 86 bool IsInstantExtendedAPIGoogleSearchUrl(const std::string& url);
76 87
77 // True if a build is strictly organic, according to its brand code. 88 // True if a build is strictly organic, according to its brand code.
78 bool IsOrganic(const std::string& brand); 89 bool IsOrganic(const std::string& brand);
(...skipping 14 matching lines...) Expand all
93 ~BrandForTesting(); 104 ~BrandForTesting();
94 105
95 private: 106 private:
96 std::string brand_; 107 std::string brand_;
97 DISALLOW_COPY_AND_ASSIGN(BrandForTesting); 108 DISALLOW_COPY_AND_ASSIGN(BrandForTesting);
98 }; 109 };
99 110
100 } // namespace google_util 111 } // namespace google_util
101 112
102 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ 113 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__
OLDNEW
« no previous file with comments | « chrome/browser/google/google_url_tracker.cc ('k') | chrome/browser/google/google_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698