| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_PARAMS_H_ | 5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_PARAMS_H_ |
| 6 #define COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_PARAMS_H_ | 6 #define COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_PARAMS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 // Given |allowed_|, |fallback_allowed_|, and |alt_allowed_|, returns the | 154 // Given |allowed_|, |fallback_allowed_|, and |alt_allowed_|, returns the |
| 155 // list of data reduction proxies that may be used. | 155 // list of data reduction proxies that may be used. |
| 156 DataReductionProxyList GetAllowedProxies() const; | 156 DataReductionProxyList GetAllowedProxies() const; |
| 157 | 157 |
| 158 // Returns true if any proxy origins are set on the command line. | 158 // Returns true if any proxy origins are set on the command line. |
| 159 bool is_configured_on_command_line() const { | 159 bool is_configured_on_command_line() const { |
| 160 return configured_on_command_line_; | 160 return configured_on_command_line_; |
| 161 } | 161 } |
| 162 | 162 |
| 163 // Returns the corresponding string from preprocessor constants if defined, |
| 164 // and an empty string otherwise. |
| 165 virtual std::string GetDefaultDevOrigin() const; |
| 166 virtual std::string GetDefaultOrigin() const; |
| 167 virtual std::string GetDefaultFallbackOrigin() const; |
| 168 virtual std::string GetDefaultSSLOrigin() const; |
| 169 virtual std::string GetDefaultAltOrigin() const; |
| 170 virtual std::string GetDefaultAltFallbackOrigin() const; |
| 171 virtual std::string GetDefaultProbeURL() const; |
| 172 virtual std::string GetDefaultWarmupURL() const; |
| 173 |
| 163 protected: | 174 protected: |
| 164 // Test constructor that optionally won't call Init(); | 175 // Test constructor that optionally won't call Init(); |
| 165 DataReductionProxyParams(int flags, | 176 DataReductionProxyParams(int flags, |
| 166 bool should_call_init); | 177 bool should_call_init); |
| 167 | 178 |
| 168 // Initialize the values of the proxies, and probe URL, from command | 179 // Initialize the values of the proxies, and probe URL, from command |
| 169 // line flags and preprocessor constants, and check that there are | 180 // line flags and preprocessor constants, and check that there are |
| 170 // corresponding definitions for the allowed configurations. | 181 // corresponding definitions for the allowed configurations. |
| 171 bool Init(bool allowed, bool fallback_allowed, bool alt_allowed); | 182 bool Init(bool allowed, bool fallback_allowed, bool alt_allowed); |
| 172 | 183 |
| 173 // Initialize the values of the proxies, and probe URL from command | 184 // Initialize the values of the proxies, and probe URL from command |
| 174 // line flags and preprocessor constants. | 185 // line flags and preprocessor constants. |
| 175 void InitWithoutChecks(); | 186 void InitWithoutChecks(); |
| 176 | 187 |
| 177 // Returns the corresponding string from preprocessor constants if defined, | |
| 178 // and an empty string otherwise. | |
| 179 virtual std::string GetDefaultDevOrigin() const; | |
| 180 virtual std::string GetDefaultOrigin() const; | |
| 181 virtual std::string GetDefaultFallbackOrigin() const; | |
| 182 virtual std::string GetDefaultSSLOrigin() const; | |
| 183 virtual std::string GetDefaultAltOrigin() const; | |
| 184 virtual std::string GetDefaultAltFallbackOrigin() const; | |
| 185 virtual std::string GetDefaultProbeURL() const; | |
| 186 virtual std::string GetDefaultWarmupURL() const; | |
| 187 | |
| 188 private: | 188 private: |
| 189 GURL origin_; | 189 GURL origin_; |
| 190 GURL fallback_origin_; | 190 GURL fallback_origin_; |
| 191 GURL ssl_origin_; | 191 GURL ssl_origin_; |
| 192 GURL alt_origin_; | 192 GURL alt_origin_; |
| 193 GURL alt_fallback_origin_; | 193 GURL alt_fallback_origin_; |
| 194 GURL probe_url_; | 194 GURL probe_url_; |
| 195 GURL warmup_url_; | 195 GURL warmup_url_; |
| 196 | 196 |
| 197 bool allowed_; | 197 bool allowed_; |
| 198 const bool fallback_allowed_; | 198 const bool fallback_allowed_; |
| 199 bool alt_allowed_; | 199 bool alt_allowed_; |
| 200 const bool promo_allowed_; | 200 const bool promo_allowed_; |
| 201 | 201 |
| 202 bool configured_on_command_line_; | 202 bool configured_on_command_line_; |
| 203 | 203 |
| 204 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyParams); | 204 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyParams); |
| 205 }; | 205 }; |
| 206 | 206 |
| 207 } // namespace data_reduction_proxy | 207 } // namespace data_reduction_proxy |
| 208 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_PARAMS_H
_ | 208 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_PARAMS_H
_ |
| OLD | NEW |