Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/settings/people_handler.h" | 5 #include "chrome/browser/ui/webui/settings/people_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 #include "content/public/browser/web_contents.h" | 52 #include "content/public/browser/web_contents.h" |
| 53 #include "content/public/browser/web_contents_delegate.h" | 53 #include "content/public/browser/web_contents_delegate.h" |
| 54 #include "google_apis/gaia/gaia_auth_util.h" | 54 #include "google_apis/gaia/gaia_auth_util.h" |
| 55 #include "google_apis/gaia/gaia_constants.h" | 55 #include "google_apis/gaia/gaia_constants.h" |
| 56 #include "net/base/url_util.h" | 56 #include "net/base/url_util.h" |
| 57 #include "ui/base/l10n/l10n_util.h" | 57 #include "ui/base/l10n/l10n_util.h" |
| 58 #include "ui/base/webui/web_ui_util.h" | 58 #include "ui/base/webui/web_ui_util.h" |
| 59 | 59 |
| 60 #if defined(OS_CHROMEOS) | 60 #if defined(OS_CHROMEOS) |
| 61 #include "components/signin/core/browser/signin_manager_base.h" | 61 #include "components/signin/core/browser/signin_manager_base.h" |
| 62 #include "ui/keyboard/keyboard_util.h" | |
| 62 #else | 63 #else |
| 63 #include "components/signin/core/browser/signin_manager.h" | 64 #include "components/signin/core/browser/signin_manager.h" |
| 64 #endif | 65 #endif |
| 65 | 66 |
| 66 using browser_sync::ProfileSyncService; | 67 using browser_sync::ProfileSyncService; |
| 67 using content::WebContents; | 68 using content::WebContents; |
| 68 using l10n_util::GetStringFUTF16; | 69 using l10n_util::GetStringFUTF16; |
| 69 using l10n_util::GetStringUTF16; | 70 using l10n_util::GetStringUTF16; |
| 70 | 71 |
| 71 namespace { | 72 namespace { |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 209 base::Bind(&PeopleHandler::HandleGetSyncStatus, base::Unretained(this))); | 210 base::Bind(&PeopleHandler::HandleGetSyncStatus, base::Unretained(this))); |
| 210 web_ui()->RegisterMessageCallback( | 211 web_ui()->RegisterMessageCallback( |
| 211 "SyncSetupManageOtherPeople", | 212 "SyncSetupManageOtherPeople", |
| 212 base::Bind(&PeopleHandler::HandleManageOtherPeople, | 213 base::Bind(&PeopleHandler::HandleManageOtherPeople, |
| 213 base::Unretained(this))); | 214 base::Unretained(this))); |
| 214 #if defined(OS_CHROMEOS) | 215 #if defined(OS_CHROMEOS) |
| 215 web_ui()->RegisterMessageCallback( | 216 web_ui()->RegisterMessageCallback( |
| 216 "SyncSetupDoSignOutOnAuthError", | 217 "SyncSetupDoSignOutOnAuthError", |
| 217 base::Bind(&PeopleHandler::HandleDoSignOutOnAuthError, | 218 base::Bind(&PeopleHandler::HandleDoSignOutOnAuthError, |
| 218 base::Unretained(this))); | 219 base::Unretained(this))); |
| 220 web_ui()->RegisterMessageCallback( | |
| 221 "SetForceDisableVirtualKeyboard", | |
| 222 base::Bind(&PeopleHandler::HandleSetForceDisableVirtualKeyboard, | |
| 223 base::Unretained(this))); | |
| 219 #else | 224 #else |
| 220 web_ui()->RegisterMessageCallback( | 225 web_ui()->RegisterMessageCallback( |
| 221 "SyncSetupStopSyncing", | 226 "SyncSetupStopSyncing", |
| 222 base::Bind(&PeopleHandler::HandleStopSyncing, base::Unretained(this))); | 227 base::Bind(&PeopleHandler::HandleStopSyncing, base::Unretained(this))); |
| 223 web_ui()->RegisterMessageCallback( | 228 web_ui()->RegisterMessageCallback( |
| 224 "SyncSetupStartSignIn", | 229 "SyncSetupStartSignIn", |
| 225 base::Bind(&PeopleHandler::HandleStartSignin, base::Unretained(this))); | 230 base::Bind(&PeopleHandler::HandleStartSignin, base::Unretained(this))); |
| 226 #endif | 231 #endif |
| 227 } | 232 } |
| 228 | 233 |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 508 OpenSyncSetup(false /* creating_supervised_user */); | 513 OpenSyncSetup(false /* creating_supervised_user */); |
| 509 } | 514 } |
| 510 | 515 |
| 511 #if defined(OS_CHROMEOS) | 516 #if defined(OS_CHROMEOS) |
| 512 // On ChromeOS, we need to sign out the user session to fix an auth error, so | 517 // On ChromeOS, we need to sign out the user session to fix an auth error, so |
| 513 // the user goes through the real signin flow to generate a new auth token. | 518 // the user goes through the real signin flow to generate a new auth token. |
| 514 void PeopleHandler::HandleDoSignOutOnAuthError(const base::ListValue* args) { | 519 void PeopleHandler::HandleDoSignOutOnAuthError(const base::ListValue* args) { |
| 515 DVLOG(1) << "Signing out the user to fix a sync error."; | 520 DVLOG(1) << "Signing out the user to fix a sync error."; |
| 516 chrome::AttemptUserExit(); | 521 chrome::AttemptUserExit(); |
| 517 } | 522 } |
| 523 | |
| 524 void PeopleHandler::HandleSetForceDisableVirtualKeyboard( | |
| 525 const base::ListValue* args) { | |
| 526 bool disable_keyboard = false; | |
| 527 args->GetBoolean(0, &disable_keyboard); | |
| 528 keyboard::SetForceDisableVirtualKeyboardForWebUi(disable_keyboard); | |
|
xiyuan
2016/11/09 18:06:32
Do we need to make sure this is reverted in People
sammiequon
2016/11/10 21:06:01
Decided to remove blocking keyboard in settings, s
| |
| 529 } | |
| 518 #endif | 530 #endif |
| 519 | 531 |
| 520 #if !defined(OS_CHROMEOS) | 532 #if !defined(OS_CHROMEOS) |
| 521 void PeopleHandler::HandleStartSignin(const base::ListValue* args) { | 533 void PeopleHandler::HandleStartSignin(const base::ListValue* args) { |
| 522 AllowJavascript(); | 534 AllowJavascript(); |
| 523 | 535 |
| 524 // Should only be called if the user is not already signed in. | 536 // Should only be called if the user is not already signed in. |
| 525 DCHECK(!SigninManagerFactory::GetForProfile(profile_)->IsAuthenticated()); | 537 DCHECK(!SigninManagerFactory::GetForProfile(profile_)->IsAuthenticated()); |
| 526 bool creating_supervised_user = false; | 538 bool creating_supervised_user = false; |
| 527 args->GetBoolean(0, &creating_supervised_user); | 539 args->GetBoolean(0, &creating_supervised_user); |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 913 base::FilePath profile_file_path = profile_->GetPath(); | 925 base::FilePath profile_file_path = profile_->GetPath(); |
| 914 ProfileMetrics::LogProfileSyncSignIn(profile_file_path); | 926 ProfileMetrics::LogProfileSyncSignIn(profile_file_path); |
| 915 | 927 |
| 916 // We're done configuring, so notify ProfileSyncService that it is OK to | 928 // We're done configuring, so notify ProfileSyncService that it is OK to |
| 917 // start syncing. | 929 // start syncing. |
| 918 sync_blocker_.reset(); | 930 sync_blocker_.reset(); |
| 919 service->SetFirstSetupComplete(); | 931 service->SetFirstSetupComplete(); |
| 920 } | 932 } |
| 921 | 933 |
| 922 } // namespace settings | 934 } // namespace settings |
| OLD | NEW |