OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_BROWSER_IN_PROCESS_WEBKIT_WEBKIT_CONTEXT_H_ | |
6 #define CONTENT_BROWSER_IN_PROCESS_WEBKIT_WEBKIT_CONTEXT_H_ | |
7 #pragma once | |
8 | |
9 #include <vector> | |
10 | |
11 #include "base/file_path.h" | |
12 #include "base/memory/ref_counted.h" | |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "content/common/content_export.h" | |
15 | |
16 class DOMStorageContextImpl; | |
17 class IndexedDBContextImpl; | |
18 | |
19 namespace base { | |
20 class MessageLoopProxy; | |
21 } | |
22 | |
23 namespace quota { | |
24 class QuotaManagerProxy; | |
25 class SpecialStoragePolicy; | |
26 } | |
27 | |
28 // There's one WebKitContext per browser context. Various DispatcherHost | |
29 // classes have a pointer to the Context to store shared state. Unfortunately, | |
30 // this class has become a bit of a dumping ground for calls made on the UI | |
31 // thread that need to be proxied over to the WebKit thread. | |
32 // | |
33 // This class is created on the UI thread and accessed on the UI, IO, and WebKit | |
34 // threads. | |
35 class CONTENT_EXPORT WebKitContext | |
36 : public base::RefCountedThreadSafe<WebKitContext> { | |
37 public: | |
38 WebKitContext(bool is_incognito, const FilePath& data_path, | |
39 quota::SpecialStoragePolicy* special_storage_policy, | |
40 quota::QuotaManagerProxy* quota_manager_proxy, | |
41 base::MessageLoopProxy* webkit_thread_loop); | |
42 | |
43 const FilePath& data_path() const { return data_path_; } | |
44 bool is_incognito() const { return is_incognito_; } | |
45 | |
46 DOMStorageContextImpl* dom_storage_context() { return dom_storage_context_; } | |
47 IndexedDBContextImpl* indexed_db_context() { return indexed_db_context_; } | |
48 | |
49 private: | |
50 friend class base::RefCountedThreadSafe<WebKitContext>; | |
51 virtual ~WebKitContext(); | |
52 | |
53 // Copies of browser context data that can be accessed on any thread. | |
54 const FilePath data_path_; | |
55 const bool is_incognito_; | |
56 | |
57 scoped_refptr<DOMStorageContextImpl> dom_storage_context_; | |
58 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; | |
59 | |
60 DISALLOW_IMPLICIT_CONSTRUCTORS(WebKitContext); | |
61 }; | |
62 | |
63 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_WEBKIT_CONTEXT_H_ | |
OLD | NEW |