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

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

Issue 545175: Add the ability to save and remove AutoFill profiles from the AutoFillDialog.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 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
« no previous file with comments | « chrome/browser/profile.cc ('k') | chrome/browser/webdata/web_data_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_WEBDATA_WEB_DATA_SERVICE_H__ 5 #ifndef CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__
6 #define CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__ 6 #define CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 //////////////////////////////////////////////////////////////////////////////// 47 ////////////////////////////////////////////////////////////////////////////////
48 // 48 //
49 // WebDataService results 49 // WebDataService results
50 // 50 //
51 //////////////////////////////////////////////////////////////////////////////// 51 ////////////////////////////////////////////////////////////////////////////////
52 52
53 // 53 //
54 // Result types 54 // Result types
55 // 55 //
56 typedef enum { 56 typedef enum {
57 BOOL_RESULT = 1, // WDResult<bool> 57 BOOL_RESULT = 1, // WDResult<bool>
58 KEYWORDS_RESULT, // WDResult<WDKeywordsResult> 58 KEYWORDS_RESULT, // WDResult<WDKeywordsResult>
59 INT64_RESULT, // WDResult<int64> 59 INT64_RESULT, // WDResult<int64>
60 PASSWORD_RESULT, // WDResult<std::vector<PasswordForm*>> 60 PASSWORD_RESULT, // WDResult<std::vector<PasswordForm*>>
61 #if defined(OS_WIN) 61 #if defined(OS_WIN)
62 PASSWORD_IE7_RESULT, // WDResult<IE7PasswordInfo> 62 PASSWORD_IE7_RESULT, // WDResult<IE7PasswordInfo>
63 #endif 63 #endif
64 WEB_APP_IMAGES, // WDResult<WDAppImagesResult> 64 WEB_APP_IMAGES, // WDResult<WDAppImagesResult>
65 AUTOFILL_VALUE_RESULT, // WDResult<std::vector<string16>> 65 AUTOFILL_VALUE_RESULT, // WDResult<std::vector<string16>>
66 AUTOFILL_CHANGES, // WDResult<std::vector<AutofillChange>> 66 AUTOFILL_CHANGES, // WDResult<std::vector<AutofillChange>>
67 AUTOFILL_PROFILE_RESULT // WDResult<AutoFillProfile> 67 AUTOFILL_PROFILE_RESULT, // WDResult<AutoFillProfile>
68 AUTOFILL_PROFILES_RESULT // WDResult<std::vector<AutoFillProfile*>>
68 } WDResultType; 69 } WDResultType;
69 70
70 typedef std::vector<AutofillChange> AutofillChangeList; 71 typedef std::vector<AutofillChange> AutofillChangeList;
71 72
72 // Result from GetWebAppImages. 73 // Result from GetWebAppImages.
73 struct WDAppImagesResult { 74 struct WDAppImagesResult {
74 WDAppImagesResult() : has_all_images(false) {} 75 WDAppImagesResult() : has_all_images(false) {}
75 76
76 // True if SetWebAppHasAllImages(true) was invoked. 77 // True if SetWebAppHasAllImages(true) was invoked.
77 bool has_all_images; 78 bool has_all_images;
78 79
79 // The images, may be empty. 80 // The images, may be empty.
80 std::vector<SkBitmap> images; 81 std::vector<SkBitmap> images;
81 }; 82 };
82 83
83 struct WDKeywordsResult { 84 struct WDKeywordsResult {
84 std::vector<TemplateURL*> keywords; 85 std::vector<TemplateURL*> keywords;
85 // Identifies the ID of the TemplateURL that is the default search. A value of 86 // Identifies the ID of the TemplateURL that is the default search. A value of
86 // 0 indicates there is no default search provider. 87 // 0 indicates there is no default search provider.
87 int64 default_search_provider_id; 88 int64 default_search_provider_id;
88 // Version of the builin keywords. A value of 0 indicates a first run. 89 // Version of the built-in keywords. A value of 0 indicates a first run.
89 int builtin_keyword_version; 90 int builtin_keyword_version;
90 }; 91 };
91 92
92 // 93 //
93 // The top level class for a result. 94 // The top level class for a result.
94 // 95 //
95 class WDTypedResult { 96 class WDTypedResult {
96 public: 97 public:
97 virtual ~WDTypedResult() {} 98 virtual ~WDTypedResult() {}
98 99
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 void RemoveFormValueForElementName(const string16& name, 408 void RemoveFormValueForElementName(const string16& name,
408 const string16& value); 409 const string16& value);
409 410
410 // Schedules a task to add an AutoFill profile to the web database. 411 // Schedules a task to add an AutoFill profile to the web database.
411 void AddAutoFillProfile(const AutoFillProfile& profile); 412 void AddAutoFillProfile(const AutoFillProfile& profile);
412 413
413 // Schedules a task to update an AutoFill profile in the web database. 414 // Schedules a task to update an AutoFill profile in the web database.
414 void UpdateAutoFillProfile(const AutoFillProfile& profile); 415 void UpdateAutoFillProfile(const AutoFillProfile& profile);
415 416
416 // Schedules a task to remove an AutoFill profile from the web database. 417 // Schedules a task to remove an AutoFill profile from the web database.
417 void RemoveAutoFillProfile(const AutoFillProfile& profile); 418 // |profile_id| is the unique ID of the profile.
419 void RemoveAutoFillProfile(int profile_id);
418 420
419 // Initiates the request for an AutoFill profile with label |label. The 421 // Initiates the request for an AutoFill profile with label |label|. The
420 // method OnWebDataServiceRequestDone of |consumer| gets called back when the 422 // method OnWebDataServiceRequestDone of |consumer| gets called back when the
421 // request is finished, with the profile included in the argument |result|. 423 // request is finished, with the profile included in the argument |result|.
422 Handle GetAutoFillProfileForLabel(const string16& label, 424 Handle GetAutoFillProfileForLabel(const string16& label,
423 WebDataServiceConsumer* consumer); 425 WebDataServiceConsumer* consumer);
424 426
427 // Initiates the request for all AutoFill profiles. The method
428 // OnWebDataServiceRequestDone of |consumer| gets called when the request is
429 // finished, with the profiles included in the argument |result|. The
430 // consumer owns the profiles.
431 Handle GetAutoFillProfiles(WebDataServiceConsumer* consumer);
432
425 // Testing 433 // Testing
426 #ifdef UNIT_TEST 434 #ifdef UNIT_TEST
427 void set_failed_init(bool value) { failed_init_ = value; } 435 void set_failed_init(bool value) { failed_init_ = value; }
428 #endif 436 #endif
429 437
430 protected: 438 protected:
431 friend class TemplateURLModelTest; 439 friend class TemplateURLModelTest;
432 friend class TemplateURLModelTestingProfile; 440 friend class TemplateURLModelTestingProfile;
433 friend class WebDataServiceTest; 441 friend class WebDataServiceTest;
434 friend class WebDataRequest; 442 friend class WebDataRequest;
(...skipping 22 matching lines...) Expand all
457 std::vector<TemplateURL*> > SetKeywordsRequest; 465 std::vector<TemplateURL*> > SetKeywordsRequest;
458 466
459 ~WebDataService(); 467 ~WebDataService();
460 468
461 // Invoked on the main thread if initializing the db fails. 469 // Invoked on the main thread if initializing the db fails.
462 void DBInitFailed(sql::InitStatus init_status); 470 void DBInitFailed(sql::InitStatus init_status);
463 471
464 // Initialize the database, if it hasn't already been initialized. 472 // Initialize the database, if it hasn't already been initialized.
465 void InitializeDatabaseIfNecessary(); 473 void InitializeDatabaseIfNecessary();
466 474
475 // The notification method.
476 void NotifyDatabaseLoadedOnUIThread();
477
467 // Commit any pending transaction and deletes the database. 478 // Commit any pending transaction and deletes the database.
468 void ShutdownDatabase(); 479 void ShutdownDatabase();
469 480
470 // Commit the current transaction and creates a new one. 481 // Commit the current transaction and creates a new one.
471 void Commit(); 482 void Commit();
472 483
473 ////////////////////////////////////////////////////////////////////////////// 484 //////////////////////////////////////////////////////////////////////////////
474 // 485 //
475 // Keywords. 486 // Keywords.
476 // 487 //
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 void AddFormFieldValuesImpl( 520 void AddFormFieldValuesImpl(
510 GenericRequest<std::vector<webkit_glue::FormField> >* request); 521 GenericRequest<std::vector<webkit_glue::FormField> >* request);
511 void GetFormValuesForElementNameImpl(WebDataRequest* request, 522 void GetFormValuesForElementNameImpl(WebDataRequest* request,
512 const string16& name, const string16& prefix, int limit); 523 const string16& name, const string16& prefix, int limit);
513 void RemoveFormElementsAddedBetweenImpl( 524 void RemoveFormElementsAddedBetweenImpl(
514 GenericRequest2<base::Time, base::Time>* request); 525 GenericRequest2<base::Time, base::Time>* request);
515 void RemoveFormValueForElementNameImpl( 526 void RemoveFormValueForElementNameImpl(
516 GenericRequest2<string16, string16>* request); 527 GenericRequest2<string16, string16>* request);
517 void AddAutoFillProfileImpl(GenericRequest<AutoFillProfile>* request); 528 void AddAutoFillProfileImpl(GenericRequest<AutoFillProfile>* request);
518 void UpdateAutoFillProfileImpl(GenericRequest<AutoFillProfile>* request); 529 void UpdateAutoFillProfileImpl(GenericRequest<AutoFillProfile>* request);
519 void RemoveAutoFillProfileImpl(GenericRequest<AutoFillProfile>* request); 530 void RemoveAutoFillProfileImpl(GenericRequest<int>* request);
520 void GetAutoFillProfileForLabelImpl(WebDataRequest* request, 531 void GetAutoFillProfileForLabelImpl(WebDataRequest* request,
521 const string16& label); 532 const string16& label);
533 void GetAutoFillProfilesImpl(WebDataRequest* request);
522 534
523 ////////////////////////////////////////////////////////////////////////////// 535 //////////////////////////////////////////////////////////////////////////////
524 // 536 //
525 // Web Apps. 537 // Web Apps.
526 // 538 //
527 ////////////////////////////////////////////////////////////////////////////// 539 //////////////////////////////////////////////////////////////////////////////
528 540
529 void SetWebAppImageImpl(GenericRequest2<GURL, SkBitmap>* request); 541 void SetWebAppImageImpl(GenericRequest2<GURL, SkBitmap>* request);
530 542
531 void SetWebAppHasAllImagesImpl(GenericRequest2<GURL, bool>* request); 543 void SetWebAppHasAllImagesImpl(GenericRequest2<GURL, bool>* request);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 //////////////////////////////////////////////////////////////////////////////// 596 ////////////////////////////////////////////////////////////////////////////////
585 597
586 class WebDataServiceConsumer { 598 class WebDataServiceConsumer {
587 public: 599 public:
588 600
589 // Called when a request is done. h uniquely identifies the request. 601 // Called when a request is done. h uniquely identifies the request.
590 // result can be NULL, if no result is expected or if the database could 602 // result can be NULL, if no result is expected or if the database could
591 // not be opened. The result object is destroyed after this call. 603 // not be opened. The result object is destroyed after this call.
592 virtual void OnWebDataServiceRequestDone(WebDataService::Handle h, 604 virtual void OnWebDataServiceRequestDone(WebDataService::Handle h,
593 const WDTypedResult* result) = 0; 605 const WDTypedResult* result) = 0;
606
607 protected:
608 virtual ~WebDataServiceConsumer() {}
594 }; 609 };
595 610
596 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__ 611 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__
OLDNEW
« no previous file with comments | « chrome/browser/profile.cc ('k') | chrome/browser/webdata/web_data_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698