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" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 | 84 |
85 // Native JNI methods --------------------------------------------------------- | 85 // Native JNI methods --------------------------------------------------------- |
86 | 86 |
87 static jlong Init(JNIEnv* env, | 87 static jlong Init(JNIEnv* env, |
88 jobject obj, | 88 jobject obj, |
89 jobject web_contents, | 89 jobject web_contents, |
90 jobject auto_login_delegate) { | 90 jobject auto_login_delegate) { |
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 InfoBarManager* infobar_manager = NULL; |
94 content::WebContents::FromJavaWebContents(web_contents))); | 94 InfoBarService* infobar_service = InfoBarService::FromWebContents( |
| 95 content::WebContents::FromJavaWebContents(web_contents)); |
| 96 if (infobar_service) |
| 97 infobar_manager = infobar_service->infobar_manager(); |
| 98 infobar_container->ChangeInfoBarManager(infobar_manager); |
95 return reinterpret_cast<intptr_t>(infobar_container); | 99 return reinterpret_cast<intptr_t>(infobar_container); |
96 } | 100 } |
97 | 101 |
98 bool RegisterInfoBarContainer(JNIEnv* env) { | 102 bool RegisterInfoBarContainer(JNIEnv* env) { |
99 return RegisterNativesImpl(env); | 103 return RegisterNativesImpl(env); |
100 } | 104 } |
OLD | NEW |