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

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

Issue 120343004: Reland r242290, r241609, r242134. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
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 "base/command_line.h"
8 #include "chrome/browser/extensions/extension_renderer_state.h" 7 #include "chrome/browser/extensions/extension_renderer_state.h"
9 #include "chrome/browser/profiles/profile_io_data.h" 8 #include "chrome/browser/profiles/profile_io_data.h"
10 #include "chrome/browser/tab_contents/tab_util.h" 9 #include "chrome/browser/tab_contents/tab_util.h"
11 #include "chrome/browser/ui/browser_finder.h" 10 #include "chrome/browser/ui/browser_finder.h"
12 #include "chrome/browser/ui/browser_window.h" 11 #include "chrome/browser/ui/browser_window.h"
13 #include "chrome/common/profile_management_switches.h" 12 #include "chrome/common/profile_management_switches.h"
14 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
15 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
16 #include "google_apis/gaia/gaia_auth_util.h" 15 #include "google_apis/gaia/gaia_auth_util.h"
17 #include "net/http/http_response_headers.h" 16 #include "net/http/http_response_headers.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 return; 65 return;
67 } 66 }
68 67
69 // Only set the header for Gaia (in the mirror world) and Drive. Gaia needs 68 // Only set the header for Gaia (in the mirror world) and Drive. Gaia needs
70 // the header to redirect certain user actions to Chrome native UI. Drive 69 // the header to redirect certain user actions to Chrome native UI. Drive
71 // needs the header to tell if the current user is connected. The drive path 70 // needs the header to tell if the current user is connected. The drive path
72 // is a temporary workaround until the more generic chrome.principals API is 71 // is a temporary workaround until the more generic chrome.principals API is
73 // available. 72 // available.
74 const GURL& url = redirect_url.is_empty() ? request->url() : redirect_url; 73 const GURL& url = redirect_url.is_empty() ? request->url() : redirect_url;
75 GURL origin(url.GetOrigin()); 74 GURL origin(url.GetOrigin());
76 bool is_gaia_signin = !switches::IsEnableInlineSignin() && 75 bool is_gaia_origin = switches::IsEnableInlineSignin() &&
77 switches::IsNewProfileManagement() && 76 switches::IsNewProfileManagement() &&
78 gaia::IsGaiaSignonRealm(origin); 77 gaia::IsGaiaSignonRealm(origin);
79 if (!is_gaia_signin && !IsDriveOrigin(origin)) 78 if (!is_gaia_origin && !IsDriveOrigin(origin))
80 return; 79 return;
81 80
82 ExtensionRendererState* renderer_state = 81 ExtensionRendererState* renderer_state =
83 ExtensionRendererState::GetInstance(); 82 ExtensionRendererState::GetInstance();
84 ExtensionRendererState::WebViewInfo webview_info; 83 ExtensionRendererState::WebViewInfo webview_info;
85 bool is_guest = renderer_state->GetWebViewInfo( 84 bool is_guest = renderer_state->GetWebViewInfo(
86 child_id, route_id, &webview_info); 85 child_id, route_id, &webview_info);
87 if (is_guest && webview_info.extension_id == kGaiaAuthExtensionID){ 86 if (is_guest && webview_info.extension_id == kGaiaAuthExtensionID){
88 return; 87 return;
89 } 88 }
(...skipping 17 matching lines...) Expand all
107 request->response_headers()->HasHeader(kChromeManageAccountsHeader)) { 106 request->response_headers()->HasHeader(kChromeManageAccountsHeader)) {
108 DCHECK(switches::IsNewProfileManagement() && 107 DCHECK(switches::IsNewProfileManagement() &&
109 !io_data->is_incognito()); 108 !io_data->is_incognito());
110 content::BrowserThread::PostTask( 109 content::BrowserThread::PostTask(
111 content::BrowserThread::UI, FROM_HERE, 110 content::BrowserThread::UI, FROM_HERE,
112 base::Bind(ShowAvatarBubbleUIThread, child_id, route_id)); 111 base::Bind(ShowAvatarBubbleUIThread, child_id, route_id));
113 } 112 }
114 } 113 }
115 114
116 } // namespace signin 115 } // namespace signin
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698