OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef CHROME_BROWSER_ANDROID_LOCALE_SPECIAL_LOCALE_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_LOCALE_SPECIAL_LOCALE_HANDLER_H_ |
6 #define CHROME_BROWSER_ANDROID_LOCALE_SPECIAL_LOCALE_HANDLER_H_ | 6 #define CHROME_BROWSER_ANDROID_LOCALE_SPECIAL_LOCALE_HANDLER_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 | 9 |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "components/search_engines/template_url.h" | 12 #include "components/search_engines/template_url.h" |
13 | 13 |
14 using base::android::JavaParamRef; | 14 using base::android::JavaParamRef; |
15 | 15 |
16 class TemplateURLService; | 16 class TemplateURLService; |
17 | 17 |
18 class SpecialLocaleHandler { | 18 class SpecialLocaleHandler { |
19 public: | 19 public: |
20 explicit SpecialLocaleHandler(const std::string& locale); | 20 explicit SpecialLocaleHandler(const std::string& locale); |
21 void Destroy(JNIEnv* env, const JavaParamRef<jobject>& obj); | 21 void Destroy(JNIEnv* env, const JavaParamRef<jobject>& obj); |
22 jboolean LoadTemplateUrls(JNIEnv* env, const JavaParamRef<jobject>& obj); | 22 jboolean LoadTemplateUrls(JNIEnv* env, const JavaParamRef<jobject>& obj); |
23 void RemoveTemplateUrls(JNIEnv* env, const JavaParamRef<jobject>& obj); | 23 void RemoveTemplateUrls(JNIEnv* env, const JavaParamRef<jobject>& obj); |
24 void OverrideDefaultSearchProvider(JNIEnv* env, | 24 void OverrideDefaultSearchProvider(JNIEnv* env, |
25 const JavaParamRef<jobject>& obj); | 25 const JavaParamRef<jobject>& obj); |
| 26 void SetGoogleAsDefaultSearch(JNIEnv* env, const JavaParamRef<jobject>& obj); |
26 | 27 |
27 private: | 28 private: |
28 virtual ~SpecialLocaleHandler(); | 29 virtual ~SpecialLocaleHandler(); |
29 | 30 |
30 std::string locale_; | 31 std::string locale_; |
31 | 32 |
32 // Tracks all local search engines that were added to TURL service. | 33 // Tracks all local search engines that were added to TURL service. |
33 std::vector<int> prepopulate_ids_; | 34 std::vector<int> prepopulate_ids_; |
34 | 35 |
35 // Pointer to the TemplateUrlService for the main profile. | 36 // Pointer to the TemplateUrlService for the main profile. |
36 TemplateURLService* template_url_service_; | 37 TemplateURLService* template_url_service_; |
37 | 38 |
38 DISALLOW_COPY_AND_ASSIGN(SpecialLocaleHandler); | 39 DISALLOW_COPY_AND_ASSIGN(SpecialLocaleHandler); |
39 }; | 40 }; |
40 | 41 |
41 bool RegisterSpecialLocaleHandler(JNIEnv* env); | 42 bool RegisterSpecialLocaleHandler(JNIEnv* env); |
42 | 43 |
43 #endif // CHROME_BROWSER_ANDROID_LOCALE_SPECIAL_LOCALE_HANDLER_H_ | 44 #endif // CHROME_BROWSER_ANDROID_LOCALE_SPECIAL_LOCALE_HANDLER_H_ |
OLD | NEW |