| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 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 | 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 #include "base/file_path.h" | 5 #include "base/file_path.h" |
| 6 #include "chrome/common/net/cookie_monster_sqlite.h" | 6 #include "chrome/common/net/cookie_monster_sqlite.h" |
| 7 #include "chrome/common/notification_registrar.h" | 7 #include "chrome/common/notification_registrar.h" |
| 8 #include "chrome/common/pref_service.h" | 8 #include "chrome/common/pref_service.h" |
| 9 #include "net/url_request/url_request_context.h" | 9 #include "net/url_request/url_request_context.h" |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // expected to be called on the UI thread. | 23 // expected to be called on the UI thread. |
| 24 class ChromeURLRequestContext : public URLRequestContext, | 24 class ChromeURLRequestContext : public URLRequestContext, |
| 25 public NotificationObserver { | 25 public NotificationObserver { |
| 26 public: | 26 public: |
| 27 typedef std::map<std::string, FilePath> ExtensionPaths; | 27 typedef std::map<std::string, FilePath> ExtensionPaths; |
| 28 | 28 |
| 29 // Create an instance for use with an 'original' (non-OTR) profile. This is | 29 // Create an instance for use with an 'original' (non-OTR) profile. This is |
| 30 // expected to get called on the UI thread. | 30 // expected to get called on the UI thread. |
| 31 static ChromeURLRequestContext* CreateOriginal( | 31 static ChromeURLRequestContext* CreateOriginal( |
| 32 Profile* profile, const FilePath& cookie_store_path, | 32 Profile* profile, const FilePath& cookie_store_path, |
| 33 const FilePath& disk_cache_path); | 33 const FilePath& disk_cache_path, int cache_size); |
| 34 | 34 |
| 35 // Create an instance for an original profile for media. This is expected to | 35 // Create an instance for an original profile for media. This is expected to |
| 36 // get called on UI thread. This method takes a profile and reuses the | 36 // get called on UI thread. This method takes a profile and reuses the |
| 37 // 'original' URLRequestContext for common files. | 37 // 'original' URLRequestContext for common files. |
| 38 static ChromeURLRequestContext* CreateOriginalForMedia(Profile *profile, | 38 static ChromeURLRequestContext* CreateOriginalForMedia(Profile *profile, |
| 39 const FilePath& disk_cache_path); | 39 const FilePath& disk_cache_path, int cache_size); |
| 40 | 40 |
| 41 // Create an instance for an original profile for extensions. This is expected | 41 // Create an instance for an original profile for extensions. This is expected |
| 42 // to get called on UI thread. | 42 // to get called on UI thread. |
| 43 static ChromeURLRequestContext* CreateOriginalForExtensions(Profile *profile, | 43 static ChromeURLRequestContext* CreateOriginalForExtensions(Profile *profile, |
| 44 const FilePath& cookie_store_path); | 44 const FilePath& cookie_store_path); |
| 45 | 45 |
| 46 // Create an instance for use with an OTR profile. This is expected to get | 46 // Create an instance for use with an OTR profile. This is expected to get |
| 47 // called on the UI thread. | 47 // called on the UI thread. |
| 48 static ChromeURLRequestContext* CreateOffTheRecord(Profile* profile); | 48 static ChromeURLRequestContext* CreateOffTheRecord(Profile* profile); |
| 49 | 49 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 71 | 71 |
| 72 private: | 72 private: |
| 73 // Private constructor, use the static factory methods instead. This is | 73 // Private constructor, use the static factory methods instead. This is |
| 74 // expected to be called on the UI thread. | 74 // expected to be called on the UI thread. |
| 75 ChromeURLRequestContext(Profile* profile); | 75 ChromeURLRequestContext(Profile* profile); |
| 76 | 76 |
| 77 // Create a request context for media resources from a regular request | 77 // Create a request context for media resources from a regular request |
| 78 // context. This helper method is called from CreateOriginalForMedia and | 78 // context. This helper method is called from CreateOriginalForMedia and |
| 79 // CreateOffTheRecordForMedia. | 79 // CreateOffTheRecordForMedia. |
| 80 static ChromeURLRequestContext* CreateRequestContextForMedia(Profile* profile, | 80 static ChromeURLRequestContext* CreateRequestContextForMedia(Profile* profile, |
| 81 const FilePath& disk_cache_path, bool off_the_record); | 81 const FilePath& disk_cache_path, int cache_size, bool off_the_record); |
| 82 | 82 |
| 83 // NotificationObserver implementation. | 83 // NotificationObserver implementation. |
| 84 virtual void Observe(NotificationType type, | 84 virtual void Observe(NotificationType type, |
| 85 const NotificationSource& source, | 85 const NotificationSource& source, |
| 86 const NotificationDetails& details); | 86 const NotificationDetails& details); |
| 87 | 87 |
| 88 // Callback for when the accept language changes. | 88 // Callback for when the accept language changes. |
| 89 void OnAcceptLanguageChange(std::string accept_language); | 89 void OnAcceptLanguageChange(std::string accept_language); |
| 90 | 90 |
| 91 // Callback for when the cookie policy changes. | 91 // Callback for when the cookie policy changes. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 111 | 111 |
| 112 scoped_ptr<SQLitePersistentCookieStore> cookie_db_; | 112 scoped_ptr<SQLitePersistentCookieStore> cookie_db_; |
| 113 PrefService* prefs_; | 113 PrefService* prefs_; |
| 114 bool is_media_; | 114 bool is_media_; |
| 115 bool is_off_the_record_; | 115 bool is_off_the_record_; |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 // Creates a proxy configuration using the overrides specified on the command | 118 // Creates a proxy configuration using the overrides specified on the command |
| 119 // line. Returns NULL if the system defaults should be used instead. | 119 // line. Returns NULL if the system defaults should be used instead. |
| 120 net::ProxyConfig* CreateProxyConfig(const CommandLine& command_line); | 120 net::ProxyConfig* CreateProxyConfig(const CommandLine& command_line); |
| OLD | NEW |