| 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_android.h" |   5 #include "chrome/browser/ui/android/infobars/infobar_android.h" | 
|   6  |   6  | 
|   7 #include "base/android/jni_android.h" |   7 #include "base/android/jni_android.h" | 
|   8 #include "base/android/jni_string.h" |   8 #include "base/android/jni_string.h" | 
|   9 #include "base/strings/string_util.h" |   9 #include "base/strings/string_util.h" | 
|  10 #include "chrome/browser/android/resource_mapper.h" |  10 #include "chrome/browser/android/resource_mapper.h" | 
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  46  |  46  | 
|  47 jobject InfoBarAndroid::GetJavaInfoBar() { |  47 jobject InfoBarAndroid::GetJavaInfoBar() { | 
|  48   return java_info_bar_.obj(); |  48   return java_info_bar_.obj(); | 
|  49 } |  49 } | 
|  50  |  50  | 
|  51 bool InfoBarAndroid::HasSetJavaInfoBar() const { |  51 bool InfoBarAndroid::HasSetJavaInfoBar() const { | 
|  52   return !java_info_bar_.is_null(); |  52   return !java_info_bar_.is_null(); | 
|  53 } |  53 } | 
|  54  |  54  | 
|  55 void InfoBarAndroid::OnButtonClicked(JNIEnv* env, |  55 void InfoBarAndroid::OnButtonClicked(JNIEnv* env, | 
|  56                                      jobject obj, |  56                                      const JavaParamRef<jobject>& obj, | 
|  57                                      jint action) { |  57                                      jint action) { | 
|  58   ProcessButton(action); |  58   ProcessButton(action); | 
|  59 } |  59 } | 
|  60  |  60  | 
|  61 void InfoBarAndroid::OnCloseButtonClicked(JNIEnv* env, jobject obj) { |  61 void InfoBarAndroid::OnCloseButtonClicked(JNIEnv* env, | 
 |  62                                           const JavaParamRef<jobject>& obj) { | 
|  62   if (!owner()) |  63   if (!owner()) | 
|  63     return; // We're closing; don't call anything, it might access the owner. |  64     return; // We're closing; don't call anything, it might access the owner. | 
|  64   delegate()->InfoBarDismissed(); |  65   delegate()->InfoBarDismissed(); | 
|  65   RemoveSelf(); |  66   RemoveSelf(); | 
|  66 } |  67 } | 
|  67  |  68  | 
|  68 void InfoBarAndroid::CloseJavaInfoBar() { |  69 void InfoBarAndroid::CloseJavaInfoBar() { | 
|  69   if (!java_info_bar_.is_null()) { |  70   if (!java_info_bar_.is_null()) { | 
|  70     JNIEnv* env = base::android::AttachCurrentThread(); |  71     JNIEnv* env = base::android::AttachCurrentThread(); | 
|  71     Java_InfoBar_closeInfoBar(env, java_info_bar_.obj()); |  72     Java_InfoBar_closeInfoBar(env, java_info_bar_.obj()); | 
|  72   } |  73   } | 
|  73 } |  74 } | 
|  74  |  75  | 
|  75 int InfoBarAndroid::GetEnumeratedIconId() { |  76 int InfoBarAndroid::GetEnumeratedIconId() { | 
|  76   return ResourceMapper::MapFromChromiumId(delegate()->GetIconId()); |  77   return ResourceMapper::MapFromChromiumId(delegate()->GetIconId()); | 
|  77 } |  78 } | 
|  78  |  79  | 
|  79  |  80  | 
|  80 // Native JNI methods --------------------------------------------------------- |  81 // Native JNI methods --------------------------------------------------------- | 
|  81  |  82  | 
|  82 bool RegisterNativeInfoBar(JNIEnv* env) { |  83 bool RegisterNativeInfoBar(JNIEnv* env) { | 
|  83   return RegisterNativesImpl(env); |  84   return RegisterNativesImpl(env); | 
|  84 } |  85 } | 
| OLD | NEW |