| 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/ui/android/infobars/autofill_save_card_infobar.h" | 5 #include "chrome/browser/ui/android/infobars/autofill_save_card_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/android/resource_mapper.h" | 12 #include "chrome/browser/android/resource_mapper.h" |
| 12 #include "chrome/browser/infobars/infobar_service.h" | 13 #include "chrome/browser/infobars/infobar_service.h" |
| 13 #include "components/autofill/core/browser/autofill_save_card_infobar_delegate_m
obile.h" | 14 #include "components/autofill/core/browser/autofill_save_card_infobar_delegate_m
obile.h" |
| 14 #include "components/autofill/core/browser/autofill_save_card_infobar_mobile.h" | 15 #include "components/autofill/core/browser/autofill_save_card_infobar_mobile.h" |
| 15 #include "components/autofill/core/browser/legal_message_line.h" | 16 #include "components/autofill/core/browser/legal_message_line.h" |
| 16 #include "jni/AutofillSaveCardInfoBar_jni.h" | 17 #include "jni/AutofillSaveCardInfoBar_jni.h" |
| 17 #include "ui/gfx/android/java_bitmap.h" | 18 #include "ui/gfx/android/java_bitmap.h" |
| 18 #include "ui/gfx/image/image.h" | 19 #include "ui/gfx/image/image.h" |
| 19 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 20 | 21 |
| 21 namespace autofill { | 22 namespace autofill { |
| 22 | 23 |
| 23 scoped_ptr<infobars::InfoBar> CreateSaveCardInfoBarMobile( | 24 std::unique_ptr<infobars::InfoBar> CreateSaveCardInfoBarMobile( |
| 24 scoped_ptr<AutofillSaveCardInfoBarDelegateMobile> delegate) { | 25 std::unique_ptr<AutofillSaveCardInfoBarDelegateMobile> delegate) { |
| 25 return make_scoped_ptr(new AutofillSaveCardInfoBar(std::move(delegate))); | 26 return base::WrapUnique(new AutofillSaveCardInfoBar(std::move(delegate))); |
| 26 } | 27 } |
| 27 | 28 |
| 28 } // namespace autofill | 29 } // namespace autofill |
| 29 | 30 |
| 30 AutofillSaveCardInfoBar::AutofillSaveCardInfoBar( | 31 AutofillSaveCardInfoBar::AutofillSaveCardInfoBar( |
| 31 scoped_ptr<autofill::AutofillSaveCardInfoBarDelegateMobile> delegate) | 32 std::unique_ptr<autofill::AutofillSaveCardInfoBarDelegateMobile> delegate) |
| 32 : ConfirmInfoBar(std::move(delegate)) {} | 33 : ConfirmInfoBar(std::move(delegate)) {} |
| 33 | 34 |
| 34 AutofillSaveCardInfoBar::~AutofillSaveCardInfoBar() {} | 35 AutofillSaveCardInfoBar::~AutofillSaveCardInfoBar() {} |
| 35 | 36 |
| 36 void AutofillSaveCardInfoBar::OnLegalMessageLinkClicked(JNIEnv* env, | 37 void AutofillSaveCardInfoBar::OnLegalMessageLinkClicked(JNIEnv* env, |
| 37 jobject obj, | 38 jobject obj, |
| 38 jstring url) { | 39 jstring url) { |
| 39 GetSaveCardDelegate()->OnLegalMessageLinkClicked( | 40 GetSaveCardDelegate()->OnLegalMessageLinkClicked( |
| 40 GURL(base::android::ConvertJavaStringToUTF16(env, url))); | 41 GURL(base::android::ConvertJavaStringToUTF16(env, url))); |
| 41 } | 42 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 } | 89 } |
| 89 | 90 |
| 90 return java_delegate; | 91 return java_delegate; |
| 91 } | 92 } |
| 92 | 93 |
| 93 autofill::AutofillSaveCardInfoBarDelegateMobile* | 94 autofill::AutofillSaveCardInfoBarDelegateMobile* |
| 94 AutofillSaveCardInfoBar::GetSaveCardDelegate() { | 95 AutofillSaveCardInfoBar::GetSaveCardDelegate() { |
| 95 return static_cast<autofill::AutofillSaveCardInfoBarDelegateMobile*>( | 96 return static_cast<autofill::AutofillSaveCardInfoBarDelegateMobile*>( |
| 96 GetDelegate()); | 97 GetDelegate()); |
| 97 } | 98 } |
| OLD | NEW |