Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: chrome/browser/ui/android/infobars/confirm_infobar.cc

Issue 1392023004: Rename android only infobars (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: try again Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <vector> 7 #include <vector>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
11 #include "base/android/jni_string.h" 11 #include "base/android/jni_string.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "chrome/browser/android/resource_mapper.h" 13 #include "chrome/browser/android/resource_mapper.h"
14 #include "chrome/browser/infobars/infobar_service.h" 14 #include "chrome/browser/infobars/infobar_service.h"
15 #include "chrome/browser/media/media_stream_infobar_delegate.h"
16 #include "chrome/browser/permissions/permission_infobar_delegate.h" 15 #include "chrome/browser/permissions/permission_infobar_delegate.h"
17 #include "components/content_settings/core/common/content_settings_types.h" 16 #include "components/content_settings/core/common/content_settings_types.h"
18 #include "components/infobars/core/confirm_infobar_delegate.h" 17 #include "components/infobars/core/confirm_infobar_delegate.h"
19 #include "content/public/browser/android/content_view_core.h" 18 #include "content/public/browser/android/content_view_core.h"
20 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
21 #include "jni/ConfirmInfoBarDelegate_jni.h" 20 #include "jni/ConfirmInfoBarDelegate_jni.h"
22 #include "ui/android/window_android.h" 21 #include "ui/android/window_android.h"
23 #include "ui/gfx/android/java_bitmap.h" 22 #include "ui/gfx/android/java_bitmap.h"
24 #include "ui/gfx/image/image.h" 23 #include "ui/gfx/image/image.h"
25 24
25 #if defined(OS_ANDROID)
26 #include "chrome/browser/media/media_stream_infobar_delegate_android.h"
27 #endif
28
26 // InfoBarService ------------------------------------------------------------- 29 // InfoBarService -------------------------------------------------------------
27 30
28 scoped_ptr<infobars::InfoBar> InfoBarService::CreateConfirmInfoBar( 31 scoped_ptr<infobars::InfoBar> InfoBarService::CreateConfirmInfoBar(
29 scoped_ptr<ConfirmInfoBarDelegate> delegate) { 32 scoped_ptr<ConfirmInfoBarDelegate> delegate) {
30 return make_scoped_ptr(new ConfirmInfoBar(delegate.Pass())); 33 return make_scoped_ptr(new ConfirmInfoBar(delegate.Pass()));
31 } 34 }
32 35
33 36
34 // ConfirmInfoBar ------------------------------------------------------------- 37 // ConfirmInfoBar -------------------------------------------------------------
35 38
(...skipping 24 matching lines...) Expand all
60 ScopedJavaLocalRef<jobject> java_bitmap; 63 ScopedJavaLocalRef<jobject> java_bitmap;
61 if (delegate->GetIconId() == infobars::InfoBarDelegate::kNoIconID && 64 if (delegate->GetIconId() == infobars::InfoBarDelegate::kNoIconID &&
62 !delegate->GetIcon().IsEmpty()) { 65 !delegate->GetIcon().IsEmpty()) {
63 java_bitmap = gfx::ConvertToJavaBitmap(delegate->GetIcon().ToSkBitmap()); 66 java_bitmap = gfx::ConvertToJavaBitmap(delegate->GetIcon().ToSkBitmap());
64 } 67 }
65 68
66 std::vector<int> content_settings; 69 std::vector<int> content_settings;
67 if (delegate->AsPermissionInfobarDelegate()) { 70 if (delegate->AsPermissionInfobarDelegate()) {
68 content_settings.push_back( 71 content_settings.push_back(
69 delegate->AsPermissionInfobarDelegate()->content_setting()); 72 delegate->AsPermissionInfobarDelegate()->content_setting());
70 } else if (delegate->AsMediaStreamInfoBarDelegate()) { 73 #if defined(OS_ANDROID)
71 MediaStreamInfoBarDelegate* media_delegate = 74 } else if (delegate->AsMediaStreamInfoBarDelegateAndroid()) {
72 delegate->AsMediaStreamInfoBarDelegate(); 75 MediaStreamInfoBarDelegateAndroid* media_delegate =
76 delegate->AsMediaStreamInfoBarDelegateAndroid();
73 if (media_delegate->IsRequestingVideoAccess()) { 77 if (media_delegate->IsRequestingVideoAccess()) {
74 content_settings.push_back( 78 content_settings.push_back(
75 ContentSettingsType::CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); 79 ContentSettingsType::CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA);
76 } 80 }
77 if (media_delegate->IsRequestingMicrophoneAccess()) { 81 if (media_delegate->IsRequestingMicrophoneAccess()) {
78 content_settings.push_back( 82 content_settings.push_back(
79 ContentSettingsType::CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); 83 ContentSettingsType::CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC);
80 } 84 }
85 #endif
81 } 86 }
82 87
83 content::WebContents* web_contents = 88 content::WebContents* web_contents =
84 InfoBarService::WebContentsFromInfoBar(this); 89 InfoBarService::WebContentsFromInfoBar(this);
85 DCHECK(web_contents); 90 DCHECK(web_contents);
86 content::ContentViewCore* cvc = 91 content::ContentViewCore* cvc =
87 content::ContentViewCore::FromWebContents(web_contents); 92 content::ContentViewCore::FromWebContents(web_contents);
88 DCHECK(cvc); 93 DCHECK(cvc);
89 base::android::ScopedJavaLocalRef<jobject> jwindow_android = 94 base::android::ScopedJavaLocalRef<jobject> jwindow_android =
90 cvc->GetWindowAndroid()->GetJavaObject(); 95 cvc->GetWindowAndroid()->GetJavaObject();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 return (delegate->GetButtons() & button) ? 132 return (delegate->GetButtons() & button) ?
128 delegate->GetButtonLabel(button) : base::string16(); 133 delegate->GetButtonLabel(button) : base::string16();
129 } 134 }
130 135
131 136
132 // Native JNI methods --------------------------------------------------------- 137 // Native JNI methods ---------------------------------------------------------
133 138
134 bool RegisterConfirmInfoBarDelegate(JNIEnv* env) { 139 bool RegisterConfirmInfoBarDelegate(JNIEnv* env) {
135 return RegisterNativesImpl(env); 140 return RegisterNativesImpl(env);
136 } 141 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698