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/infobar_container_android.h" | 5 #include "chrome/browser/ui/android/infobars/infobar_container_android.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "chrome/browser/infobars/infobar.h" | 10 #include "chrome/browser/infobars/infobar.h" |
11 #include "chrome/browser/infobars/infobar_delegate.h" | 11 #include "chrome/browser/infobars/infobar_delegate.h" |
12 #include "chrome/browser/infobars/infobar_service.h" | 12 #include "chrome/browser/infobars/infobar_service.h" |
13 #include "chrome/browser/ui/android/infobars/auto_login_infobar_delegate.h" | 13 #include "chrome/browser/ui/android/infobars/auto_login_infobar_delegate_android
.h" |
14 #include "chrome/browser/ui/android/infobars/infobar_android.h" | 14 #include "chrome/browser/ui/android/infobars/infobar_android.h" |
15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
16 #include "jni/InfoBarContainer_jni.h" | 16 #include "jni/InfoBarContainer_jni.h" |
17 | 17 |
18 | 18 |
19 // InfoBarContainerAndroid ---------------------------------------------------- | 19 // InfoBarContainerAndroid ---------------------------------------------------- |
20 | 20 |
21 InfoBarContainerAndroid::InfoBarContainerAndroid(JNIEnv* env, | 21 InfoBarContainerAndroid::InfoBarContainerAndroid(JNIEnv* env, |
22 jobject obj, | 22 jobject obj, |
23 jobject auto_login_delegate) | 23 jobject auto_login_delegate) |
(...skipping 17 matching lines...) Expand all Loading... |
41 if (!android_bar) { | 41 if (!android_bar) { |
42 // TODO(bulach): CLANK: implement other types of InfoBars. | 42 // TODO(bulach): CLANK: implement other types of InfoBars. |
43 // TODO(jrg): this will always print out WARNING_TYPE as an int. | 43 // TODO(jrg): this will always print out WARNING_TYPE as an int. |
44 // Try and be more helpful. | 44 // Try and be more helpful. |
45 NOTIMPLEMENTED() << "CLANK: infobar type " | 45 NOTIMPLEMENTED() << "CLANK: infobar type " |
46 << infobar->delegate()->GetInfoBarType(); | 46 << infobar->delegate()->GetInfoBarType(); |
47 return; | 47 return; |
48 } | 48 } |
49 | 49 |
50 if (infobar->delegate()->AsAutoLoginInfoBarDelegate()) { | 50 if (infobar->delegate()->AsAutoLoginInfoBarDelegate()) { |
51 AutoLoginInfoBarDelegate* auto_login_delegate = | 51 AutoLoginInfoBarDelegateAndroid* auto_login_delegate = |
52 static_cast<AutoLoginInfoBarDelegate*>( | 52 static_cast<AutoLoginInfoBarDelegateAndroid*>( |
53 infobar->delegate()->AsAutoLoginInfoBarDelegate()); | 53 infobar->delegate()->AsAutoLoginInfoBarDelegate()); |
54 if (!auto_login_delegate->AttachAccount(weak_java_auto_login_delegate_)) | 54 if (!auto_login_delegate->AttachAccount(weak_java_auto_login_delegate_)) |
55 return; | 55 return; |
56 } | 56 } |
57 | 57 |
58 AttachJavaInfoBar(android_bar); | 58 AttachJavaInfoBar(android_bar); |
59 } | 59 } |
60 | 60 |
61 void InfoBarContainerAndroid::AttachJavaInfoBar(InfoBarAndroid* android_bar) { | 61 void InfoBarContainerAndroid::AttachJavaInfoBar(InfoBarAndroid* android_bar) { |
62 if (android_bar->HasSetJavaInfoBar()) | 62 if (android_bar->HasSetJavaInfoBar()) |
(...skipping 28 matching lines...) Expand all Loading... |
91 InfoBarContainerAndroid* infobar_container = | 91 InfoBarContainerAndroid* infobar_container = |
92 new InfoBarContainerAndroid(env, obj, auto_login_delegate); | 92 new InfoBarContainerAndroid(env, obj, auto_login_delegate); |
93 infobar_container->ChangeInfoBarService(InfoBarService::FromWebContents( | 93 infobar_container->ChangeInfoBarService(InfoBarService::FromWebContents( |
94 content::WebContents::FromJavaWebContents(web_contents))); | 94 content::WebContents::FromJavaWebContents(web_contents))); |
95 return reinterpret_cast<intptr_t>(infobar_container); | 95 return reinterpret_cast<intptr_t>(infobar_container); |
96 } | 96 } |
97 | 97 |
98 bool RegisterInfoBarContainer(JNIEnv* env) { | 98 bool RegisterInfoBarContainer(JNIEnv* env) { |
99 return RegisterNativesImpl(env); | 99 return RegisterNativesImpl(env); |
100 } | 100 } |
OLD | NEW |