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

Side by Side Diff: chrome/browser/signin/chrome_signin_helper.cc

Issue 2258483002: X-Chrome-Connected is stripped when it should not be in headers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
OLDNEW
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 #include "chrome/browser/signin/chrome_signin_helper.h" 5 #include "chrome/browser/signin/chrome_signin_helper.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "chrome/browser/prefs/incognito_mode_prefs.h" 9 #include "chrome/browser/prefs/incognito_mode_prefs.h"
10 #include "chrome/browser/profiles/profile_io_data.h" 10 #include "chrome/browser/profiles/profile_io_data.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 ManageAccountsParams empty_params; 111 ManageAccountsParams empty_params;
112 empty_params.service_type = GAIA_SERVICE_TYPE_NONE; 112 empty_params.service_type = GAIA_SERVICE_TYPE_NONE;
113 return empty_params; 113 return empty_params;
114 } 114 }
115 115
116 return BuildManageAccountsParamsIfExists(request, io_data->IsOffTheRecord()); 116 return BuildManageAccountsParamsIfExists(request, io_data->IsOffTheRecord());
117 } 117 }
118 118
119 } // namespace 119 } // namespace
120 120
121 bool AppendMirrorRequestHeaderHelper(net::URLRequest* request, 121 bool FixMirrorRequestHeaderHelper(net::URLRequest* request,
eroman 2016/08/23 20:02:36 style -- fix indentation
Ramin Halavati 2016/08/26 17:04:31 Done.
122 const GURL& redirect_url, 122 const GURL& redirect_url,
123 ProfileIOData* io_data, 123 ProfileIOData* io_data,
124 int child_id, 124 int child_id,
125 int route_id) { 125 int route_id) {
126 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 126 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
127 127
128 if (io_data->IsOffTheRecord()) 128 if (io_data->IsOffTheRecord())
129 return false; 129 return false;
130 130
131 #if !defined(OS_ANDROID) 131 #if !defined(OS_ANDROID)
132 extensions::WebViewRendererState::WebViewInfo webview_info; 132 extensions::WebViewRendererState::WebViewInfo webview_info;
133 bool is_guest = extensions::WebViewRendererState::GetInstance()->GetInfo( 133 bool is_guest = extensions::WebViewRendererState::GetInstance()->GetInfo(
134 child_id, route_id, &webview_info); 134 child_id, route_id, &webview_info);
135 // Do not set the x-chrome-connected header on requests from a native signin 135 // Do not set the x-chrome-connected header on requests from a native signin
136 // webview, as identified by an empty extension id which means the webview is 136 // webview, as identified by an empty extension id which means the webview is
137 // embedded in a webui page, otherwise user may end up with a blank page as 137 // embedded in a webui page, otherwise user may end up with a blank page as
138 // gaia uses the header to decide whether it returns 204 for certain end 138 // gaia uses the header to decide whether it returns 204 for certain end
139 // points. 139 // points.
140 if (is_guest && webview_info.owner_host.empty()) 140 if (is_guest && webview_info.owner_host.empty())
141 return false; 141 return false;
142 #endif // !defined(OS_ANDROID) 142 #endif // !defined(OS_ANDROID)
143 143
144 int profile_mode_mask = PROFILE_MODE_DEFAULT; 144 int profile_mode_mask = PROFILE_MODE_DEFAULT;
145 if (io_data->incognito_availibility()->GetValue() == 145 if (io_data->incognito_availibility()->GetValue() ==
146 IncognitoModePrefs::DISABLED || 146 IncognitoModePrefs::DISABLED ||
147 IncognitoModePrefs::ArePlatformParentalControlsEnabled()) { 147 IncognitoModePrefs::ArePlatformParentalControlsEnabled()) {
148 profile_mode_mask |= PROFILE_MODE_INCOGNITO_DISABLED; 148 profile_mode_mask |= PROFILE_MODE_INCOGNITO_DISABLED;
149 } 149 }
150 150
151 return AppendMirrorRequestHeaderIfPossible( 151 if (AppendMirrorRequestHeaderIfPossible(
152 request, redirect_url, io_data->google_services_account_id()->GetValue(), 152 request, redirect_url,
153 io_data->GetCookieSettings(), profile_mode_mask); 153 io_data->google_services_account_id()->GetValue(),
154 io_data->GetCookieSettings(), profile_mode_mask))
mmenke 2016/08/23 20:34:16 AppendMirrorRequestHeaderIfPossible seems problema
mmenke 2016/08/23 20:44:52 And this also assumes all Google.* TLDs are owned
Ramin Halavati 2016/08/26 17:04:31 I have added a test for content::IsOriginSecure an
Ramin Halavati 2016/08/26 17:04:31 I think this is a bigger issue of google_util::IsG
mmenke 2016/08/26 17:42:20 My feeling is that we should not rely on it for an
155 return true;
156
157 request->RemoveRequestHeaderByName(signin::kChromeConnectedHeader);
eroman 2016/08/23 20:02:36 This doesn't seem right. This code is called for
Ramin Halavati 2016/08/26 17:04:31 It's updated so that it is removed only when it is
158 return false;
154 } 159 }
155 160
156 void ProcessMirrorResponseHeaderIfExists(net::URLRequest* request, 161 void ProcessMirrorResponseHeaderIfExists(net::URLRequest* request,
157 ProfileIOData* io_data, 162 ProfileIOData* io_data,
158 int child_id, 163 int child_id,
159 int route_id) { 164 int route_id) {
160 ManageAccountsParams params = 165 ManageAccountsParams params =
161 BuildManageAccountsParamsHelper(request, io_data); 166 BuildManageAccountsParamsHelper(request, io_data);
162 if (params.service_type == GAIA_SERVICE_TYPE_NONE) 167 if (params.service_type == GAIA_SERVICE_TYPE_NONE)
163 return; 168 return;
164 169
165 params.child_id = child_id; 170 params.child_id = child_id;
166 params.route_id = route_id; 171 params.route_id = route_id;
167 content::BrowserThread::PostTask( 172 content::BrowserThread::PostTask(
168 content::BrowserThread::UI, FROM_HERE, 173 content::BrowserThread::UI, FROM_HERE,
169 base::Bind(ProcessMirrorHeaderUIThread, child_id, route_id, params)); 174 base::Bind(ProcessMirrorHeaderUIThread, child_id, route_id, params));
170 } 175 }
171 176
172 } // namespace signin 177 } // namespace signin
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698