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

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 964553002: Remove support for special "sign in process" state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ocl3
Patch Set: rebased Created 5 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chrome_content_browser_client.h" 5 #include "chrome/browser/chrome_content_browser_client.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 #include "ui/base/ui_base_paths.h" 184 #include "ui/base/ui_base_paths.h"
185 #include "ui/gfx/android/device_display_info.h" 185 #include "ui/gfx/android/device_display_info.h"
186 #endif 186 #endif
187 187
188 #if defined(OS_ANDROID) 188 #if defined(OS_ANDROID)
189 #include "chrome/browser/android/dev_tools_manager_delegate_android.h" 189 #include "chrome/browser/android/dev_tools_manager_delegate_android.h"
190 #else 190 #else
191 #include "chrome/browser/devtools/chrome_devtools_manager_delegate.h" 191 #include "chrome/browser/devtools/chrome_devtools_manager_delegate.h"
192 #endif 192 #endif
193 193
194 #if !defined(OS_CHROMEOS)
195 #include "chrome/browser/signin/chrome_signin_client.h"
196 #include "chrome/browser/signin/chrome_signin_client_factory.h"
197 #include "chrome/browser/signin/signin_manager_factory.h"
198 #include "components/signin/core/browser/signin_manager.h"
199 #endif
200
201 #if defined(TOOLKIT_VIEWS) 194 #if defined(TOOLKIT_VIEWS)
202 #include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views.h" 195 #include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views.h"
203 #endif 196 #endif
204 197
205 #if defined(USE_ASH) 198 #if defined(USE_ASH)
206 #include "chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.h" 199 #include "chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.h"
207 #endif 200 #endif
208 201
209 #if defined(USE_AURA) 202 #if defined(USE_AURA)
210 #include "chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.h" 203 #include "chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.h"
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 static breakpad::CrashHandlerHostLinux* crash_handler = NULL; 494 static breakpad::CrashHandlerHostLinux* crash_handler = NULL;
502 if (!crash_handler) 495 if (!crash_handler)
503 crash_handler = CreateCrashHandlerHost(process_type); 496 crash_handler = CreateCrashHandlerHost(process_type);
504 return crash_handler->GetDeathSignalSocket(); 497 return crash_handler->GetDeathSignalSocket();
505 } 498 }
506 499
507 return -1; 500 return -1;
508 } 501 }
509 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) 502 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
510 503
511 #if !defined(OS_CHROMEOS)
512 GURL GetEffectiveURLForSignin(const GURL& url) {
513 CHECK(SigninManager::IsWebBasedSigninFlowURL(url));
514
515 GURL effective_url(SigninManager::kChromeSigninEffectiveSite);
516 // Copy the path because the argument to SetPathStr must outlive
517 // the Replacements object.
518 const std::string path_copy(url.path());
519 GURL::Replacements replacements;
520 replacements.SetPathStr(path_copy);
521 effective_url = effective_url.ReplaceComponents(replacements);
522 return effective_url;
523 }
524 #endif
525
526 void SetApplicationLocaleOnIOThread(const std::string& locale) { 504 void SetApplicationLocaleOnIOThread(const std::string& locale) {
527 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 505 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
528 g_io_thread_application_locale.Get() = locale; 506 g_io_thread_application_locale.Get() = locale;
529 } 507 }
530 508
531 void HandleBlockedPopupOnUIThread(const BlockedWindowParams& params) { 509 void HandleBlockedPopupOnUIThread(const BlockedWindowParams& params) {
532 // TODO(jochen): This code path should use RenderFrameHosts. See 510 // TODO(jochen): This code path should use RenderFrameHosts. See
533 // http://crbug.com/431769 for details. 511 // http://crbug.com/431769 for details.
534 RenderViewHost* render_view_host = 512 RenderViewHost* render_view_host =
535 RenderViewHost::FromID(params.render_process_id(), params.opener_id()); 513 RenderViewHost::FromID(params.render_process_id(), params.opener_id());
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 content::BrowserContext* browser_context, const GURL& url) { 949 content::BrowserContext* browser_context, const GURL& url) {
972 Profile* profile = Profile::FromBrowserContext(browser_context); 950 Profile* profile = Profile::FromBrowserContext(browser_context);
973 if (!profile) 951 if (!profile)
974 return url; 952 return url;
975 953
976 // If the input |url| should be assigned to the Instant renderer, make its 954 // If the input |url| should be assigned to the Instant renderer, make its
977 // effective URL distinct from other URLs on the search provider's domain. 955 // effective URL distinct from other URLs on the search provider's domain.
978 if (chrome::ShouldAssignURLToInstantRenderer(url, profile)) 956 if (chrome::ShouldAssignURLToInstantRenderer(url, profile))
979 return chrome::GetEffectiveURLForInstant(url, profile); 957 return chrome::GetEffectiveURLForInstant(url, profile);
980 958
981 #if !defined(OS_CHROMEOS)
982 // If the input |url| should be assigned to the Signin renderer, make its
983 // effective URL distinct from other URLs on the signin service's domain.
984 // Note that the signin renderer will be allowed to sign the user in to
985 // Chrome.
986 if (SigninManager::IsWebBasedSigninFlowURL(url))
987 return GetEffectiveURLForSignin(url);
988 #endif
989
990 #if defined(ENABLE_EXTENSIONS) 959 #if defined(ENABLE_EXTENSIONS)
991 return ChromeContentBrowserClientExtensionsPart::GetEffectiveURL( 960 return ChromeContentBrowserClientExtensionsPart::GetEffectiveURL(
992 profile, url); 961 profile, url);
993 #else 962 #else
994 return url; 963 return url;
995 #endif 964 #endif
996 } 965 }
997 966
998 bool ChromeContentBrowserClient::ShouldUseProcessPerSite( 967 bool ChromeContentBrowserClient::ShouldUseProcessPerSite(
999 content::BrowserContext* browser_context, const GURL& effective_url) { 968 content::BrowserContext* browser_context, const GURL& effective_url) {
1000 // Non-extension, non-Instant URLs should generally use 969 // Non-extension, non-Instant URLs should generally use
1001 // process-per-site-instance. Because we expect to use the effective URL, 970 // process-per-site-instance. Because we expect to use the effective URL,
1002 // URLs for hosted apps (apart from bookmark apps) should have an extension 971 // URLs for hosted apps (apart from bookmark apps) should have an extension
1003 // scheme by now. 972 // scheme by now.
1004 973
1005 Profile* profile = Profile::FromBrowserContext(browser_context); 974 Profile* profile = Profile::FromBrowserContext(browser_context);
1006 if (!profile) 975 if (!profile)
1007 return false; 976 return false;
1008 977
1009 if (chrome::ShouldUseProcessPerSiteForInstantURL(effective_url, profile)) 978 if (chrome::ShouldUseProcessPerSiteForInstantURL(effective_url, profile))
1010 return true; 979 return true;
1011 980
1012 #if !defined(OS_CHROMEOS)
1013 if (SigninManager::IsWebBasedSigninFlowURL(effective_url))
1014 return true;
1015 #endif
1016
1017 #if defined(ENABLE_EXTENSIONS) 981 #if defined(ENABLE_EXTENSIONS)
1018 return ChromeContentBrowserClientExtensionsPart::ShouldUseProcessPerSite( 982 return ChromeContentBrowserClientExtensionsPart::ShouldUseProcessPerSite(
1019 profile, effective_url); 983 profile, effective_url);
1020 #else 984 #else
1021 return false; 985 return false;
1022 #endif 986 #endif
1023 } 987 }
1024 988
1025 // These are treated as WebUI schemes but do not get WebUI bindings. Also, 989 // These are treated as WebUI schemes but do not get WebUI bindings. Also,
1026 // view-source is allowed for these schemes. 990 // view-source is allowed for these schemes.
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 InstantServiceFactory::GetForProfile(profile); 1084 InstantServiceFactory::GetForProfile(profile);
1121 if (instant_service) { 1085 if (instant_service) {
1122 bool is_instant_process = instant_service->IsInstantProcess( 1086 bool is_instant_process = instant_service->IsInstantProcess(
1123 process_host->GetID()); 1087 process_host->GetID());
1124 bool should_be_in_instant_process = 1088 bool should_be_in_instant_process =
1125 chrome::ShouldAssignURLToInstantRenderer(site_url, profile); 1089 chrome::ShouldAssignURLToInstantRenderer(site_url, profile);
1126 if (is_instant_process || should_be_in_instant_process) 1090 if (is_instant_process || should_be_in_instant_process)
1127 return is_instant_process && should_be_in_instant_process; 1091 return is_instant_process && should_be_in_instant_process;
1128 } 1092 }
1129 1093
1130 #if !defined(OS_CHROMEOS)
1131 SigninClient* signin_client =
1132 ChromeSigninClientFactory::GetForProfile(profile);
1133 if (signin_client && signin_client->IsSigninProcess(process_host->GetID()))
1134 return SigninManager::IsWebBasedSigninFlowURL(site_url);
1135 #endif
1136
1137 #if defined(ENABLE_EXTENSIONS) 1094 #if defined(ENABLE_EXTENSIONS)
1138 return ChromeContentBrowserClientExtensionsPart::IsSuitableHost( 1095 return ChromeContentBrowserClientExtensionsPart::IsSuitableHost(
1139 profile, process_host, site_url); 1096 profile, process_host, site_url);
1140 #else 1097 #else
1141 return true; 1098 return true;
1142 #endif 1099 #endif
1143 } 1100 }
1144 1101
1145 bool ChromeContentBrowserClient::MayReuseHost( 1102 bool ChromeContentBrowserClient::MayReuseHost(
1146 content::RenderProcessHost* process_host) { 1103 content::RenderProcessHost* process_host) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 // Remember the ID of the Instant process to signal the renderer process 1144 // Remember the ID of the Instant process to signal the renderer process
1188 // on startup in |AppendExtraCommandLineSwitches| below. 1145 // on startup in |AppendExtraCommandLineSwitches| below.
1189 if (chrome::ShouldAssignURLToInstantRenderer( 1146 if (chrome::ShouldAssignURLToInstantRenderer(
1190 site_instance->GetSiteURL(), profile)) { 1147 site_instance->GetSiteURL(), profile)) {
1191 InstantService* instant_service = 1148 InstantService* instant_service =
1192 InstantServiceFactory::GetForProfile(profile); 1149 InstantServiceFactory::GetForProfile(profile);
1193 if (instant_service) 1150 if (instant_service)
1194 instant_service->AddInstantProcess(site_instance->GetProcess()->GetID()); 1151 instant_service->AddInstantProcess(site_instance->GetProcess()->GetID());
1195 } 1152 }
1196 1153
1197 #if !defined(OS_CHROMEOS)
1198 // We only expect there to be one signin process as we use process-per-site
1199 // for signin URLs. The signin process will be cleared from SigninManager
1200 // when the renderer is destroyed.
1201 if (SigninManager::IsWebBasedSigninFlowURL(site_instance->GetSiteURL())) {
1202 SigninClient* signin_client =
1203 ChromeSigninClientFactory::GetForProfile(profile);
1204 if (signin_client)
1205 signin_client->SetSigninProcess(site_instance->GetProcess()->GetID());
1206 #if defined(ENABLE_EXTENSIONS)
1207 ChromeContentBrowserClientExtensionsPart::SetSigninProcess(site_instance);
1208 #endif
1209 }
1210 #endif
1211
1212 for (size_t i = 0; i < extra_parts_.size(); ++i) 1154 for (size_t i = 0; i < extra_parts_.size(); ++i)
1213 extra_parts_[i]->SiteInstanceGotProcess(site_instance); 1155 extra_parts_[i]->SiteInstanceGotProcess(site_instance);
1214 } 1156 }
1215 1157
1216 void ChromeContentBrowserClient::SiteInstanceDeleting( 1158 void ChromeContentBrowserClient::SiteInstanceDeleting(
1217 SiteInstance* site_instance) { 1159 SiteInstance* site_instance) {
1218 if (!site_instance->HasProcess()) 1160 if (!site_instance->HasProcess())
1219 return; 1161 return;
1220 1162
1221 for (size_t i = 0; i < extra_parts_.size(); ++i) 1163 for (size_t i = 0; i < extra_parts_.size(); ++i)
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 } 1336 }
1395 1337
1396 if (prefs->GetBoolean(prefs::kPrintPreviewDisabled)) 1338 if (prefs->GetBoolean(prefs::kPrintPreviewDisabled))
1397 command_line->AppendSwitch(switches::kDisablePrintPreview); 1339 command_line->AppendSwitch(switches::kDisablePrintPreview);
1398 1340
1399 InstantService* instant_service = 1341 InstantService* instant_service =
1400 InstantServiceFactory::GetForProfile(profile); 1342 InstantServiceFactory::GetForProfile(profile);
1401 if (instant_service && 1343 if (instant_service &&
1402 instant_service->IsInstantProcess(process->GetID())) 1344 instant_service->IsInstantProcess(process->GetID()))
1403 command_line->AppendSwitch(switches::kInstantProcess); 1345 command_line->AppendSwitch(switches::kInstantProcess);
1404
1405 #if !defined(OS_CHROMEOS)
1406 SigninClient* signin_client =
1407 ChromeSigninClientFactory::GetForProfile(profile);
1408 if (signin_client && signin_client->IsSigninProcess(process->GetID()))
1409 command_line->AppendSwitch(switches::kSigninProcess);
1410 #endif
1411 } 1346 }
1412 1347
1413 if (IsAutoReloadEnabled()) 1348 if (IsAutoReloadEnabled())
1414 command_line->AppendSwitch(switches::kEnableOfflineAutoReload); 1349 command_line->AppendSwitch(switches::kEnableOfflineAutoReload);
1415 if (IsAutoReloadVisibleOnlyEnabled()) { 1350 if (IsAutoReloadVisibleOnlyEnabled()) {
1416 command_line->AppendSwitch( 1351 command_line->AppendSwitch(
1417 switches::kEnableOfflineAutoReloadVisibleOnly); 1352 switches::kEnableOfflineAutoReloadVisibleOnly);
1418 } 1353 }
1419 1354
1420 { 1355 {
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after
2640 switches::kDisableWebRtcEncryption, 2575 switches::kDisableWebRtcEncryption,
2641 }; 2576 };
2642 to_command_line->CopySwitchesFrom(from_command_line, 2577 to_command_line->CopySwitchesFrom(from_command_line,
2643 kWebRtcDevSwitchNames, 2578 kWebRtcDevSwitchNames,
2644 arraysize(kWebRtcDevSwitchNames)); 2579 arraysize(kWebRtcDevSwitchNames));
2645 } 2580 }
2646 } 2581 }
2647 #endif // defined(ENABLE_WEBRTC) 2582 #endif // defined(ENABLE_WEBRTC)
2648 2583
2649 } // namespace chrome 2584 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698