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__ |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 friend class TemplateURLServiceTest; | 320 friend class TemplateURLServiceTest; |
321 friend class TemplateURLServiceTestingProfile; | 321 friend class TemplateURLServiceTestingProfile; |
322 friend class WebDataServiceTest; | 322 friend class WebDataServiceTest; |
323 friend class WebDataRequest; | 323 friend class WebDataRequest; |
324 | 324 |
325 virtual ~WebDataService(); | 325 virtual ~WebDataService(); |
326 | 326 |
327 // This is invoked by the unit test; path is the path of the Web Data file. | 327 // This is invoked by the unit test; path is the path of the Web Data file. |
328 bool InitWithPath(const FilePath& path); | 328 bool InitWithPath(const FilePath& path); |
329 | 329 |
330 // Invoked by request implementations when a request has been processed. | |
331 void RequestCompleted(Handle h); | |
332 | |
333 ////////////////////////////////////////////////////////////////////////////// | 330 ////////////////////////////////////////////////////////////////////////////// |
334 // | 331 // |
335 // The following methods are only invoked in the web data service thread. | 332 // The following methods are only invoked in the web data service thread. |
336 // | 333 // |
337 ////////////////////////////////////////////////////////////////////////////// | 334 ////////////////////////////////////////////////////////////////////////////// |
338 private: | 335 private: |
339 friend struct content::BrowserThread::DeleteOnThread< | 336 friend struct content::BrowserThread::DeleteOnThread< |
340 content::BrowserThread::UI>; | 337 content::BrowserThread::UI>; |
341 friend class base::DeleteHelper<WebDataService>; | 338 friend class base::DeleteHelper<WebDataService>; |
342 | 339 |
(...skipping 24 matching lines...) Expand all Loading... |
367 | 364 |
368 void ScheduleDBTask(const tracked_objects::Location& from_here, | 365 void ScheduleDBTask(const tracked_objects::Location& from_here, |
369 const base::Closure& task); | 366 const base::Closure& task); |
370 | 367 |
371 WebDataService::Handle ScheduleDBTaskWithResult( | 368 WebDataService::Handle ScheduleDBTaskWithResult( |
372 const tracked_objects::Location& from_here, | 369 const tracked_objects::Location& from_here, |
373 const ResultTask& task, | 370 const ResultTask& task, |
374 WebDataServiceConsumer* consumer); | 371 WebDataServiceConsumer* consumer); |
375 | 372 |
376 void DBTaskWrapper(const base::Closure& task, | 373 void DBTaskWrapper(const base::Closure& task, |
377 WebDataRequest* request); | 374 scoped_ptr<WebDataRequest> request); |
378 | 375 |
379 void DBResultTaskWrapper(const ResultTask& task, | 376 void DBResultTaskWrapper(const ResultTask& task, |
380 WebDataRequest* request); | 377 scoped_ptr<WebDataRequest> request); |
381 | 378 |
382 // Schedule a commit if one is not already pending. | 379 // Schedule a commit if one is not already pending. |
383 void ScheduleCommit(); | 380 void ScheduleCommit(); |
384 | 381 |
385 ////////////////////////////////////////////////////////////////////////////// | 382 ////////////////////////////////////////////////////////////////////////////// |
386 // | 383 // |
387 // Keywords. | 384 // Keywords. |
388 // | 385 // |
389 ////////////////////////////////////////////////////////////////////////////// | 386 ////////////////////////////////////////////////////////////////////////////// |
390 void AddKeywordImpl(const TemplateURLData& data); | 387 void AddKeywordImpl(const TemplateURLData& data); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 bool is_running_; | 479 bool is_running_; |
483 | 480 |
484 // The path with which to initialize the database. | 481 // The path with which to initialize the database. |
485 FilePath path_; | 482 FilePath path_; |
486 | 483 |
487 // Our database. We own the |db_|, but don't use a |scoped_ptr| because the | 484 // Our database. We own the |db_|, but don't use a |scoped_ptr| because the |
488 // |db_| lifetime must be managed on the database thread. | 485 // |db_| lifetime must be managed on the database thread. |
489 WebDatabase* db_; | 486 WebDatabase* db_; |
490 | 487 |
491 // Keeps track of all pending requests made to the db. | 488 // Keeps track of all pending requests made to the db. |
492 WebDataRequestManager request_manager_; | 489 scoped_refptr<WebDataRequestManager> request_manager_; |
493 | 490 |
494 // The application locale. The locale is needed for some database migrations, | 491 // The application locale. The locale is needed for some database migrations, |
495 // and must be read on the UI thread. It's cached here so that we can pass it | 492 // and must be read on the UI thread. It's cached here so that we can pass it |
496 // to the migration code on the DB thread. | 493 // to the migration code on the DB thread. |
497 const std::string app_locale_; | 494 const std::string app_locale_; |
498 | 495 |
499 // Syncable services for the database data. We own the services, but don't | 496 // Syncable services for the database data. We own the services, but don't |
500 // use |scoped_ptr|s because the lifetimes must be managed on the database | 497 // use |scoped_ptr|s because the lifetimes must be managed on the database |
501 // thread. | 498 // thread. |
502 // Currently only Autocomplete and Autofill profiles use the new Sync API, but | 499 // Currently only Autocomplete and Autofill profiles use the new Sync API, but |
503 // all the database data should migrate to this API over time. | 500 // all the database data should migrate to this API over time. |
504 AutocompleteSyncableService* autocomplete_syncable_service_; | 501 AutocompleteSyncableService* autocomplete_syncable_service_; |
505 AutofillProfileSyncableService* autofill_profile_syncable_service_; | 502 AutofillProfileSyncableService* autofill_profile_syncable_service_; |
506 | 503 |
507 // Whether the database failed to initialize. We use this to avoid | 504 // Whether the database failed to initialize. We use this to avoid |
508 // continually trying to reinit. | 505 // continually trying to reinit. |
509 bool failed_init_; | 506 bool failed_init_; |
510 | 507 |
511 // Whether we should commit the database. | 508 // Whether we should commit the database. |
512 bool should_commit_; | 509 bool should_commit_; |
513 | 510 |
514 // MessageLoop the WebDataService is created on. | 511 // MessageLoop the WebDataService is created on. |
515 MessageLoop* main_loop_; | 512 MessageLoop* main_loop_; |
516 | 513 |
517 DISALLOW_COPY_AND_ASSIGN(WebDataService); | 514 DISALLOW_COPY_AND_ASSIGN(WebDataService); |
518 }; | 515 }; |
519 | 516 |
520 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__ | 517 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__ |
OLD | NEW |