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

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

Issue 1952723002: [Smart Lock] Stop showing auto signin first run only after user decision received. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | chrome/browser/password_manager/auto_signin_first_run_dialog_android_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/password_manager/auto_signin_first_run_dialog_android.h " 5 #include "chrome/browser/password_manager/auto_signin_first_run_dialog_android.h "
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "chrome/browser/password_manager/chrome_password_manager_client.h" 9 #include "chrome/browser/password_manager/chrome_password_manager_client.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/sync/profile_sync_service_factory.h" 11 #include "chrome/browser/sync/profile_sync_service_factory.h"
12 #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h" 12 #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h"
13 #include "chrome/grit/generated_resources.h" 13 #include "chrome/grit/generated_resources.h"
14 #include "components/browser_sync/browser/profile_sync_service.h" 14 #include "components/browser_sync/browser/profile_sync_service.h"
15 #include "components/password_manager/core/browser/password_bubble_experiment.h" 15 #include "components/password_manager/core/browser/password_bubble_experiment.h"
16 #include "components/password_manager/core/browser/password_manager_constants.h" 16 #include "components/password_manager/core/browser/password_manager_constants.h"
17 #include "jni/AutoSigninFirstRunDialog_jni.h" 17 #include "jni/AutoSigninFirstRunDialog_jni.h"
18 #include "ui/android/window_android.h" 18 #include "ui/android/window_android.h"
19 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
20 #include "ui/gfx/range/range.h" 20 #include "ui/gfx/range/range.h"
21 21
22 using base::android::AttachCurrentThread; 22 using base::android::AttachCurrentThread;
23 using base::android::ConvertUTF16ToJavaString; 23 using base::android::ConvertUTF16ToJavaString;
24 24
25 namespace {
26
27 void MarkAutoSignInFirstRunExperiemceShown(content::WebContents* web_contents) {
Mike West 2016/05/04 17:25:24 Nit: s/Experiemce/Experience/ <-- 'n', not 'm'
28 Profile* profile =
29 Profile::FromBrowserContext(web_contents->GetBrowserContext());
30 password_bubble_experiment::RecordAutoSignInPromptFirstRunExperienceWasShown(
31 profile->GetPrefs());
32 }
33
34 } // namespace
35
25 AutoSigninFirstRunDialogAndroid::AutoSigninFirstRunDialogAndroid( 36 AutoSigninFirstRunDialogAndroid::AutoSigninFirstRunDialogAndroid(
26 content::WebContents* web_contents) 37 content::WebContents* web_contents)
27 : web_contents_(web_contents) {} 38 : web_contents_(web_contents) {}
28 39
29 AutoSigninFirstRunDialogAndroid::~AutoSigninFirstRunDialogAndroid() { 40 AutoSigninFirstRunDialogAndroid::~AutoSigninFirstRunDialogAndroid() {}
30 Profile* profile =
31 Profile::FromBrowserContext(web_contents_->GetBrowserContext());
32 password_bubble_experiment::RecordAutoSignInPromptFirstRunExperienceWasShown(
33 profile->GetPrefs());
34 }
35 41
36 void AutoSigninFirstRunDialogAndroid::ShowDialog() { 42 void AutoSigninFirstRunDialogAndroid::ShowDialog() {
37 JNIEnv* env = AttachCurrentThread(); 43 JNIEnv* env = AttachCurrentThread();
38 Profile* profile = 44 Profile* profile =
39 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); 45 Profile::FromBrowserContext(web_contents_->GetBrowserContext());
40 46
41 bool is_smartlock_branding_enabled = 47 bool is_smartlock_branding_enabled =
42 password_bubble_experiment::IsSmartLockUser( 48 password_bubble_experiment::IsSmartLockUser(
43 ProfileSyncServiceFactory::GetForProfile(profile)); 49 ProfileSyncServiceFactory::GetForProfile(profile));
44 base::string16 explanation; 50 base::string16 explanation;
(...skipping 21 matching lines...) Expand all
66 base::android::ConvertUTF16ToJavaString(env, explanation).obj(), 72 base::android::ConvertUTF16ToJavaString(env, explanation).obj(),
67 explanation_link_range.start(), explanation_link_range.end(), 73 explanation_link_range.start(), explanation_link_range.end(),
68 base::android::ConvertUTF16ToJavaString(env, ok_button_text).obj(), 74 base::android::ConvertUTF16ToJavaString(env, ok_button_text).obj(),
69 base::android::ConvertUTF16ToJavaString(env, turn_off_button_text).obj()); 75 base::android::ConvertUTF16ToJavaString(env, turn_off_button_text).obj());
70 } 76 }
71 77
72 void AutoSigninFirstRunDialogAndroid::Destroy(JNIEnv* env, jobject obj) { 78 void AutoSigninFirstRunDialogAndroid::Destroy(JNIEnv* env, jobject obj) {
73 delete this; 79 delete this;
74 } 80 }
75 81
76 void AutoSigninFirstRunDialogAndroid::OnOkClicked(JNIEnv* env, jobject obj) {} 82 void AutoSigninFirstRunDialogAndroid::OnOkClicked(JNIEnv* env, jobject obj) {
83 MarkAutoSignInFirstRunExperiemceShown(web_contents_);
84 }
77 85
78 void AutoSigninFirstRunDialogAndroid::OnTurnOffClicked(JNIEnv* env, 86 void AutoSigninFirstRunDialogAndroid::OnTurnOffClicked(JNIEnv* env,
79 jobject obj) { 87 jobject obj) {
80 Profile* profile = 88 Profile* profile =
81 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); 89 Profile::FromBrowserContext(web_contents_->GetBrowserContext());
82 password_bubble_experiment::TurnOffAutoSignin(profile->GetPrefs()); 90 password_bubble_experiment::TurnOffAutoSignin(profile->GetPrefs());
91 MarkAutoSignInFirstRunExperiemceShown(web_contents_);
83 } 92 }
84 93
85 void AutoSigninFirstRunDialogAndroid::CancelDialog(JNIEnv* env, jobject obj) {} 94 void AutoSigninFirstRunDialogAndroid::CancelDialog(JNIEnv* env, jobject obj) {}
86 95
87 void AutoSigninFirstRunDialogAndroid::OnLinkClicked(JNIEnv* env, jobject obj) { 96 void AutoSigninFirstRunDialogAndroid::OnLinkClicked(JNIEnv* env, jobject obj) {
88 web_contents_->OpenURL(content::OpenURLParams( 97 web_contents_->OpenURL(content::OpenURLParams(
89 GURL(password_manager::kPasswordManagerHelpCenterSmartLock), 98 GURL(password_manager::kPasswordManagerHelpCenterSmartLock),
90 content::Referrer(), NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, 99 content::Referrer(), NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK,
91 false /* is_renderer_initiated */)); 100 false /* is_renderer_initiated */));
92 } 101 }
93 102
94 bool RegisterAutoSigninFirstRunDialogAndroid(JNIEnv* env) { 103 bool RegisterAutoSigninFirstRunDialogAndroid(JNIEnv* env) {
95 return RegisterNativesImpl(env); 104 return RegisterNativesImpl(env);
96 } 105 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/password_manager/auto_signin_first_run_dialog_android_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698