OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2006-2008 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 #include "chrome/common/net/cookie_monster_sqlite.h" |
| 6 #include "chrome/common/notification_service.h" |
| 7 #include "chrome/common/pref_service.h" |
| 8 #include "net/url_request/url_request_context.h" |
| 9 |
| 10 class Profile; |
| 11 |
| 12 // A URLRequestContext subclass used by the browser. This can be used to store |
| 13 // extra information about requests, beyond what is supported by the base |
| 14 // URLRequestContext class. |
| 15 // |
| 16 // All methods are expected to be called on the IO thread except the |
| 17 // constructor and factories (CreateOriginal, CreateOffTheRecord), which are |
| 18 // expected to be called on the UI thread. |
| 19 class ChromeURLRequestContext : public URLRequestContext, |
| 20 public NotificationObserver { |
| 21 public: |
| 22 // Create an instance for use with an 'original' (non-OTR) profile. This is |
| 23 // expected to get called on the UI thread. |
| 24 static ChromeURLRequestContext* CreateOriginal( |
| 25 Profile* profile, const std::wstring& cookie_store_path, |
| 26 const std::wstring& disk_cache_path); |
| 27 |
| 28 // Create an instance for use with an OTR profile. This is expected to get |
| 29 // called on the UI thread. |
| 30 static ChromeURLRequestContext* CreateOffTheRecord(Profile* profile); |
| 31 |
| 32 // Clean up UI thread resources. This is expected to get called on the UI |
| 33 // thread before the instance is deleted on the IO thread. |
| 34 void CleanupOnUIThread(); |
| 35 |
| 36 private: |
| 37 // Private constructor, use the static factory methods instead. This is |
| 38 // expected to be called on the UI thread. |
| 39 ChromeURLRequestContext(Profile* profile); |
| 40 |
| 41 // NotificationObserver implementation. |
| 42 virtual void Observe(NotificationType type, |
| 43 const NotificationSource& source, |
| 44 const NotificationDetails& details); |
| 45 |
| 46 // Callback for when the accept language changes. |
| 47 void OnAcceptLanguageChange(std::string accept_language); |
| 48 |
| 49 // Callback for when the cookie policy changes. |
| 50 void OnCookiePolicyChange(net::CookiePolicy::Type type); |
| 51 |
| 52 // Destructor. |
| 53 virtual ~ChromeURLRequestContext(); |
| 54 |
| 55 scoped_ptr<SQLitePersistentCookieStore> cookie_db_; |
| 56 PrefService* prefs_; |
| 57 bool is_off_the_record_; |
| 58 }; |
OLD | NEW |