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 // Chromium settings and storage represent user-selected preferences and | 5 // Chromium settings and storage represent user-selected preferences and |
6 // information and MUST not be extracted, overwritten or modified except | 6 // information and MUST not be extracted, overwritten or modified except |
7 // through Chromium defined APIs. | 7 // through Chromium defined APIs. |
8 | 8 |
9 #ifndef CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__ | 9 #ifndef CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__ |
10 #define CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__ | 10 #define CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__ |
11 #pragma once | 11 #pragma once |
12 | 12 |
13 #include <map> | 13 #include <map> |
14 #include <string> | 14 #include <string> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "base/callback_forward.h" | 17 #include "base/callback_forward.h" |
18 #include "base/file_path.h" | 18 #include "base/file_path.h" |
19 #include "base/location.h" | 19 #include "base/location.h" |
20 #include "base/message_loop_helpers.h" | 20 #include "base/message_loop_helpers.h" |
21 #include "base/memory/ref_counted.h" | 21 #include "base/memory/ref_counted.h" |
22 #include "base/synchronization/lock.h" | 22 #include "base/synchronization/lock.h" |
| 23 #include "chrome/browser/search_engines/template_url.h" |
23 #include "chrome/browser/search_engines/template_url_id.h" | 24 #include "chrome/browser/search_engines/template_url_id.h" |
24 #include "chrome/browser/webdata/keyword_table.h" | 25 #include "chrome/browser/webdata/keyword_table.h" |
25 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
26 #include "sql/init_status.h" | 27 #include "sql/init_status.h" |
27 | 28 |
28 class AutocompleteSyncableService; | 29 class AutocompleteSyncableService; |
29 class AutofillChange; | 30 class AutofillChange; |
30 class AutofillProfile; | 31 class AutofillProfile; |
31 class AutofillProfileSyncableService; | 32 class AutofillProfileSyncableService; |
32 class CreditCard; | 33 class CreditCard; |
33 struct DefaultWebIntentService; | 34 struct DefaultWebIntentService; |
34 class GURL; | 35 class GURL; |
35 #if defined(OS_WIN) | 36 #if defined(OS_WIN) |
36 struct IE7PasswordInfo; | 37 struct IE7PasswordInfo; |
37 #endif | 38 #endif |
38 class MessageLoop; | 39 class MessageLoop; |
39 class Profile; | 40 class Profile; |
40 class SkBitmap; | 41 class SkBitmap; |
41 class TemplateURL; | |
42 class WebDatabase; | 42 class WebDatabase; |
43 | 43 |
44 namespace base { | 44 namespace base { |
45 class Thread; | 45 class Thread; |
46 } | 46 } |
47 | 47 |
48 namespace webkit { | 48 namespace webkit { |
49 namespace forms { | 49 namespace forms { |
50 struct FormField; | 50 struct FormField; |
51 struct PasswordForm; | 51 struct PasswordForm; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 struct WDKeywordsResult { | 112 struct WDKeywordsResult { |
113 WDKeywordsResult(); | 113 WDKeywordsResult(); |
114 ~WDKeywordsResult(); | 114 ~WDKeywordsResult(); |
115 | 115 |
116 KeywordTable::Keywords keywords; | 116 KeywordTable::Keywords keywords; |
117 // Identifies the ID of the TemplateURL that is the default search. A value of | 117 // Identifies the ID of the TemplateURL that is the default search. A value of |
118 // 0 indicates there is no default search provider. | 118 // 0 indicates there is no default search provider. |
119 int64 default_search_provider_id; | 119 int64 default_search_provider_id; |
120 // Version of the built-in keywords. A value of 0 indicates a first run. | 120 // Version of the built-in keywords. A value of 0 indicates a first run. |
121 int builtin_keyword_version; | 121 int builtin_keyword_version; |
122 // Backup of the default search provider. NULL if the backup is invalid. | 122 // Backup of the default search provider, and whether the backup is valid. |
123 TemplateURL* default_search_provider_backup; | 123 bool backup_valid; |
| 124 TemplateURLData default_search_provider_backup; |
124 // Indicates if default search provider has been changed by something | 125 // Indicates if default search provider has been changed by something |
125 // other than user's action in the browser. | 126 // other than user's action in the browser. |
126 bool did_default_search_provider_change; | 127 bool did_default_search_provider_change; |
127 }; | 128 }; |
128 | 129 |
129 // | 130 // |
130 // The top level class for a result. | 131 // The top level class for a result. |
131 // | 132 // |
132 class WDTypedResult { | 133 class WDTypedResult { |
133 public: | 134 public: |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 // Keywords | 329 // Keywords |
329 // | 330 // |
330 ////////////////////////////////////////////////////////////////////////////// | 331 ////////////////////////////////////////////////////////////////////////////// |
331 | 332 |
332 // As the database processes requests at a later date, all deletion is | 333 // As the database processes requests at a later date, all deletion is |
333 // done on the background thread. | 334 // done on the background thread. |
334 // | 335 // |
335 // Many of the keyword related methods do not return a handle. This is because | 336 // Many of the keyword related methods do not return a handle. This is because |
336 // the caller (TemplateURLService) does not need to know when the request is | 337 // the caller (TemplateURLService) does not need to know when the request is |
337 // done. | 338 // done. |
| 339 |
338 void AddKeyword(const TemplateURL& url); | 340 void AddKeyword(const TemplateURL& url); |
339 | 341 void RemoveKeyword(TemplateURLID id); |
340 void RemoveKeyword(const TemplateURL& url); | |
341 | |
342 void UpdateKeyword(const TemplateURL& url); | 342 void UpdateKeyword(const TemplateURL& url); |
343 | 343 |
344 // Fetches the keywords. | 344 // Fetches the keywords. |
345 // On success, consumer is notified with WDResult<KeywordTable::Keywords>. | 345 // On success, consumer is notified with WDResult<KeywordTable::Keywords>. |
346 Handle GetKeywords(WebDataServiceConsumer* consumer); | 346 Handle GetKeywords(WebDataServiceConsumer* consumer); |
347 | 347 |
348 // Sets the keywords used for the default search provider. | 348 // Sets the keywords used for the default search provider. |
349 void SetDefaultSearchProvider(const TemplateURL* url); | 349 void SetDefaultSearchProvider(const TemplateURL* url); |
350 | 350 |
351 // Sets the version of the builtin keywords. | 351 // Sets the version of the builtin keywords. |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 ////////////////////////////////////////////////////////////////////////////// | 591 ////////////////////////////////////////////////////////////////////////////// |
592 // | 592 // |
593 // The following methods are only invoked in the web data service thread. | 593 // The following methods are only invoked in the web data service thread. |
594 // | 594 // |
595 ////////////////////////////////////////////////////////////////////////////// | 595 ////////////////////////////////////////////////////////////////////////////// |
596 private: | 596 private: |
597 friend struct content::BrowserThread::DeleteOnThread< | 597 friend struct content::BrowserThread::DeleteOnThread< |
598 content::BrowserThread::UI>; | 598 content::BrowserThread::UI>; |
599 friend class base::DeleteHelper<WebDataService>; | 599 friend class base::DeleteHelper<WebDataService>; |
600 | 600 |
601 typedef GenericRequest2<std::vector<const TemplateURL*>, | 601 typedef GenericRequest2<std::vector<const TemplateURLData*>, |
602 KeywordTable::Keywords> SetKeywordsRequest; | 602 KeywordTable::Keywords> SetKeywordsRequest; |
603 | 603 |
604 // Invoked on the main thread if initializing the db fails. | 604 // Invoked on the main thread if initializing the db fails. |
605 void DBInitFailed(sql::InitStatus init_status); | 605 void DBInitFailed(sql::InitStatus init_status); |
606 | 606 |
607 // Initialize the database, if it hasn't already been initialized. | 607 // Initialize the database, if it hasn't already been initialized. |
608 void InitializeDatabaseIfNecessary(); | 608 void InitializeDatabaseIfNecessary(); |
609 | 609 |
610 // Initialize any syncable services. | 610 // Initialize any syncable services. |
611 void InitializeSyncableServices(); | 611 void InitializeSyncableServices(); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 // result can be NULL, if no result is expected or if the database could | 785 // result can be NULL, if no result is expected or if the database could |
786 // not be opened. The result object is destroyed after this call. | 786 // not be opened. The result object is destroyed after this call. |
787 virtual void OnWebDataServiceRequestDone(WebDataService::Handle h, | 787 virtual void OnWebDataServiceRequestDone(WebDataService::Handle h, |
788 const WDTypedResult* result) = 0; | 788 const WDTypedResult* result) = 0; |
789 | 789 |
790 protected: | 790 protected: |
791 virtual ~WebDataServiceConsumer() {} | 791 virtual ~WebDataServiceConsumer() {} |
792 }; | 792 }; |
793 | 793 |
794 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__ | 794 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__ |
OLD | NEW |