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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 base::Bind(&PeopleHandler::HandleGetSyncStatus, base::Unretained(this))); | 197 base::Bind(&PeopleHandler::HandleGetSyncStatus, base::Unretained(this))); |
197 web_ui()->RegisterMessageCallback( | 198 web_ui()->RegisterMessageCallback( |
198 "SyncSetupManageOtherPeople", | 199 "SyncSetupManageOtherPeople", |
199 base::Bind(&PeopleHandler::HandleManageOtherPeople, | 200 base::Bind(&PeopleHandler::HandleManageOtherPeople, |
200 base::Unretained(this))); | 201 base::Unretained(this))); |
201 #if defined(OS_CHROMEOS) | 202 #if defined(OS_CHROMEOS) |
202 web_ui()->RegisterMessageCallback( | 203 web_ui()->RegisterMessageCallback( |
203 "SyncSetupDoSignOutOnAuthError", | 204 "SyncSetupDoSignOutOnAuthError", |
204 base::Bind(&PeopleHandler::HandleDoSignOutOnAuthError, | 205 base::Bind(&PeopleHandler::HandleDoSignOutOnAuthError, |
205 base::Unretained(this))); | 206 base::Unretained(this))); |
| 207 web_ui()->RegisterMessageCallback( |
| 208 "SetForceDisableVirtualKeyboard", |
| 209 base::Bind(&PeopleHandler::HandleSetForceDisableVirtualKeyboard, |
| 210 base::Unretained(this))); |
206 #else | 211 #else |
207 web_ui()->RegisterMessageCallback( | 212 web_ui()->RegisterMessageCallback( |
208 "SyncSetupStopSyncing", | 213 "SyncSetupStopSyncing", |
209 base::Bind(&PeopleHandler::HandleStopSyncing, base::Unretained(this))); | 214 base::Bind(&PeopleHandler::HandleStopSyncing, base::Unretained(this))); |
210 web_ui()->RegisterMessageCallback( | 215 web_ui()->RegisterMessageCallback( |
211 "SyncSetupStartSignIn", | 216 "SyncSetupStartSignIn", |
212 base::Bind(&PeopleHandler::HandleStartSignin, base::Unretained(this))); | 217 base::Bind(&PeopleHandler::HandleStartSignin, base::Unretained(this))); |
213 #endif | 218 #endif |
214 } | 219 } |
215 | 220 |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 OpenSyncSetup(false /* creating_supervised_user */); | 500 OpenSyncSetup(false /* creating_supervised_user */); |
496 } | 501 } |
497 | 502 |
498 #if defined(OS_CHROMEOS) | 503 #if defined(OS_CHROMEOS) |
499 // On ChromeOS, we need to sign out the user session to fix an auth error, so | 504 // On ChromeOS, we need to sign out the user session to fix an auth error, so |
500 // the user goes through the real signin flow to generate a new auth token. | 505 // the user goes through the real signin flow to generate a new auth token. |
501 void PeopleHandler::HandleDoSignOutOnAuthError(const base::ListValue* args) { | 506 void PeopleHandler::HandleDoSignOutOnAuthError(const base::ListValue* args) { |
502 DVLOG(1) << "Signing out the user to fix a sync error."; | 507 DVLOG(1) << "Signing out the user to fix a sync error."; |
503 chrome::AttemptUserExit(); | 508 chrome::AttemptUserExit(); |
504 } | 509 } |
| 510 |
| 511 void PeopleHandler::HandleSetForceDisableVirtualKeyboard( |
| 512 const base::ListValue* args) { |
| 513 bool disable_keyboard = false; |
| 514 args->GetBoolean(0, &disable_keyboard); |
| 515 keyboard::SetForceDisableVirtualKeyboardForWebUi(disable_keyboard); |
| 516 } |
505 #endif | 517 #endif |
506 | 518 |
507 #if !defined(OS_CHROMEOS) | 519 #if !defined(OS_CHROMEOS) |
508 void PeopleHandler::HandleStartSignin(const base::ListValue* args) { | 520 void PeopleHandler::HandleStartSignin(const base::ListValue* args) { |
509 AllowJavascript(); | 521 AllowJavascript(); |
510 | 522 |
511 // Should only be called if the user is not already signed in. | 523 // Should only be called if the user is not already signed in. |
512 DCHECK(!SigninManagerFactory::GetForProfile(profile_)->IsAuthenticated()); | 524 DCHECK(!SigninManagerFactory::GetForProfile(profile_)->IsAuthenticated()); |
513 bool creating_supervised_user = false; | 525 bool creating_supervised_user = false; |
514 args->GetBoolean(0, &creating_supervised_user); | 526 args->GetBoolean(0, &creating_supervised_user); |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 base::FilePath profile_file_path = profile_->GetPath(); | 913 base::FilePath profile_file_path = profile_->GetPath(); |
902 ProfileMetrics::LogProfileSyncSignIn(profile_file_path); | 914 ProfileMetrics::LogProfileSyncSignIn(profile_file_path); |
903 | 915 |
904 // We're done configuring, so notify ProfileSyncService that it is OK to | 916 // We're done configuring, so notify ProfileSyncService that it is OK to |
905 // start syncing. | 917 // start syncing. |
906 sync_blocker_.reset(); | 918 sync_blocker_.reset(); |
907 service->SetFirstSetupComplete(); | 919 service->SetFirstSetupComplete(); |
908 } | 920 } |
909 | 921 |
910 } // namespace settings | 922 } // namespace settings |
OLD | NEW |