OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_ANDROID_H_ |
6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_ANDROID_H_ | 6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_ANDROID_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/android/jni_weak_ref.h" | 10 #include "base/android/jni_weak_ref.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 private: | 82 private: |
83 ~TemplateUrlServiceAndroid() override; | 83 ~TemplateUrlServiceAndroid() override; |
84 | 84 |
85 void OnTemplateURLServiceLoaded(); | 85 void OnTemplateURLServiceLoaded(); |
86 | 86 |
87 // TemplateUrlServiceObserver: | 87 // TemplateUrlServiceObserver: |
88 void OnTemplateURLServiceChanged() override; | 88 void OnTemplateURLServiceChanged() override; |
89 | 89 |
90 // Updates |template_urls_| to contain all TemplateURLs. It sorts this list | 90 // Updates |template_urls_| to contain all TemplateURLs. It sorts this list |
91 // with prepopulated engines first, then any default non-prepopulated engine, | 91 // with prepopulated engines first, then any default non-prepopulated engine, |
92 // then other non-prepopulated engines. | 92 // then other non-prepopulated engines based on last_visited in the |
Peter Kasting
2016/12/06 06:24:55
Nit: remove "the"
ltian
2016/12/07 00:56:43
Done.
| |
93 // descending order. | |
93 void LoadTemplateURLs(); | 94 void LoadTemplateURLs(); |
94 | 95 |
96 // Counts the number of custom search engine needed to be remove from | |
97 // |template_urls_|. Android only shows top 5 most recently visited engines, | |
98 // the rest of custom search engine will be removed from |template_urls_|. | |
99 int CountRemovedSearchEngineNum(); | |
100 | |
95 JavaObjectWeakGlobalRef weak_java_obj_; | 101 JavaObjectWeakGlobalRef weak_java_obj_; |
96 | 102 |
97 // Pointer to the TemplateUrlService for the main profile. | 103 // Pointer to the TemplateUrlService for the main profile. |
98 TemplateURLService* template_url_service_; | 104 TemplateURLService* template_url_service_; |
99 | 105 |
100 std::unique_ptr<TemplateURLService::Subscription> template_url_subscription_; | 106 std::unique_ptr<TemplateURLService::Subscription> template_url_subscription_; |
101 | 107 |
102 // Caches the up-to-date TemplateURL list so that calls from Android could | 108 // Caches the up-to-date TemplateURL list so that calls from Android could |
103 // directly get data from it. | 109 // directly get data from it. |
104 std::vector<TemplateURL*> template_urls_; | 110 std::vector<TemplateURL*> template_urls_; |
105 | 111 |
106 DISALLOW_COPY_AND_ASSIGN(TemplateUrlServiceAndroid); | 112 DISALLOW_COPY_AND_ASSIGN(TemplateUrlServiceAndroid); |
107 }; | 113 }; |
108 | 114 |
109 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_ANDROID_H_ | 115 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_ANDROID_H_ |
OLD | NEW |