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

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

Issue 7967024: Profile shouldn't own PersonalDataManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/browser/webdata/web_data_service.h" 5 #include "chrome/browser/webdata/web_data_service.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/task.h" 9 #include "base/task.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
(...skipping 24 matching lines...) Expand all
35 //////////////////////////////////////////////////////////////////////////////// 35 ////////////////////////////////////////////////////////////////////////////////
36 // 36 //
37 // WebDataService implementation. 37 // WebDataService implementation.
38 // 38 //
39 //////////////////////////////////////////////////////////////////////////////// 39 ////////////////////////////////////////////////////////////////////////////////
40 40
41 using base::Time; 41 using base::Time;
42 using webkit_glue::FormField; 42 using webkit_glue::FormField;
43 using webkit_glue::PasswordForm; 43 using webkit_glue::PasswordForm;
44 44
45 namespace {
46 // A task used by WebDataService (for Sync mainly) to inform the
47 // PersonalDataManager living on the UI thread that it needs to refresh.
48 class NotifyOfMultipleAutofillChangesTask : public Task {
49 public:
50 explicit NotifyOfMultipleAutofillChangesTask(
51 WebDataService* web_data_service);
52 virtual ~NotifyOfMultipleAutofillChangesTask();
53 virtual void Run();
54 private:
55 WebDataService* web_data_service_;
56 };
57
58 NotifyOfMultipleAutofillChangesTask::NotifyOfMultipleAutofillChangesTask(
59 WebDataService* web_data_service) : web_data_service_(web_data_service) {
60 }
61
62 NotifyOfMultipleAutofillChangesTask::~NotifyOfMultipleAutofillChangesTask() {}
63
64 void NotifyOfMultipleAutofillChangesTask::Run() {
65 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
66
67 NotificationService::current()->Notify(
68 chrome::NOTIFICATION_AUTOFILL_MULTIPLE_CHANGED,
69 Source<WebDataService>(web_data_service_),
70 NotificationService::NoDetails());
71 }
72
73 } // namespace
74
45 WDAppImagesResult::WDAppImagesResult() : has_all_images(false) {} 75 WDAppImagesResult::WDAppImagesResult() : has_all_images(false) {}
46 76
47 WDAppImagesResult::~WDAppImagesResult() {} 77 WDAppImagesResult::~WDAppImagesResult() {}
48 78
49 WDKeywordsResult::WDKeywordsResult() 79 WDKeywordsResult::WDKeywordsResult()
50 : default_search_provider_id(0), 80 : default_search_provider_id(0),
51 builtin_keyword_version(0) { 81 builtin_keyword_version(0) {
52 } 82 }
53 83
54 WDKeywordsResult::~WDKeywordsResult() {} 84 WDKeywordsResult::~WDKeywordsResult() {}
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 NULL, 582 NULL,
553 delete_begin, 583 delete_begin,
554 delete_end); 584 delete_end);
555 RegisterRequest(request); 585 RegisterRequest(request);
556 ScheduleTask(NewRunnableMethod( 586 ScheduleTask(NewRunnableMethod(
557 this, 587 this,
558 &WebDataService::RemoveAutofillProfilesAndCreditCardsModifiedBetweenImpl, 588 &WebDataService::RemoveAutofillProfilesAndCreditCardsModifiedBetweenImpl,
559 request)); 589 request));
560 } 590 }
561 591
592 void WebDataService::NotifyOfMultipleAutofillChanges() {
593 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
594 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
595 new NotifyOfMultipleAutofillChangesTask(this));
596 }
597
562 WebDataService::~WebDataService() { 598 WebDataService::~WebDataService() {
563 if (is_running_ && db_) { 599 if (is_running_ && db_) {
564 DLOG_ASSERT("WebDataService dtor called without Shutdown"); 600 DLOG_ASSERT("WebDataService dtor called without Shutdown");
565 } 601 }
566 } 602 }
567 603
568 bool WebDataService::InitWithPath(const FilePath& path) { 604 bool WebDataService::InitWithPath(const FilePath& path) {
569 path_ = path; 605 path_ = path;
570 is_running_ = true; 606 is_running_ = true;
571 ScheduleTask(NewRunnableMethod(this, 607 ScheduleTask(NewRunnableMethod(this,
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 return result_; 1475 return result_;
1440 } 1476 }
1441 1477
1442 void WebDataService::WebDataRequest::RequestComplete() { 1478 void WebDataService::WebDataRequest::RequestComplete() {
1443 WebDataService* s = service_; 1479 WebDataService* s = service_;
1444 Task* t = NewRunnableMethod(s, 1480 Task* t = NewRunnableMethod(s,
1445 &WebDataService::RequestCompleted, 1481 &WebDataService::RequestCompleted,
1446 handle_); 1482 handle_);
1447 message_loop_->PostTask(FROM_HERE, t); 1483 message_loop_->PostTask(FROM_HERE, t);
1448 } 1484 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698