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