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

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

Issue 187703004: Enables x-chrome-connected header for all google properties (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/signin_header_helper.h" 5 #include "chrome/browser/signin/signin_header_helper.h"
6 6
7 #include "chrome/browser/extensions/extension_renderer_state.h" 7 #include "chrome/browser/extensions/extension_renderer_state.h"
8 #include "chrome/browser/google/google_util.h"
8 #include "chrome/browser/profiles/profile_io_data.h" 9 #include "chrome/browser/profiles/profile_io_data.h"
9 #include "chrome/browser/tab_contents/tab_util.h" 10 #include "chrome/browser/tab_contents/tab_util.h"
10 #include "chrome/browser/ui/browser_finder.h" 11 #include "chrome/browser/ui/browser_finder.h"
11 #include "chrome/browser/ui/browser_window.h" 12 #include "chrome/browser/ui/browser_window.h"
12 #include "chrome/common/profile_management_switches.h" 13 #include "chrome/common/profile_management_switches.h"
13 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
14 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
15 #include "google_apis/gaia/gaia_auth_util.h" 16 #include "google_apis/gaia/gaia_auth_util.h"
16 #include "net/http/http_response_headers.h" 17 #include "net/http/http_response_headers.h"
17 #include "net/url_request/url_request.h" 18 #include "net/url_request/url_request.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 ProfileIOData* io_data, 66 ProfileIOData* io_data,
66 int child_id, 67 int child_id,
67 int route_id) { 68 int route_id) {
68 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 69 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
69 70
70 if (io_data->is_incognito() || 71 if (io_data->is_incognito() ||
71 io_data->google_services_username()->GetValue().empty()) { 72 io_data->google_services_username()->GetValue().empty()) {
72 return; 73 return;
73 } 74 }
74 75
75 // Only set the header for Gaia (in the mirror world) and Drive. Gaia needs 76 // Only set the header for Drive always, and other Google properties if
76 // the header to redirect certain user actions to Chrome native UI. Drive 77 // new-profile-management is enabled.
77 // needs the header to tell if the current user is connected. The drive path 78 // Vasquette, which is integrated with most Google properties, needs the
78 // is a temporary workaround until the more generic chrome.principals API is 79 // header to redirect certain user actions to Chrome native UI. Drive needs
80 // the header to tell if the current user is connected. The drive path is a
81 // temporary workaround until the more generic chrome.principals API is
79 // available. 82 // available.
80 const GURL& url = redirect_url.is_empty() ? request->url() : redirect_url; 83 const GURL& url = redirect_url.is_empty() ? request->url() : redirect_url;
81 GURL origin(url.GetOrigin()); 84 GURL origin(url.GetOrigin());
82 bool is_gaia_origin = !switches::IsEnableWebBasedSignin() && 85 bool is_google_url =
86 !switches::IsEnableWebBasedSignin() &&
83 switches::IsNewProfileManagement() && 87 switches::IsNewProfileManagement() &&
84 gaia::IsGaiaSignonRealm(origin); 88 google_util::IsGoogleDomainUrl(
85 if (!is_gaia_origin && !IsDriveOrigin(origin)) 89 url,
90 google_util::ALLOW_SUBDOMAIN,
91 google_util::DISALLOW_NON_STANDARD_PORTS);
92 if (!is_google_url && !IsDriveOrigin(origin))
86 return; 93 return;
87 94
88 ExtensionRendererState* renderer_state = 95 ExtensionRendererState* renderer_state =
89 ExtensionRendererState::GetInstance(); 96 ExtensionRendererState::GetInstance();
90 ExtensionRendererState::WebViewInfo webview_info; 97 ExtensionRendererState::WebViewInfo webview_info;
91 bool is_guest = renderer_state->GetWebViewInfo( 98 bool is_guest = renderer_state->GetWebViewInfo(
92 child_id, route_id, &webview_info); 99 child_id, route_id, &webview_info);
93 if (is_guest && webview_info.embedder_extension_id == kGaiaAuthExtensionID){ 100 if (is_guest && webview_info.embedder_extension_id == kGaiaAuthExtensionID){
94 return; 101 return;
95 } 102 }
(...skipping 17 matching lines...) Expand all
113 request->response_headers()->HasHeader(kChromeManageAccountsHeader)) { 120 request->response_headers()->HasHeader(kChromeManageAccountsHeader)) {
114 DCHECK(switches::IsNewProfileManagement() && 121 DCHECK(switches::IsNewProfileManagement() &&
115 !io_data->is_incognito()); 122 !io_data->is_incognito());
116 content::BrowserThread::PostTask( 123 content::BrowserThread::PostTask(
117 content::BrowserThread::UI, FROM_HERE, 124 content::BrowserThread::UI, FROM_HERE,
118 base::Bind(ShowAvatarBubbleUIThread, child_id, route_id)); 125 base::Bind(ShowAvatarBubbleUIThread, child_id, route_id));
119 } 126 }
120 } 127 }
121 128
122 } // namespace signin 129 } // namespace signin
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698