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