OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/ui/android/infobars/search_geolocation_disclosure_infob
ar.h" |
| 6 |
| 7 #include "base/android/jni_string.h" |
| 8 #include "chrome/browser/android/search_geolocation_disclosure_infobar_delegate.
h" |
| 9 #include "jni/SearchGeolocationDisclosureInfoBar_jni.h" |
| 10 |
| 11 using base::android::JavaParamRef; |
| 12 using base::android::ScopedJavaLocalRef; |
| 13 |
| 14 SearchGeolocationDisclosureInfoBar::SearchGeolocationDisclosureInfoBar( |
| 15 std::unique_ptr<SearchGeolocationDisclosureInfoBarDelegate> delegate) |
| 16 : InfoBarAndroid(std::move(delegate)) {} |
| 17 |
| 18 SearchGeolocationDisclosureInfoBar::~SearchGeolocationDisclosureInfoBar() { |
| 19 } |
| 20 |
| 21 ScopedJavaLocalRef<jobject> |
| 22 SearchGeolocationDisclosureInfoBar::CreateRenderInfoBar(JNIEnv* env) { |
| 23 ScopedJavaLocalRef<jstring> message_text = |
| 24 base::android::ConvertUTF16ToJavaString( |
| 25 env, GetDelegate()->GetMessageText()); |
| 26 return Java_SearchGeolocationDisclosureInfoBar_show( |
| 27 env, GetEnumeratedIconId(), message_text); |
| 28 } |
| 29 |
| 30 void SearchGeolocationDisclosureInfoBar::ProcessButton(int action) { |
| 31 if (!owner()) |
| 32 return; // We're closing; don't call anything, it might access the owner. |
| 33 |
| 34 RemoveSelf(); |
| 35 } |
| 36 |
| 37 SearchGeolocationDisclosureInfoBarDelegate* |
| 38 SearchGeolocationDisclosureInfoBar::GetDelegate() { |
| 39 return static_cast<SearchGeolocationDisclosureInfoBarDelegate*>(delegate()); |
| 40 } |
OLD | NEW |