Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: chrome/browser/webdata/web_data_service.h

Issue 10021008: Reland r131019: Move most TemplateURL data members to a new struct, TemplateURLData. This allows us… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 ////////////////////////////////////////////////////////////////////////////// 592 //////////////////////////////////////////////////////////////////////////////
593 // 593 //
594 // The following methods are only invoked in the web data service thread. 594 // The following methods are only invoked in the web data service thread.
595 // 595 //
596 ////////////////////////////////////////////////////////////////////////////// 596 //////////////////////////////////////////////////////////////////////////////
597 private: 597 private:
598 friend struct content::BrowserThread::DeleteOnThread< 598 friend struct content::BrowserThread::DeleteOnThread<
599 content::BrowserThread::UI>; 599 content::BrowserThread::UI>;
600 friend class base::DeleteHelper<WebDataService>; 600 friend class base::DeleteHelper<WebDataService>;
601 601
602 typedef GenericRequest2<std::vector<const TemplateURL*>, 602 typedef GenericRequest2<std::vector<const TemplateURLData*>,
603 KeywordTable::Keywords> SetKeywordsRequest; 603 KeywordTable::Keywords> SetKeywordsRequest;
604 604
605 // Invoked on the main thread if initializing the db fails. 605 // Invoked on the main thread if initializing the db fails.
606 void DBInitFailed(sql::InitStatus init_status); 606 void DBInitFailed(sql::InitStatus init_status);
607 607
608 // Initialize the database, if it hasn't already been initialized. 608 // Initialize the database, if it hasn't already been initialized.
609 void InitializeDatabaseIfNecessary(); 609 void InitializeDatabaseIfNecessary();
610 610
611 // Initialize any syncable services. 611 // Initialize any syncable services.
612 void InitializeSyncableServices(); 612 void InitializeSyncableServices();
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 // result can be NULL, if no result is expected or if the database could 787 // result can be NULL, if no result is expected or if the database could
788 // not be opened. The result object is destroyed after this call. 788 // not be opened. The result object is destroyed after this call.
789 virtual void OnWebDataServiceRequestDone(WebDataService::Handle h, 789 virtual void OnWebDataServiceRequestDone(WebDataService::Handle h,
790 const WDTypedResult* result) = 0; 790 const WDTypedResult* result) = 0;
791 791
792 protected: 792 protected:
793 virtual ~WebDataServiceConsumer() {} 793 virtual ~WebDataServiceConsumer() {}
794 }; 794 };
795 795
796 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__ 796 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__
OLDNEW
« no previous file with comments | « chrome/browser/webdata/keyword_table_unittest.cc ('k') | chrome/browser/webdata/web_data_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698