Chromium Code Reviews| 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 SearchGeolocationDisclosureInfoBarDelegate* search_delegate = | |
| 24 delegate()->AsSearchGeolocationDisclosureInfoBarDelegate(); | |
|
Peter Kasting
2016/11/08 01:17:51
Nit: Use GetDelegate()
benwells
2016/11/08 02:53:40
Done.
| |
| 25 ScopedJavaLocalRef<jstring> message_text = | |
| 26 base::android::ConvertUTF16ToJavaString( | |
| 27 env, search_delegate->GetMessageText()); | |
| 28 return Java_SearchGeolocationDisclosureInfoBar_show( | |
| 29 env, GetEnumeratedIconId(), message_text); | |
| 30 } | |
| 31 | |
| 32 void SearchGeolocationDisclosureInfoBar::ProcessButton(int action) { | |
| 33 if (!owner()) | |
| 34 return; // We're closing; don't call anything, it might access the owner. | |
| 35 | |
| 36 RemoveSelf(); | |
| 37 } | |
| 38 | |
| 39 SearchGeolocationDisclosureInfoBarDelegate* | |
| 40 SearchGeolocationDisclosureInfoBar::GetDelegate() { | |
| 41 return delegate()->AsSearchGeolocationDisclosureInfoBarDelegate(); | |
|
Peter Kasting
2016/11/08 01:17:51
Don't add this virtual downcast method; you know t
benwells
2016/11/08 02:53:40
Cool, glad to hear that's the way its done :)
| |
| 42 } | |
| OLD | NEW |