| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // 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 | 7 |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| 11 | 11 |
| 12 class DOMStorageContext; | 12 class DOMStorageContext; |
| 13 class WebKitThread; |
| 13 | 14 |
| 14 // There's one WebKitContext per profile. Various DispatcherHost classes | 15 // There's one WebKitContext per profile. Various DispatcherHost classes |
| 15 // have a pointer to the Context to store shared state. | 16 // have a pointer to the Context to store shared state. |
| 16 class WebKitContext : public base::RefCountedThreadSafe<WebKitContext> { | 17 class WebKitContext : public base::RefCountedThreadSafe<WebKitContext> { |
| 17 public: | 18 public: |
| 18 WebKitContext(const FilePath& data_path, bool is_incognito); | 19 WebKitContext(const FilePath& data_path, bool is_incognito); |
| 19 | 20 |
| 20 const FilePath& data_path() const { return data_path_; } | 21 const FilePath& data_path() const { return data_path_; } |
| 21 bool is_incognito() const { return is_incognito_; } | 22 bool is_incognito() const { return is_incognito_; } |
| 22 | 23 DOMStorageContext* dom_storage_context() { |
| 23 // Initialized lazily. Pointer is valid for the lifetime of this instance. | 24 return dom_storage_context_.get(); |
| 24 DOMStorageContext* GetDOMStorageContext(); | 25 } |
| 25 | 26 |
| 26 private: | 27 private: |
| 27 friend class base::RefCountedThreadSafe<WebKitContext>; | 28 friend class base::RefCountedThreadSafe<WebKitContext>; |
| 28 ~WebKitContext(); | 29 ~WebKitContext(); |
| 29 | 30 |
| 30 // Copies of profile data that can be accessed on any thread. | 31 // Copies of profile data that can be accessed on any thread. |
| 31 const FilePath data_path_; | 32 const FilePath data_path_; |
| 32 const bool is_incognito_; | 33 const bool is_incognito_; |
| 33 | 34 |
| 34 // The state for DOM Storage. | |
| 35 scoped_ptr<DOMStorageContext> dom_storage_context_; | 35 scoped_ptr<DOMStorageContext> dom_storage_context_; |
| 36 | 36 |
| 37 DISALLOW_IMPLICIT_CONSTRUCTORS(WebKitContext); | 37 DISALLOW_IMPLICIT_CONSTRUCTORS(WebKitContext); |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 #endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_WEBKIT_CONTEXT_H_ | 40 #endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_WEBKIT_CONTEXT_H_ |
| OLD | NEW |