OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // constructor (except for testing). Use the Load method to trigger a load. | 54 // constructor (except for testing). Use the Load method to trigger a load. |
55 // When TemplateURLService has completed loading, observers are notified via | 55 // When TemplateURLService has completed loading, observers are notified via |
56 // OnTemplateURLServiceChanged as well as the TEMPLATE_URL_SERVICE_LOADED | 56 // OnTemplateURLServiceChanged as well as the TEMPLATE_URL_SERVICE_LOADED |
57 // notification message. | 57 // notification message. |
58 // | 58 // |
59 // TemplateURLService takes ownership of any TemplateURL passed to it. If there | 59 // TemplateURLService takes ownership of any TemplateURL passed to it. If there |
60 // is a WebDataService, deletion is handled by WebDataService, otherwise | 60 // is a WebDataService, deletion is handled by WebDataService, otherwise |
61 // TemplateURLService handles deletion. | 61 // TemplateURLService handles deletion. |
62 | 62 |
63 class TemplateURLService : public WebDataServiceConsumer, | 63 class TemplateURLService : public WebDataServiceConsumer, |
64 public ProfileKeyedService, | 64 public BrowserContextKeyedService, |
65 public content::NotificationObserver, | 65 public content::NotificationObserver, |
66 public syncer::SyncableService { | 66 public syncer::SyncableService { |
67 public: | 67 public: |
68 typedef std::map<std::string, std::string> QueryTerms; | 68 typedef std::map<std::string, std::string> QueryTerms; |
69 typedef std::vector<TemplateURL*> TemplateURLVector; | 69 typedef std::vector<TemplateURL*> TemplateURLVector; |
70 // Type for a static function pointer that acts as a time source. | 70 // Type for a static function pointer that acts as a time source. |
71 typedef base::Time(TimeProvider)(); | 71 typedef base::Time(TimeProvider)(); |
72 typedef std::map<std::string, syncer::SyncData> SyncDataMap; | 72 typedef std::map<std::string, syncer::SyncData> SyncDataMap; |
73 | 73 |
74 // Struct used for initializing the data store with fake data. | 74 // Struct used for initializing the data store with fake data. |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 // Also sets the out param to indicate whether the keyword belongs to an | 254 // Also sets the out param to indicate whether the keyword belongs to an |
255 // extension. | 255 // extension. |
256 string16 GetKeywordShortName(const string16& keyword, | 256 string16 GetKeywordShortName(const string16& keyword, |
257 bool* is_extension_keyword); | 257 bool* is_extension_keyword); |
258 | 258 |
259 // content::NotificationObserver implementation. | 259 // content::NotificationObserver implementation. |
260 virtual void Observe(int type, | 260 virtual void Observe(int type, |
261 const content::NotificationSource& source, | 261 const content::NotificationSource& source, |
262 const content::NotificationDetails& details) OVERRIDE; | 262 const content::NotificationDetails& details) OVERRIDE; |
263 | 263 |
264 // ProfileKeyedService implementation. | 264 // BrowserContextKeyedService implementation. |
265 virtual void Shutdown() OVERRIDE; | 265 virtual void Shutdown() OVERRIDE; |
266 | 266 |
267 // syncer::SyncableService implementation. | 267 // syncer::SyncableService implementation. |
268 | 268 |
269 // Returns all syncable TemplateURLs from this model as SyncData. This should | 269 // Returns all syncable TemplateURLs from this model as SyncData. This should |
270 // include every search engine and no Extension keywords. | 270 // include every search engine and no Extension keywords. |
271 virtual syncer::SyncDataList GetAllSyncData( | 271 virtual syncer::SyncDataList GetAllSyncData( |
272 syncer::ModelType type) const OVERRIDE; | 272 syncer::ModelType type) const OVERRIDE; |
273 // Process new search engine changes from Sync, merging them into our local | 273 // Process new search engine changes from Sync, merging them into our local |
274 // data. This may send notifications if local search engines are added, | 274 // data. This may send notifications if local search engines are added, |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 | 670 |
671 // This is used to log the origin of changes to the default search provider. | 671 // This is used to log the origin of changes to the default search provider. |
672 // We set this value to increasingly specific values when we know what is the | 672 // We set this value to increasingly specific values when we know what is the |
673 // cause/origin of a default search change. | 673 // cause/origin of a default search change. |
674 DefaultSearchChangeOrigin dsp_change_origin_; | 674 DefaultSearchChangeOrigin dsp_change_origin_; |
675 | 675 |
676 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); | 676 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); |
677 }; | 677 }; |
678 | 678 |
679 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ | 679 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ |
OLD | NEW |