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/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" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 base::string16 message = l10n_util::GetStringUTF16( | 60 base::string16 message = l10n_util::GetStringUTF16( |
61 IsSyncingAutosignSetting(profile) | 61 IsSyncingAutosignSetting(profile) |
62 ? IDS_AUTO_SIGNIN_FIRST_RUN_TITLE_MANY_DEVICES | 62 ? IDS_AUTO_SIGNIN_FIRST_RUN_TITLE_MANY_DEVICES |
63 : IDS_AUTO_SIGNIN_FIRST_RUN_TITLE_LOCAL_DEVICE); | 63 : IDS_AUTO_SIGNIN_FIRST_RUN_TITLE_LOCAL_DEVICE); |
64 base::string16 ok_button_text = | 64 base::string16 ok_button_text = |
65 l10n_util::GetStringUTF16(IDS_AUTO_SIGNIN_FIRST_RUN_OK); | 65 l10n_util::GetStringUTF16(IDS_AUTO_SIGNIN_FIRST_RUN_OK); |
66 base::string16 turn_off_button_text = | 66 base::string16 turn_off_button_text = |
67 l10n_util::GetStringUTF16(IDS_AUTO_SIGNIN_FIRST_RUN_TURN_OFF); | 67 l10n_util::GetStringUTF16(IDS_AUTO_SIGNIN_FIRST_RUN_TURN_OFF); |
68 | 68 |
69 dialog_jobject_.Reset(Java_AutoSigninFirstRunDialog_createAndShowDialog( | 69 dialog_jobject_.Reset(Java_AutoSigninFirstRunDialog_createAndShowDialog( |
70 env, native_window->GetJavaObject().obj(), | 70 env, native_window->GetJavaObject(), reinterpret_cast<intptr_t>(this), |
71 reinterpret_cast<intptr_t>(this), | 71 base::android::ConvertUTF16ToJavaString(env, message), |
72 base::android::ConvertUTF16ToJavaString(env, message).obj(), | 72 base::android::ConvertUTF16ToJavaString(env, explanation), |
73 base::android::ConvertUTF16ToJavaString(env, explanation).obj(), | |
74 explanation_link_range.start(), explanation_link_range.end(), | 73 explanation_link_range.start(), explanation_link_range.end(), |
75 base::android::ConvertUTF16ToJavaString(env, ok_button_text).obj(), | 74 base::android::ConvertUTF16ToJavaString(env, ok_button_text), |
76 base::android::ConvertUTF16ToJavaString(env, turn_off_button_text) | 75 base::android::ConvertUTF16ToJavaString(env, turn_off_button_text))); |
77 .obj())); | |
78 } | 76 } |
79 | 77 |
80 void AutoSigninFirstRunDialogAndroid::Destroy(JNIEnv* env, jobject obj) { | 78 void AutoSigninFirstRunDialogAndroid::Destroy(JNIEnv* env, jobject obj) { |
81 delete this; | 79 delete this; |
82 } | 80 } |
83 | 81 |
84 void AutoSigninFirstRunDialogAndroid::OnOkClicked(JNIEnv* env, jobject obj) { | 82 void AutoSigninFirstRunDialogAndroid::OnOkClicked(JNIEnv* env, jobject obj) { |
85 password_manager::metrics_util::LogAutoSigninPromoUserAction( | 83 password_manager::metrics_util::LogAutoSigninPromoUserAction( |
86 password_manager::metrics_util::AUTO_SIGNIN_OK_GOT_IT); | 84 password_manager::metrics_util::AUTO_SIGNIN_OK_GOT_IT); |
87 MarkAutoSignInFirstRunExperienceShown(web_contents_); | 85 MarkAutoSignInFirstRunExperienceShown(web_contents_); |
(...skipping 13 matching lines...) Expand all Loading... |
101 | 99 |
102 void AutoSigninFirstRunDialogAndroid::OnLinkClicked(JNIEnv* env, jobject obj) { | 100 void AutoSigninFirstRunDialogAndroid::OnLinkClicked(JNIEnv* env, jobject obj) { |
103 web_contents_->OpenURL(content::OpenURLParams( | 101 web_contents_->OpenURL(content::OpenURLParams( |
104 GURL(password_manager::kPasswordManagerHelpCenterSmartLock), | 102 GURL(password_manager::kPasswordManagerHelpCenterSmartLock), |
105 content::Referrer(), NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, | 103 content::Referrer(), NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, |
106 false /* is_renderer_initiated */)); | 104 false /* is_renderer_initiated */)); |
107 } | 105 } |
108 | 106 |
109 void AutoSigninFirstRunDialogAndroid::WebContentsDestroyed() { | 107 void AutoSigninFirstRunDialogAndroid::WebContentsDestroyed() { |
110 JNIEnv* env = AttachCurrentThread(); | 108 JNIEnv* env = AttachCurrentThread(); |
111 Java_AutoSigninFirstRunDialog_dismissDialog(env, dialog_jobject_.obj()); | 109 Java_AutoSigninFirstRunDialog_dismissDialog(env, dialog_jobject_); |
112 } | 110 } |
113 | 111 |
114 void AutoSigninFirstRunDialogAndroid::WasHidden() { | 112 void AutoSigninFirstRunDialogAndroid::WasHidden() { |
115 // TODO(https://crbug.com/610700): once bug is fixed, this code should be | 113 // TODO(https://crbug.com/610700): once bug is fixed, this code should be |
116 // gone. | 114 // gone. |
117 JNIEnv* env = AttachCurrentThread(); | 115 JNIEnv* env = AttachCurrentThread(); |
118 Java_AutoSigninFirstRunDialog_dismissDialog(env, dialog_jobject_.obj()); | 116 Java_AutoSigninFirstRunDialog_dismissDialog(env, dialog_jobject_); |
119 } | 117 } |
120 | 118 |
121 bool RegisterAutoSigninFirstRunDialogAndroid(JNIEnv* env) { | 119 bool RegisterAutoSigninFirstRunDialogAndroid(JNIEnv* env) { |
122 return RegisterNativesImpl(env); | 120 return RegisterNativesImpl(env); |
123 } | 121 } |
OLD | NEW |