| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SIGNIN_CORE_BROWSER_SIGNIN_HEADER_HELPER_H_ | 5 #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_HEADER_HELPER_H_ |
| 6 #define COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_HEADER_HELPER_H_ | 6 #define COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_HEADER_HELPER_H_ |
| 7 | 7 |
| 8 #include <map> |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "build/build_config.h" // For OS_IOS | 11 #include "build/build_config.h" |
| 11 | 12 |
| 12 namespace content_settings { | 13 namespace content_settings { |
| 13 class CookieSettings; | 14 class CookieSettings; |
| 14 } | 15 } |
| 15 | 16 |
| 16 namespace net { | 17 namespace net { |
| 17 class URLRequest; | 18 class URLRequest; |
| 18 } | 19 } |
| 19 | 20 |
| 20 class GURL; | 21 class GURL; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 const char* header_name, | 82 const char* header_name, |
| 82 const GURL& redirect_url, | 83 const GURL& redirect_url, |
| 83 const std::string& account_id, | 84 const std::string& account_id, |
| 84 const content_settings::CookieSettings* cookie_settings, | 85 const content_settings::CookieSettings* cookie_settings, |
| 85 int profile_mode_mask); | 86 int profile_mode_mask); |
| 86 | 87 |
| 87 protected: | 88 protected: |
| 88 SigninHeaderHelper() {} | 89 SigninHeaderHelper() {} |
| 89 virtual ~SigninHeaderHelper() {} | 90 virtual ~SigninHeaderHelper() {} |
| 90 | 91 |
| 92 // Dictionary of fields in a account consistency response header. |
| 93 using ResponseHeaderDictionary = std::map<std::string, std::string>; |
| 94 |
| 95 // Parses the account consistency response header. Its expected format is |
| 96 // "key1=value1,key2=value2,...". |
| 97 static ResponseHeaderDictionary ParseAccountConsistencyResponseHeader( |
| 98 const std::string& header_value); |
| 99 |
| 91 // Returns the value of the request header, or empty if the header should not | 100 // Returns the value of the request header, or empty if the header should not |
| 92 // be added. Calls into BuildRequestHeader() which is customized by | 101 // be added. Calls into BuildRequestHeader() which is customized by |
| 93 // subclasses. | 102 // subclasses. |
| 94 std::string BuildRequestHeaderIfPossible( | 103 std::string BuildRequestHeaderIfPossible( |
| 95 bool is_header_request, | 104 bool is_header_request, |
| 96 const GURL& url, | 105 const GURL& url, |
| 97 const std::string& account_id, | 106 const std::string& account_id, |
| 98 const content_settings::CookieSettings* cookie_settings, | 107 const content_settings::CookieSettings* cookie_settings, |
| 99 int profile_mode_mask); | 108 int profile_mode_mask); |
| 100 | 109 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 130 net::URLRequest* request, | 139 net::URLRequest* request, |
| 131 const GURL& redirect_url, | 140 const GURL& redirect_url, |
| 132 const std::string& account_id, | 141 const std::string& account_id, |
| 133 const content_settings::CookieSettings* cookie_settings, | 142 const content_settings::CookieSettings* cookie_settings, |
| 134 int profile_mode_mask); | 143 int profile_mode_mask); |
| 135 | 144 |
| 136 // Returns the parameters contained in the X-Chrome-Manage-Accounts response | 145 // Returns the parameters contained in the X-Chrome-Manage-Accounts response |
| 137 // header. | 146 // header. |
| 138 ManageAccountsParams BuildManageAccountsParams(const std::string& header_value); | 147 ManageAccountsParams BuildManageAccountsParams(const std::string& header_value); |
| 139 | 148 |
| 140 // Returns the parameters contained in the X-Chrome-Manage-Accounts response | |
| 141 // header. | |
| 142 // If the request does not have a response header or if the header contains | |
| 143 // garbage, then |service_type| is set to |GAIA_SERVICE_TYPE_NONE|. | |
| 144 ManageAccountsParams BuildManageAccountsParamsIfExists(net::URLRequest* request, | |
| 145 bool is_off_the_record); | |
| 146 | |
| 147 } // namespace signin | 149 } // namespace signin |
| 148 | 150 |
| 149 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_HEADER_HELPER_H_ | 151 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_HEADER_HELPER_H_ |
| OLD | NEW |