| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ui/webui/signin/signin_supervised_user_import_handler.h
" | 5 #include "chrome/browser/ui/webui/signin/signin_supervised_user_import_handler.h
" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 CHECK(args->GetString(0, &webui_callback_id_)); | 96 CHECK(args->GetString(0, &webui_callback_id_)); |
| 97 AllowJavascript(); | 97 AllowJavascript(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void SigninSupervisedUserImportHandler::OpenUrlInLastActiveProfileBrowser( | 100 void SigninSupervisedUserImportHandler::OpenUrlInLastActiveProfileBrowser( |
| 101 const base::ListValue* args) { | 101 const base::ListValue* args) { |
| 102 CHECK_EQ(1U, args->GetSize()); | 102 CHECK_EQ(1U, args->GetSize()); |
| 103 std::string url; | 103 std::string url; |
| 104 bool success = args->GetString(0, &url); | 104 bool success = args->GetString(0, &url); |
| 105 DCHECK(success); | 105 DCHECK(success); |
| 106 content::OpenURLParams params(GURL(url), | 106 content::OpenURLParams params(GURL(url), content::Referrer(), |
| 107 content::Referrer(), | 107 WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| 108 NEW_FOREGROUND_TAB, | 108 ui::PAGE_TRANSITION_LINK, false); |
| 109 ui::PAGE_TRANSITION_LINK, | |
| 110 false); | |
| 111 // ProfileManager::GetLastUsedProfile() will attempt to load the default | 109 // ProfileManager::GetLastUsedProfile() will attempt to load the default |
| 112 // profile if there is no last used profile. If the default profile is not | 110 // profile if there is no last used profile. If the default profile is not |
| 113 // fully loaded and initialized, it will attempt to do so synchronously. | 111 // fully loaded and initialized, it will attempt to do so synchronously. |
| 114 // Therefore we cannot use that method here. If the last used profile is not | 112 // Therefore we cannot use that method here. If the last used profile is not |
| 115 // loaded, we do nothing. This is an edge case and should not happen often. | 113 // loaded, we do nothing. This is an edge case and should not happen often. |
| 116 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 114 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 117 base::FilePath last_used_profile_dir = | 115 base::FilePath last_used_profile_dir = |
| 118 profile_manager->GetLastUsedProfileDir(profile_manager->user_data_dir()); | 116 profile_manager->GetLastUsedProfileDir(profile_manager->user_data_dir()); |
| 119 Profile* last_used_profile = | 117 Profile* last_used_profile = |
| 120 profile_manager->GetProfileByPath(last_used_profile_dir); | 118 profile_manager->GetProfileByPath(last_used_profile_dir); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 | 313 |
| 316 bool SigninSupervisedUserImportHandler::HasAuthError(Profile* profile) const { | 314 bool SigninSupervisedUserImportHandler::HasAuthError(Profile* profile) const { |
| 317 SigninErrorController* error_controller = | 315 SigninErrorController* error_controller = |
| 318 SigninErrorControllerFactory::GetForProfile(profile); | 316 SigninErrorControllerFactory::GetForProfile(profile); |
| 319 if (!error_controller) | 317 if (!error_controller) |
| 320 return true; | 318 return true; |
| 321 | 319 |
| 322 GoogleServiceAuthError::State state = error_controller->auth_error().state(); | 320 GoogleServiceAuthError::State state = error_controller->auth_error().state(); |
| 323 return state != GoogleServiceAuthError::NONE; | 321 return state != GoogleServiceAuthError::NONE; |
| 324 } | 322 } |
| OLD | NEW |