| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ |
| 6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ | 6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 #if defined(UNIT_TEST) | 221 #if defined(UNIT_TEST) |
| 222 void set_loaded(bool value) { loaded_ = value; } | 222 void set_loaded(bool value) { loaded_ = value; } |
| 223 #endif | 223 #endif |
| 224 | 224 |
| 225 // Whether or not the keywords have been loaded. | 225 // Whether or not the keywords have been loaded. |
| 226 bool loaded() { return loaded_; } | 226 bool loaded() { return loaded_; } |
| 227 | 227 |
| 228 // Notification that the keywords have been loaded. | 228 // Notification that the keywords have been loaded. |
| 229 // This is invoked from WebDataService, and should not be directly | 229 // This is invoked from WebDataService, and should not be directly |
| 230 // invoked. | 230 // invoked. |
| 231 virtual void OnWebDataServiceRequestDone(WebDataService::Handle h, | 231 virtual void OnWebDataServiceRequestDone( |
| 232 const WDTypedResult* result); | 232 WebDataService::Handle h, |
| 233 const WDTypedResult* result) OVERRIDE; |
| 233 | 234 |
| 234 // Returns the locale-direction-adjusted short name for the given keyword. | 235 // Returns the locale-direction-adjusted short name for the given keyword. |
| 235 // Also sets the out param to indicate whether the keyword belongs to an | 236 // Also sets the out param to indicate whether the keyword belongs to an |
| 236 // extension. | 237 // extension. |
| 237 string16 GetKeywordShortName(const string16& keyword, | 238 string16 GetKeywordShortName(const string16& keyword, |
| 238 bool* is_extension_keyword); | 239 bool* is_extension_keyword); |
| 239 | 240 |
| 240 // content::NotificationObserver method. TemplateURLService listens for three | 241 // content::NotificationObserver method. TemplateURLService listens for three |
| 241 // notification types: | 242 // notification types: |
| 242 // . NOTIFY_HISTORY_URL_VISITED: adds keyword search terms if the visit | 243 // . NOTIFY_HISTORY_URL_VISITED: adds keyword search terms if the visit |
| 243 // corresponds to a keyword. | 244 // corresponds to a keyword. |
| 244 // . NOTIFY_GOOGLE_URL_UPDATED: updates mapping for any keywords containing | 245 // . NOTIFY_GOOGLE_URL_UPDATED: updates mapping for any keywords containing |
| 245 // a google base url replacement term. | 246 // a google base url replacement term. |
| 246 // . PREF_CHANGED: checks whether the default search engine has changed. | 247 // . PREF_CHANGED: checks whether the default search engine has changed. |
| 247 virtual void Observe(int type, | 248 virtual void Observe(int type, |
| 248 const content::NotificationSource& source, | 249 const content::NotificationSource& source, |
| 249 const content::NotificationDetails& details); | 250 const content::NotificationDetails& details) OVERRIDE; |
| 250 | 251 |
| 251 // SyncableService implementation. | 252 // SyncableService implementation. |
| 252 | 253 |
| 253 // Returns all syncable TemplateURLs from this model as SyncData. This should | 254 // Returns all syncable TemplateURLs from this model as SyncData. This should |
| 254 // include every search engine and no Extension keywords. | 255 // include every search engine and no Extension keywords. |
| 255 virtual SyncDataList GetAllSyncData(syncable::ModelType type) const OVERRIDE; | 256 virtual SyncDataList GetAllSyncData(syncable::ModelType type) const OVERRIDE; |
| 256 // Process new search engine changes from Sync, merging them into our local | 257 // Process new search engine changes from Sync, merging them into our local |
| 257 // data. This may send notifications if local search engines are added, | 258 // data. This may send notifications if local search engines are added, |
| 258 // updated or removed. | 259 // updated or removed. |
| 259 virtual SyncError ProcessSyncChanges( | 260 virtual SyncError ProcessSyncChanges( |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 // from Sync. This is to facilitate the fact that changes to the value of | 589 // from Sync. This is to facilitate the fact that changes to the value of |
| 589 // prefs::kSyncedDefaultSearchProviderGUID do not always come before the | 590 // prefs::kSyncedDefaultSearchProviderGUID do not always come before the |
| 590 // TemplateURL entry it refers to, and to handle the case when we want to use | 591 // TemplateURL entry it refers to, and to handle the case when we want to use |
| 591 // the Synced default when the default search provider becomes unmanaged. | 592 // the Synced default when the default search provider becomes unmanaged. |
| 592 bool pending_synced_default_search_; | 593 bool pending_synced_default_search_; |
| 593 | 594 |
| 594 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); | 595 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); |
| 595 }; | 596 }; |
| 596 | 597 |
| 597 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ | 598 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ |
| OLD | NEW |