| 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 "base/memory/ptr_util.h" |
| 15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 16 #include "chrome/browser/android/resource_mapper.h" | 16 #include "chrome/browser/android/resource_mapper.h" |
| 17 #include "chrome/browser/infobars/infobar_service.h" | 17 #include "chrome/browser/infobars/infobar_service.h" |
| 18 #include "chrome/browser/media/media_stream_infobar_delegate_android.h" | 18 #include "chrome/browser/media/media_stream_infobar_delegate_android.h" |
| 19 #include "chrome/browser/permissions/permission_infobar_delegate.h" | 19 #include "chrome/browser/permissions/permission_infobar_delegate.h" |
| 20 #include "components/content_settings/core/common/content_settings_types.h" | 20 #include "components/content_settings/core/common/content_settings_types.h" |
| 21 #include "components/infobars/core/confirm_infobar_delegate.h" | 21 #include "components/infobars/core/confirm_infobar_delegate.h" |
| 22 #include "content/public/browser/android/content_view_core.h" | 22 #include "content/public/browser/android/content_view_core.h" |
| 23 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
| 24 #include "jni/ConfirmInfoBar_jni.h" | 24 #include "jni/ConfirmInfoBar_jni.h" |
| 25 #include "ui/android/window_android.h" | 25 #include "ui/android/window_android.h" |
| 26 #include "ui/gfx/android/java_bitmap.h" | 26 #include "ui/gfx/android/java_bitmap.h" |
| 27 #include "ui/gfx/image/image.h" | 27 #include "ui/gfx/image/image.h" |
| 28 | 28 |
| 29 using base::android::JavaParamRef; |
| 30 using base::android::ScopedJavaLocalRef; |
| 31 |
| 29 // InfoBarService ------------------------------------------------------------- | 32 // InfoBarService ------------------------------------------------------------- |
| 30 | 33 |
| 31 std::unique_ptr<infobars::InfoBar> InfoBarService::CreateConfirmInfoBar( | 34 std::unique_ptr<infobars::InfoBar> InfoBarService::CreateConfirmInfoBar( |
| 32 std::unique_ptr<ConfirmInfoBarDelegate> delegate) { | 35 std::unique_ptr<ConfirmInfoBarDelegate> delegate) { |
| 33 return base::WrapUnique(new ConfirmInfoBar(std::move(delegate))); | 36 return base::WrapUnique(new ConfirmInfoBar(std::move(delegate))); |
| 34 } | 37 } |
| 35 | 38 |
| 36 | 39 |
| 37 // ConfirmInfoBar ------------------------------------------------------------- | 40 // ConfirmInfoBar ------------------------------------------------------------- |
| 38 | 41 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 ConfirmInfoBarDelegate* ConfirmInfoBar::GetDelegate() { | 114 ConfirmInfoBarDelegate* ConfirmInfoBar::GetDelegate() { |
| 112 return delegate()->AsConfirmInfoBarDelegate(); | 115 return delegate()->AsConfirmInfoBarDelegate(); |
| 113 } | 116 } |
| 114 | 117 |
| 115 base::string16 ConfirmInfoBar::GetTextFor( | 118 base::string16 ConfirmInfoBar::GetTextFor( |
| 116 ConfirmInfoBarDelegate::InfoBarButton button) { | 119 ConfirmInfoBarDelegate::InfoBarButton button) { |
| 117 ConfirmInfoBarDelegate* delegate = GetDelegate(); | 120 ConfirmInfoBarDelegate* delegate = GetDelegate(); |
| 118 return (delegate->GetButtons() & button) ? | 121 return (delegate->GetButtons() & button) ? |
| 119 delegate->GetButtonLabel(button) : base::string16(); | 122 delegate->GetButtonLabel(button) : base::string16(); |
| 120 } | 123 } |
| OLD | NEW |