OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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/search_geolocation_disclosure_infob
ar.h" | 5 #include "chrome/browser/ui/android/infobars/search_geolocation_disclosure_infob
ar.h" |
6 | 6 |
7 #include "base/android/jni_string.h" | 7 #include "base/android/jni_string.h" |
8 #include "chrome/browser/android/search_geolocation_disclosure_infobar_delegate.
h" | 8 #include "chrome/browser/android/search_geolocation_disclosure_infobar_delegate.
h" |
9 #include "jni/SearchGeolocationDisclosureInfoBar_jni.h" | 9 #include "jni/SearchGeolocationDisclosureInfoBar_jni.h" |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 GetDelegate()->inline_link_range().start(), | 28 GetDelegate()->inline_link_range().start(), |
29 GetDelegate()->inline_link_range().end()); | 29 GetDelegate()->inline_link_range().end()); |
30 } | 30 } |
31 | 31 |
32 void SearchGeolocationDisclosureInfoBar::OnLinkClicked( | 32 void SearchGeolocationDisclosureInfoBar::OnLinkClicked( |
33 JNIEnv* env, | 33 JNIEnv* env, |
34 const base::android::JavaParamRef<jobject>& obj) { | 34 const base::android::JavaParamRef<jobject>& obj) { |
35 if (!owner()) | 35 if (!owner()) |
36 return; // We're closing; don't call anything, it might access the owner. | 36 return; // We're closing; don't call anything, it might access the owner. |
37 | 37 |
38 // This counts as a dismissed so the dialog isn't shown again. | 38 GetDelegate()->RecordSettingsClicked(); |
39 delegate()->InfoBarDismissed(); | |
40 | 39 |
41 ScopedJavaLocalRef<jstring> search_url = | 40 ScopedJavaLocalRef<jstring> search_url = |
42 base::android::ConvertUTF8ToJavaString( | 41 base::android::ConvertUTF8ToJavaString( |
43 env, GetDelegate()->search_url().spec()); | 42 env, GetDelegate()->search_url().spec()); |
44 Java_SearchGeolocationDisclosureInfoBar_showSettingsPage(env, search_url); | 43 Java_SearchGeolocationDisclosureInfoBar_showSettingsPage(env, search_url); |
45 RemoveSelf(); | 44 RemoveSelf(); |
46 } | 45 } |
47 | 46 |
48 void SearchGeolocationDisclosureInfoBar::ProcessButton(int action) { | 47 void SearchGeolocationDisclosureInfoBar::ProcessButton(int action) { |
49 if (!owner()) | 48 if (!owner()) |
50 return; // We're closing; don't call anything, it might access the owner. | 49 return; // We're closing; don't call anything, it might access the owner. |
51 | 50 |
52 RemoveSelf(); | 51 RemoveSelf(); |
53 } | 52 } |
54 | 53 |
55 SearchGeolocationDisclosureInfoBarDelegate* | 54 SearchGeolocationDisclosureInfoBarDelegate* |
56 SearchGeolocationDisclosureInfoBar::GetDelegate() { | 55 SearchGeolocationDisclosureInfoBar::GetDelegate() { |
57 return static_cast<SearchGeolocationDisclosureInfoBarDelegate*>(delegate()); | 56 return static_cast<SearchGeolocationDisclosureInfoBarDelegate*>(delegate()); |
58 } | 57 } |
OLD | NEW |