| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/confirm_infobar.h" | 5 #include "chrome/browser/ui/android/infobars/confirm_infobar.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| 11 #include "base/android/jni_array.h" | 11 #include "base/android/jni_array.h" |
| 12 #include "base/android/jni_string.h" | 12 #include "base/android/jni_string.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/memory/ptr_util.h" |
| 14 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 15 #include "chrome/browser/android/resource_mapper.h" | 16 #include "chrome/browser/android/resource_mapper.h" |
| 16 #include "chrome/browser/infobars/infobar_service.h" | 17 #include "chrome/browser/infobars/infobar_service.h" |
| 17 #include "chrome/browser/media/media_stream_infobar_delegate_android.h" | 18 #include "chrome/browser/media/media_stream_infobar_delegate_android.h" |
| 18 #include "chrome/browser/permissions/permission_infobar_delegate.h" | 19 #include "chrome/browser/permissions/permission_infobar_delegate.h" |
| 19 #include "components/content_settings/core/common/content_settings_types.h" | 20 #include "components/content_settings/core/common/content_settings_types.h" |
| 20 #include "components/infobars/core/confirm_infobar_delegate.h" | 21 #include "components/infobars/core/confirm_infobar_delegate.h" |
| 21 #include "content/public/browser/android/content_view_core.h" | 22 #include "content/public/browser/android/content_view_core.h" |
| 22 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
| 23 #include "jni/ConfirmInfoBar_jni.h" | 24 #include "jni/ConfirmInfoBar_jni.h" |
| 24 #include "ui/android/window_android.h" | 25 #include "ui/android/window_android.h" |
| 25 #include "ui/gfx/android/java_bitmap.h" | 26 #include "ui/gfx/android/java_bitmap.h" |
| 26 #include "ui/gfx/image/image.h" | 27 #include "ui/gfx/image/image.h" |
| 27 | 28 |
| 28 // InfoBarService ------------------------------------------------------------- | 29 // InfoBarService ------------------------------------------------------------- |
| 29 | 30 |
| 30 scoped_ptr<infobars::InfoBar> InfoBarService::CreateConfirmInfoBar( | 31 std::unique_ptr<infobars::InfoBar> InfoBarService::CreateConfirmInfoBar( |
| 31 scoped_ptr<ConfirmInfoBarDelegate> delegate) { | 32 std::unique_ptr<ConfirmInfoBarDelegate> delegate) { |
| 32 return make_scoped_ptr(new ConfirmInfoBar(std::move(delegate))); | 33 return base::WrapUnique(new ConfirmInfoBar(std::move(delegate))); |
| 33 } | 34 } |
| 34 | 35 |
| 35 | 36 |
| 36 // ConfirmInfoBar ------------------------------------------------------------- | 37 // ConfirmInfoBar ------------------------------------------------------------- |
| 37 | 38 |
| 38 ConfirmInfoBar::ConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate> delegate) | 39 ConfirmInfoBar::ConfirmInfoBar(std::unique_ptr<ConfirmInfoBarDelegate> delegate) |
| 39 : InfoBarAndroid(std::move(delegate)) {} | 40 : InfoBarAndroid(std::move(delegate)) {} |
| 40 | 41 |
| 41 ConfirmInfoBar::~ConfirmInfoBar() { | 42 ConfirmInfoBar::~ConfirmInfoBar() { |
| 42 } | 43 } |
| 43 | 44 |
| 44 base::android::ScopedJavaLocalRef<jobject> ConfirmInfoBar::CreateRenderInfoBar( | 45 base::android::ScopedJavaLocalRef<jobject> ConfirmInfoBar::CreateRenderInfoBar( |
| 45 JNIEnv* env) { | 46 JNIEnv* env) { |
| 46 base::android::ScopedJavaLocalRef<jstring> ok_button_text = | 47 base::android::ScopedJavaLocalRef<jstring> ok_button_text = |
| 47 base::android::ConvertUTF16ToJavaString( | 48 base::android::ConvertUTF16ToJavaString( |
| 48 env, GetTextFor(ConfirmInfoBarDelegate::BUTTON_OK)); | 49 env, GetTextFor(ConfirmInfoBarDelegate::BUTTON_OK)); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 return (delegate->GetButtons() & button) ? | 128 return (delegate->GetButtons() & button) ? |
| 128 delegate->GetButtonLabel(button) : base::string16(); | 129 delegate->GetButtonLabel(button) : base::string16(); |
| 129 } | 130 } |
| 130 | 131 |
| 131 | 132 |
| 132 // Native JNI methods --------------------------------------------------------- | 133 // Native JNI methods --------------------------------------------------------- |
| 133 | 134 |
| 134 bool RegisterConfirmInfoBar(JNIEnv* env) { | 135 bool RegisterConfirmInfoBar(JNIEnv* env) { |
| 135 return RegisterNativesImpl(env); | 136 return RegisterNativesImpl(env); |
| 136 } | 137 } |
| OLD | NEW |