OLD | NEW |
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/ui/android/infobars/generated_password_saved_infobar.h" | 5 #include "chrome/browser/ui/android/infobars/generated_password_saved_infobar.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| 11 #include "base/memory/ptr_util.h" |
11 #include "chrome/browser/infobars/infobar_service.h" | 12 #include "chrome/browser/infobars/infobar_service.h" |
12 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
13 #include "jni/GeneratedPasswordSavedInfoBarDelegate_jni.h" | 14 #include "jni/GeneratedPasswordSavedInfoBarDelegate_jni.h" |
14 | 15 |
15 // static | 16 // static |
16 void GeneratedPasswordSavedInfoBarDelegateAndroid::Create( | 17 void GeneratedPasswordSavedInfoBarDelegateAndroid::Create( |
17 content::WebContents* web_contents) { | 18 content::WebContents* web_contents) { |
18 InfoBarService::FromWebContents(web_contents) | 19 InfoBarService::FromWebContents(web_contents) |
19 ->AddInfoBar(make_scoped_ptr(new GeneratedPasswordSavedInfoBar( | 20 ->AddInfoBar(base::WrapUnique(new GeneratedPasswordSavedInfoBar( |
20 make_scoped_ptr(new GeneratedPasswordSavedInfoBarDelegateAndroid( | 21 base::WrapUnique(new GeneratedPasswordSavedInfoBarDelegateAndroid( |
21 web_contents))))); | 22 web_contents))))); |
22 } | 23 } |
23 | 24 |
24 GeneratedPasswordSavedInfoBar::GeneratedPasswordSavedInfoBar( | 25 GeneratedPasswordSavedInfoBar::GeneratedPasswordSavedInfoBar( |
25 scoped_ptr<GeneratedPasswordSavedInfoBarDelegateAndroid> delegate) | 26 std::unique_ptr<GeneratedPasswordSavedInfoBarDelegateAndroid> delegate) |
26 : InfoBarAndroid(std::move(delegate)) {} | 27 : InfoBarAndroid(std::move(delegate)) {} |
27 | 28 |
28 GeneratedPasswordSavedInfoBar::~GeneratedPasswordSavedInfoBar() { | 29 GeneratedPasswordSavedInfoBar::~GeneratedPasswordSavedInfoBar() { |
29 } | 30 } |
30 | 31 |
31 base::android::ScopedJavaLocalRef<jobject> | 32 base::android::ScopedJavaLocalRef<jobject> |
32 GeneratedPasswordSavedInfoBar::CreateRenderInfoBar(JNIEnv* env) { | 33 GeneratedPasswordSavedInfoBar::CreateRenderInfoBar(JNIEnv* env) { |
33 GeneratedPasswordSavedInfoBarDelegateAndroid* infobar_delegate = | 34 GeneratedPasswordSavedInfoBarDelegateAndroid* infobar_delegate = |
34 static_cast<GeneratedPasswordSavedInfoBarDelegateAndroid*>(delegate()); | 35 static_cast<GeneratedPasswordSavedInfoBarDelegateAndroid*>(delegate()); |
35 | 36 |
(...skipping 21 matching lines...) Expand all Loading... |
57 void GeneratedPasswordSavedInfoBar::ProcessButton(int action) { | 58 void GeneratedPasswordSavedInfoBar::ProcessButton(int action) { |
58 if (!owner()) | 59 if (!owner()) |
59 return; | 60 return; |
60 | 61 |
61 RemoveSelf(); | 62 RemoveSelf(); |
62 } | 63 } |
63 | 64 |
64 bool RegisterGeneratedPasswordSavedInfoBarDelegate(JNIEnv* env) { | 65 bool RegisterGeneratedPasswordSavedInfoBarDelegate(JNIEnv* env) { |
65 return RegisterNativesImpl(env); | 66 return RegisterNativesImpl(env); |
66 } | 67 } |
OLD | NEW |