| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_TEMPLATE_URL_MODEL_H_ | 5 #ifndef CHROME_BROWSER_TEMPLATE_URL_MODEL_H__ |
| 6 #define CHROME_BROWSER_TEMPLATE_URL_MODEL_H_ | 6 #define CHROME_BROWSER_TEMPLATE_URL_MODEL_H__ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
| 13 #include "chrome/browser/history/history_notifications.h" | 13 #include "chrome/browser/history/history_notifications.h" |
| 14 #include "chrome/browser/history/history_types.h" | 14 #include "chrome/browser/history/history_types.h" |
| 15 #include "chrome/browser/webdata/web_data_service.h" | 15 #include "chrome/browser/webdata/web_data_service.h" |
| 16 #include "chrome/common/notification_registrar.h" | 16 #include "chrome/common/notification_registrar.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 41 // TemplateURLModel takes ownership of any TemplateURL passed to it. If there | 41 // TemplateURLModel takes ownership of any TemplateURL passed to it. If there |
| 42 // is a WebDataService, deletion is handled by WebDataService, otherwise | 42 // is a WebDataService, deletion is handled by WebDataService, otherwise |
| 43 // TemplateURLModel handles deletion. | 43 // TemplateURLModel handles deletion. |
| 44 | 44 |
| 45 // TemplateURLModelObserver is notified whenever the set of TemplateURLs | 45 // TemplateURLModelObserver is notified whenever the set of TemplateURLs |
| 46 // are modified. | 46 // are modified. |
| 47 class TemplateURLModelObserver { | 47 class TemplateURLModelObserver { |
| 48 public: | 48 public: |
| 49 // Notification that the template url model has changed in some way. | 49 // Notification that the template url model has changed in some way. |
| 50 virtual void OnTemplateURLModelChanged() = 0; | 50 virtual void OnTemplateURLModelChanged() = 0; |
| 51 protected: | |
| 52 ~TemplateURLModelObserver() {} | |
| 53 }; | 51 }; |
| 54 | 52 |
| 55 class TemplateURLModel : public WebDataServiceConsumer, | 53 class TemplateURLModel : public WebDataServiceConsumer, |
| 56 public NotificationObserver { | 54 public NotificationObserver { |
| 57 public: | 55 public: |
| 58 typedef std::map<std::string, std::string> QueryTerms; | 56 typedef std::map<std::string, std::string> QueryTerms; |
| 59 | 57 |
| 60 // Struct used for initializing the data store with fake data. | 58 // Struct used for initializing the data store with fake data. |
| 61 // Each initializer is mapped to a TemplateURL. | 59 // Each initializer is mapped to a TemplateURL. |
| 62 struct Initializer { | 60 struct Initializer { |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 // this is not used. | 344 // this is not used. |
| 347 scoped_ptr<TemplateURL> prefs_default_search_provider_; | 345 scoped_ptr<TemplateURL> prefs_default_search_provider_; |
| 348 | 346 |
| 349 // ID assigned to next TemplateURL added to this model. This is an ever | 347 // ID assigned to next TemplateURL added to this model. This is an ever |
| 350 // increasing integer that is initialized from the database. | 348 // increasing integer that is initialized from the database. |
| 351 TemplateURL::IDType next_id_; | 349 TemplateURL::IDType next_id_; |
| 352 | 350 |
| 353 DISALLOW_EVIL_CONSTRUCTORS(TemplateURLModel); | 351 DISALLOW_EVIL_CONSTRUCTORS(TemplateURLModel); |
| 354 }; | 352 }; |
| 355 | 353 |
| 356 #endif // CHROME_BROWSER_TEMPLATE_URL_MODEL_H_ | 354 #endif // CHROME_BROWSER_TEMPLATE_URL_MODEL_H__ |
| OLD | NEW |