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

Side by Side Diff: chrome/browser/password_manager/chrome_password_manager_client.cc

Issue 2958533003: Disable Credential management API dialog in VR mode (Closed)
Patch Set: Created 3 years, 6 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/password_manager/chrome_password_manager_client.h" 5 #include "chrome/browser/password_manager/chrome_password_manager_client.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 #include "chrome/browser/password_manager/generated_password_saved_infobar_deleg ate_android.h" 79 #include "chrome/browser/password_manager/generated_password_saved_infobar_deleg ate_android.h"
80 #include "chrome/browser/password_manager/save_password_infobar_delegate_android .h" 80 #include "chrome/browser/password_manager/save_password_infobar_delegate_android .h"
81 #include "chrome/browser/password_manager/update_password_infobar_delegate_andro id.h" 81 #include "chrome/browser/password_manager/update_password_infobar_delegate_andro id.h"
82 #include "chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.h" 82 #include "chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.h"
83 #endif 83 #endif
84 84
85 #if BUILDFLAG(ENABLE_EXTENSIONS) 85 #if BUILDFLAG(ENABLE_EXTENSIONS)
86 #include "extensions/common/constants.h" 86 #include "extensions/common/constants.h"
87 #endif 87 #endif
88 88
89 #include "device/vr/features/features.h"
vasilii 2017/06/26 10:38:27 unused
billorr 2017/06/29 22:26:02 It is used for the definition of ENABLE_VR.
90 #if BUILDFLAG(ENABLE_VR)
91 #include "chrome/browser/android/vr_shell/vr_tab_helper.h"
92 #endif // BUILDFLAG(ENABLE_VR)
93
89 using password_manager::ContentPasswordManagerDriverFactory; 94 using password_manager::ContentPasswordManagerDriverFactory;
90 using password_manager::PasswordManagerInternalsService; 95 using password_manager::PasswordManagerInternalsService;
91 using sessions::SerializedNavigationEntry; 96 using sessions::SerializedNavigationEntry;
92 97
93 // Shorten the name to spare line breaks. The code provides enough context 98 // Shorten the name to spare line breaks. The code provides enough context
94 // already. 99 // already.
95 typedef autofill::SavePasswordProgressLogger Logger; 100 typedef autofill::SavePasswordProgressLogger Logger;
96 101
97 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromePasswordManagerClient); 102 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromePasswordManagerClient);
98 103
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 bool ChromePasswordManagerClient::PromptUserToChooseCredentials( 294 bool ChromePasswordManagerClient::PromptUserToChooseCredentials(
290 std::vector<std::unique_ptr<autofill::PasswordForm>> local_forms, 295 std::vector<std::unique_ptr<autofill::PasswordForm>> local_forms,
291 const GURL& origin, 296 const GURL& origin,
292 const CredentialsCallback& callback) { 297 const CredentialsCallback& callback) {
293 // Set up an intercept callback if the prompt is zero-clickable (e.g. just one 298 // Set up an intercept callback if the prompt is zero-clickable (e.g. just one
294 // form provided). 299 // form provided).
295 CredentialsCallback intercept = 300 CredentialsCallback intercept =
296 base::Bind(&ChromePasswordManagerClient::OnCredentialsChosen, 301 base::Bind(&ChromePasswordManagerClient::OnCredentialsChosen,
297 base::Unretained(this), callback, local_forms.size() == 1); 302 base::Unretained(this), callback, local_forms.size() == 1);
298 #if defined(OS_ANDROID) 303 #if defined(OS_ANDROID)
304
305 // Do not show popup dialogs while in VR
306 #if BUILDFLAG(ENABLE_VR)
307 if (vr_shell::VrTabHelper::IsInVr(web_contents())) {
308 return false;
309 }
310 #endif // BUILDFLAG(ENABLE_VR)
311
299 // Deletes itself on the event from Java counterpart, when user interacts with 312 // Deletes itself on the event from Java counterpart, when user interacts with
300 // dialog. 313 // dialog.
301 AccountChooserDialogAndroid* acccount_chooser_dialog = 314 AccountChooserDialogAndroid* acccount_chooser_dialog =
302 new AccountChooserDialogAndroid(web_contents(), std::move(local_forms), 315 new AccountChooserDialogAndroid(web_contents(), std::move(local_forms),
303 origin, intercept); 316 origin, intercept);
304 acccount_chooser_dialog->ShowDialog(); 317 acccount_chooser_dialog->ShowDialog();
305 return true; 318 return true;
306 #else 319 #else // defined(OS_ANDROID)
307 return PasswordsClientUIDelegateFromWebContents(web_contents()) 320 return PasswordsClientUIDelegateFromWebContents(web_contents())
308 ->OnChooseCredentials(std::move(local_forms), origin, intercept); 321 ->OnChooseCredentials(std::move(local_forms), origin, intercept);
309 #endif 322 #endif // defined(OS_ANDROID)
310 } 323 }
311 324
312 void ChromePasswordManagerClient::OnCredentialsChosen( 325 void ChromePasswordManagerClient::OnCredentialsChosen(
313 const CredentialsCallback& callback, 326 const CredentialsCallback& callback,
314 bool one_local_credential, 327 bool one_local_credential,
315 const autofill::PasswordForm* form) { 328 const autofill::PasswordForm* form) {
316 callback.Run(form); 329 callback.Run(form);
317 // If a site gets back a credential some navigations are likely to occur. They 330 // If a site gets back a credential some navigations are likely to occur. They
318 // shouldn't trigger the autofill password manager. 331 // shouldn't trigger the autofill password manager.
319 if (form) 332 if (form)
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 614
602 void ChromePasswordManagerClient::PromptUserToEnableAutosigninIfNecessary() { 615 void ChromePasswordManagerClient::PromptUserToEnableAutosigninIfNecessary() {
603 if (!password_bubble_experiment::ShouldShowAutoSignInPromptFirstRunExperience( 616 if (!password_bubble_experiment::ShouldShowAutoSignInPromptFirstRunExperience(
604 GetPrefs()) || 617 GetPrefs()) ||
605 !GetPrefs()->GetBoolean( 618 !GetPrefs()->GetBoolean(
606 password_manager::prefs::kCredentialsEnableAutosignin) || 619 password_manager::prefs::kCredentialsEnableAutosignin) ||
607 IsIncognito()) 620 IsIncognito())
608 return; 621 return;
609 622
610 #if defined(OS_ANDROID) 623 #if defined(OS_ANDROID)
624
625 // Do not show popup dialogs while in VR
626 #if BUILDFLAG(ENABLE_VR)
627 if (vr_shell::VrTabHelper::IsInVr(web_contents())) {
628 return;
629 }
630 #endif // BUILDFLAG(ENABLE_VR)
631
611 // Dialog is deleted by the Java counterpart after user interacts with it. 632 // Dialog is deleted by the Java counterpart after user interacts with it.
612 AutoSigninFirstRunDialogAndroid* auto_signin_first_run_dialog = 633 AutoSigninFirstRunDialogAndroid* auto_signin_first_run_dialog =
613 new AutoSigninFirstRunDialogAndroid(web_contents()); 634 new AutoSigninFirstRunDialogAndroid(web_contents());
614 auto_signin_first_run_dialog->ShowDialog(); 635 auto_signin_first_run_dialog->ShowDialog();
615 #else 636 #else // defined(OS_ANDROID)
616 PasswordsClientUIDelegateFromWebContents(web_contents()) 637 PasswordsClientUIDelegateFromWebContents(web_contents())
617 ->OnPromptEnableAutoSignin(); 638 ->OnPromptEnableAutoSignin();
618 #endif 639 #endif // defined(OS_ANDROID)
619 } 640 }
620 641
621 void ChromePasswordManagerClient::GenerationAvailableForForm( 642 void ChromePasswordManagerClient::GenerationAvailableForForm(
622 const autofill::PasswordForm& form) { 643 const autofill::PasswordForm& form) {
623 password_manager_.GenerationAvailableForForm(form); 644 password_manager_.GenerationAvailableForForm(form);
624 } 645 }
625 646
626 const GURL& ChromePasswordManagerClient::GetMainFrameURL() const { 647 const GURL& ChromePasswordManagerClient::GetMainFrameURL() const {
627 return web_contents()->GetVisibleURL(); 648 return web_contents()->GetVisibleURL();
628 } 649 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 // static 740 // static
720 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { 741 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) {
721 std::string scheme = url.scheme(); 742 std::string scheme = url.scheme();
722 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( 743 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme(
723 scheme) && 744 scheme) &&
724 #if BUILDFLAG(ENABLE_EXTENSIONS) 745 #if BUILDFLAG(ENABLE_EXTENSIONS)
725 scheme != extensions::kExtensionScheme && 746 scheme != extensions::kExtensionScheme &&
726 #endif 747 #endif
727 scheme != content::kChromeDevToolsScheme); 748 scheme != content::kChromeDevToolsScheme);
728 } 749 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698