OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_IN_PROCESS_WEBKIT_WEBKIT_CONTEXT_H_ | 5 #ifndef CHROME_BROWSER_IN_PROCESS_WEBKIT_WEBKIT_CONTEXT_H_ |
6 #define CHROME_BROWSER_IN_PROCESS_WEBKIT_WEBKIT_CONTEXT_H_ | 6 #define CHROME_BROWSER_IN_PROCESS_WEBKIT_WEBKIT_CONTEXT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
12 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "chrome/browser/in_process_webkit/dom_storage_context.h" | 15 #include "chrome/browser/in_process_webkit/dom_storage_context.h" |
16 #include "chrome/browser/in_process_webkit/indexed_db_context.h" | 16 #include "chrome/browser/in_process_webkit/indexed_db_context.h" |
17 #include "chrome/browser/prefs/pref_change_registrar.h" | |
18 #include "chrome/common/notification_observer.h" | |
17 | 19 |
18 class Profile; | 20 class Profile; |
19 | 21 |
20 // There's one WebKitContext per profile. Various DispatcherHost classes | 22 // There's one WebKitContext per profile. Various DispatcherHost classes |
21 // have a pointer to the Context to store shared state. Unfortunately, this | 23 // have a pointer to the Context to store shared state. Unfortunately, this |
22 // class has become a bit of a dumping ground for calls made on the UI thread | 24 // class has become a bit of a dumping ground for calls made on the UI thread |
23 // that need to be proxied over to the WebKit thread. | 25 // that need to be proxied over to the WebKit thread. |
24 // | 26 // |
25 // This class is created on the UI thread and accessed on the UI, IO, and WebKit | 27 // This class is created on the UI thread and accessed on the UI, IO, and WebKit |
26 // threads. | 28 // threads. |
27 class WebKitContext : public base::RefCountedThreadSafe<WebKitContext> { | 29 class WebKitContext |
30 : public base::RefCountedThreadSafe<WebKitContext>, | |
31 public NotificationObserver { | |
28 public: | 32 public: |
29 explicit WebKitContext(Profile* profile); | 33 explicit WebKitContext(Profile* profile); |
30 | 34 |
31 const FilePath& data_path() const { return data_path_; } | 35 const FilePath& data_path() const { return data_path_; } |
32 bool is_incognito() const { return is_incognito_; } | 36 bool is_incognito() const { return is_incognito_; } |
33 | 37 |
34 DOMStorageContext* dom_storage_context() { | 38 DOMStorageContext* dom_storage_context() { |
35 return dom_storage_context_.get(); | 39 return dom_storage_context_.get(); |
36 } | 40 } |
37 | 41 |
(...skipping 15 matching lines...) Expand all Loading... | |
53 // Tell all children (where applicable) to delete any objects that were | 57 // Tell all children (where applicable) to delete any objects that were |
54 // last modified on or after the following time. | 58 // last modified on or after the following time. |
55 void DeleteDataModifiedSince(const base::Time& cutoff, | 59 void DeleteDataModifiedSince(const base::Time& cutoff, |
56 const char* url_scheme_to_be_skipped, | 60 const char* url_scheme_to_be_skipped, |
57 const std::vector<string16>& protected_origins); | 61 const std::vector<string16>& protected_origins); |
58 | 62 |
59 // Delete the session storage namespace associated with this id. Can be | 63 // Delete the session storage namespace associated with this id. Can be |
60 // called from any thread. | 64 // called from any thread. |
61 void DeleteSessionStorageNamespace(int64 session_storage_namespace_id); | 65 void DeleteSessionStorageNamespace(int64 session_storage_namespace_id); |
62 | 66 |
67 // NotificationObserver implementation. | |
68 virtual void Observe(NotificationType type, | |
69 const NotificationSource& source, | |
70 const NotificationDetails& details); | |
71 | |
63 private: | 72 private: |
64 friend class base::RefCountedThreadSafe<WebKitContext>; | 73 friend class base::RefCountedThreadSafe<WebKitContext>; |
65 ~WebKitContext(); | 74 ~WebKitContext(); |
jochen (gone - plz use gerrit)
2010/11/29 10:45:24
please make this virtual
pastarmovj
2010/11/29 12:50:37
Done.
| |
66 | 75 |
67 // Copies of profile data that can be accessed on any thread. | 76 // Copies of profile data that can be accessed on any thread. |
68 const FilePath data_path_; | 77 const FilePath data_path_; |
69 const bool is_incognito_; | 78 const bool is_incognito_; |
70 | 79 |
80 // True if the destructors of context objects should delete their files. | |
81 bool clear_local_state_on_exit_; | |
82 | |
83 // The observer needs to extract the new value of the pref when notified. | |
84 Profile* profile_; | |
85 | |
86 PrefChangeRegistrar pref_change_registrar_; | |
87 | |
71 scoped_ptr<DOMStorageContext> dom_storage_context_; | 88 scoped_ptr<DOMStorageContext> dom_storage_context_; |
72 | 89 |
73 scoped_ptr<IndexedDBContext> indexed_db_context_; | 90 scoped_ptr<IndexedDBContext> indexed_db_context_; |
74 | 91 |
75 DISALLOW_IMPLICIT_CONSTRUCTORS(WebKitContext); | 92 DISALLOW_IMPLICIT_CONSTRUCTORS(WebKitContext); |
76 }; | 93 }; |
77 | 94 |
78 #endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_WEBKIT_CONTEXT_H_ | 95 #endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_WEBKIT_CONTEXT_H_ |
OLD | NEW |