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 #ifndef COMPONENTS_WEBDATA_COMMON_WEB_DATA_SERVICE_BASE_H_ | 5 #ifndef COMPONENTS_WEBDATA_COMMON_WEB_DATA_SERVICE_BASE_H_ |
6 #define COMPONENTS_WEBDATA_COMMON_WEB_DATA_SERVICE_BASE_H_ | 6 #define COMPONENTS_WEBDATA_COMMON_WEB_DATA_SERVICE_BASE_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // Unloads the database permanently and shuts down service. | 76 // Unloads the database permanently and shuts down service. |
77 void ShutdownDatabase(); | 77 void ShutdownDatabase(); |
78 | 78 |
79 virtual void AddDBObserver(WebDatabaseObserver* observer); | 79 virtual void AddDBObserver(WebDatabaseObserver* observer); |
80 virtual void RemoveDBObserver(WebDatabaseObserver* observer); | 80 virtual void RemoveDBObserver(WebDatabaseObserver* observer); |
81 | 81 |
82 // Returns true if the database load has completetd successfully, and | 82 // Returns true if the database load has completetd successfully, and |
83 // ShutdownOnUIThread has not yet been called. | 83 // ShutdownOnUIThread has not yet been called. |
84 virtual bool IsDatabaseLoaded(); | 84 virtual bool IsDatabaseLoaded(); |
85 | 85 |
86 // Returns a pointer to the DB (used by SyncableServices). May return NULL if | |
87 // the database is not loaded or otherwise unavailable. Must be called on | |
88 // DBThread. | |
89 virtual WebDatabase* GetDatabase(); | |
90 | |
91 protected: | 86 protected: |
92 virtual ~WebDataServiceBase(); | 87 virtual ~WebDataServiceBase(); |
93 | 88 |
94 // Our database service. | 89 // Our database service. |
95 scoped_refptr<WebDatabaseService> wdbs_; | 90 scoped_refptr<WebDatabaseService> wdbs_; |
96 | 91 |
97 // True if we've received a notification that the WebDatabase has loaded. | 92 // True if we've received a notification that the WebDatabase has loaded. |
98 bool db_loaded_; | 93 bool db_loaded_; |
99 | 94 |
100 private: | 95 private: |
101 friend struct content::BrowserThread::DeleteOnThread< | 96 friend struct content::BrowserThread::DeleteOnThread< |
102 content::BrowserThread::UI>; | 97 content::BrowserThread::UI>; |
103 friend class base::DeleteHelper<WebDataServiceBase>; | 98 friend class base::DeleteHelper<WebDataServiceBase>; |
104 // We have to friend RCTS<> so WIN shared-lib build is happy (crbug/112250). | 99 // We have to friend RCTS<> so WIN shared-lib build is happy (crbug/112250). |
105 friend class base::RefCountedThreadSafe<WebDataServiceBase, | 100 friend class base::RefCountedThreadSafe<WebDataServiceBase, |
106 content::BrowserThread::DeleteOnUIThread>; | 101 content::BrowserThread::DeleteOnUIThread>; |
107 | 102 |
108 ProfileErrorCallback profile_error_callback_; | 103 ProfileErrorCallback profile_error_callback_; |
109 }; | 104 }; |
110 | 105 |
111 #endif // COMPONENTS_WEBDATA_COMMON_WEB_DATA_SERVICE_BASE_H_ | 106 #endif // COMPONENTS_WEBDATA_COMMON_WEB_DATA_SERVICE_BASE_H_ |
OLD | NEW |