| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PROFILES_PROFILE_IO_DATA_H_ | 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ |
| 6 #define CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ | 6 #define CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/prefs/pref_member.h" | 16 #include "base/prefs/pref_member.h" |
| 17 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
| 18 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 18 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 19 #include "chrome/browser/io_thread.h" | 19 #include "chrome/browser/io_thread.h" |
| 20 #include "chrome/browser/net/chrome_url_request_context.h" | 20 #include "chrome/browser/net/chrome_url_request_context.h" |
| 21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/browser/profiles/storage_partition_descriptor.h" | 22 #include "chrome/browser/profiles/storage_partition_descriptor.h" |
| 23 #include "chrome/common/content_settings_types.h" | 23 #include "chrome/common/content_settings_types.h" |
| 24 #include "content/public/browser/content_browser_client.h" | 24 #include "content/public/browser/content_browser_client.h" |
| 25 #include "content/public/browser/resource_context.h" | 25 #include "content/public/browser/resource_context.h" |
| 26 #include "net/cookies/cookie_monster.h" | 26 #include "net/cookies/cookie_monster.h" |
| 27 #include "net/http/http_cache.h" |
| 27 #include "net/http/http_network_session.h" | 28 #include "net/http/http_network_session.h" |
| 28 #include "net/url_request/url_request_job_factory.h" | 29 #include "net/url_request/url_request_job_factory.h" |
| 29 | 30 |
| 30 class ChromeHttpUserAgentSettings; | 31 class ChromeHttpUserAgentSettings; |
| 31 class ChromeNetworkDelegate; | 32 class ChromeNetworkDelegate; |
| 32 class CookieSettings; | 33 class CookieSettings; |
| 34 class DevToolsNetworkController; |
| 33 class HostContentSettingsMap; | 35 class HostContentSettingsMap; |
| 34 class ManagedModeURLFilter; | 36 class ManagedModeURLFilter; |
| 35 class MediaDeviceIDSalt; | 37 class MediaDeviceIDSalt; |
| 36 class ProtocolHandlerRegistry; | 38 class ProtocolHandlerRegistry; |
| 37 class SigninNamesOnIOThread; | 39 class SigninNamesOnIOThread; |
| 38 | 40 |
| 39 namespace extensions { | 41 namespace extensions { |
| 40 class InfoMap; | 42 class InfoMap; |
| 41 } | 43 } |
| 42 | 44 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 BooleanPrefMember* signin_allowed() const { | 174 BooleanPrefMember* signin_allowed() const { |
| 173 return &signin_allowed_; | 175 return &signin_allowed_; |
| 174 } | 176 } |
| 175 | 177 |
| 176 BooleanPrefMember* network_prediction_enabled() const { | 178 BooleanPrefMember* network_prediction_enabled() const { |
| 177 return &network_prediction_enabled_; | 179 return &network_prediction_enabled_; |
| 178 } | 180 } |
| 179 | 181 |
| 180 content::ResourceContext::SaltCallback GetMediaDeviceIDSalt() const; | 182 content::ResourceContext::SaltCallback GetMediaDeviceIDSalt() const; |
| 181 | 183 |
| 184 void SetNetworkState(const std::string& client_id, bool offline) const; |
| 185 |
| 182 net::TransportSecurityState* transport_security_state() const { | 186 net::TransportSecurityState* transport_security_state() const { |
| 183 return transport_security_state_.get(); | 187 return transport_security_state_.get(); |
| 184 } | 188 } |
| 185 | 189 |
| 186 #if defined(OS_CHROMEOS) | 190 #if defined(OS_CHROMEOS) |
| 187 std::string username_hash() const { | 191 std::string username_hash() const { |
| 188 return username_hash_; | 192 return username_hash_; |
| 189 } | 193 } |
| 190 #endif | 194 #endif |
| 191 | 195 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 | 352 |
| 349 bool initialized() const { | 353 bool initialized() const { |
| 350 return initialized_; | 354 return initialized_; |
| 351 } | 355 } |
| 352 | 356 |
| 353 // Destroys the ResourceContext first, to cancel any URLRequests that are | 357 // Destroys the ResourceContext first, to cancel any URLRequests that are |
| 354 // using it still, before we destroy the member variables that those | 358 // using it still, before we destroy the member variables that those |
| 355 // URLRequests may be accessing. | 359 // URLRequests may be accessing. |
| 356 void DestroyResourceContext(); | 360 void DestroyResourceContext(); |
| 357 | 361 |
| 358 // Fills in fields of params using values from main_request_context_ and the | 362 // Creates network session and main network transaction factory. |
| 359 // IOThread associated with profile_params. | 363 scoped_ptr<net::HttpCache> CreateMainHttpFactory( |
| 360 void PopulateNetworkSessionParams( | |
| 361 const ProfileParams* profile_params, | 364 const ProfileParams* profile_params, |
| 362 net::HttpNetworkSession::Params* params) const; | 365 net::HttpCache::BackendFactory* main_backend) const; |
| 366 |
| 367 // Creates network transaction factory. |
| 368 scoped_ptr<net::HttpCache> CreateHttpFactory( |
| 369 net::HttpNetworkSession* shared_session, |
| 370 net::HttpCache::BackendFactory* backend) const; |
| 363 | 371 |
| 364 void SetCookieSettingsForTesting(CookieSettings* cookie_settings); | 372 void SetCookieSettingsForTesting(CookieSettings* cookie_settings); |
| 365 | 373 |
| 366 void set_signin_names_for_testing(SigninNamesOnIOThread* signin_names); | 374 void set_signin_names_for_testing(SigninNamesOnIOThread* signin_names); |
| 367 | 375 |
| 368 private: | 376 private: |
| 369 class ResourceContext : public content::ResourceContext { | 377 class ResourceContext : public content::ResourceContext { |
| 370 public: | 378 public: |
| 371 explicit ResourceContext(ProfileIOData* io_data); | 379 explicit ResourceContext(ProfileIOData* io_data); |
| 372 virtual ~ResourceContext(); | 380 virtual ~ResourceContext(); |
| 373 | 381 |
| 374 // ResourceContext implementation: | 382 // ResourceContext implementation: |
| 375 virtual net::HostResolver* GetHostResolver() OVERRIDE; | 383 virtual net::HostResolver* GetHostResolver() OVERRIDE; |
| 376 virtual net::URLRequestContext* GetRequestContext() OVERRIDE; | 384 virtual net::URLRequestContext* GetRequestContext() OVERRIDE; |
| 377 virtual scoped_ptr<net::ClientCertStore> CreateClientCertStore() OVERRIDE; | 385 virtual scoped_ptr<net::ClientCertStore> CreateClientCertStore() OVERRIDE; |
| 378 virtual void CreateKeygenHandler( | 386 virtual void CreateKeygenHandler( |
| 379 uint32 key_size_in_bits, | 387 uint32 key_size_in_bits, |
| 380 const std::string& challenge_string, | 388 const std::string& challenge_string, |
| 381 const GURL& url, | 389 const GURL& url, |
| 382 const base::Callback<void(scoped_ptr<net::KeygenHandler>)>& callback) | 390 const base::Callback<void(scoped_ptr<net::KeygenHandler>)>& callback) |
| 383 OVERRIDE; | 391 OVERRIDE; |
| 384 virtual bool AllowMicAccess(const GURL& origin) OVERRIDE; | 392 virtual bool AllowMicAccess(const GURL& origin) OVERRIDE; |
| 385 virtual bool AllowCameraAccess(const GURL& origin) OVERRIDE; | 393 virtual bool AllowCameraAccess(const GURL& origin) OVERRIDE; |
| 386 virtual SaltCallback GetMediaDeviceIDSalt() OVERRIDE; | 394 virtual SaltCallback GetMediaDeviceIDSalt() OVERRIDE; |
| 395 virtual void SetNetworkState( |
| 396 const std::string& client_id, |
| 397 bool offline) OVERRIDE; |
| 387 | 398 |
| 388 private: | 399 private: |
| 389 friend class ProfileIOData; | 400 friend class ProfileIOData; |
| 390 | 401 |
| 391 // Helper method that returns true if |type| is allowed for |origin|, false | 402 // Helper method that returns true if |type| is allowed for |origin|, false |
| 392 // otherwise. | 403 // otherwise. |
| 393 bool AllowContentAccess(const GURL& origin, ContentSettingsType type); | 404 bool AllowContentAccess(const GURL& origin, ContentSettingsType type); |
| 394 | 405 |
| 395 ProfileIOData* const io_data_; | 406 ProfileIOData* const io_data_; |
| 396 | 407 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 | 561 |
| 551 mutable scoped_refptr<HostContentSettingsMap> host_content_settings_map_; | 562 mutable scoped_refptr<HostContentSettingsMap> host_content_settings_map_; |
| 552 | 563 |
| 553 mutable scoped_ptr<ChromeHttpUserAgentSettings> | 564 mutable scoped_ptr<ChromeHttpUserAgentSettings> |
| 554 chrome_http_user_agent_settings_; | 565 chrome_http_user_agent_settings_; |
| 555 | 566 |
| 556 #if defined(ENABLE_MANAGED_USERS) | 567 #if defined(ENABLE_MANAGED_USERS) |
| 557 mutable scoped_refptr<const ManagedModeURLFilter> managed_mode_url_filter_; | 568 mutable scoped_refptr<const ManagedModeURLFilter> managed_mode_url_filter_; |
| 558 #endif | 569 #endif |
| 559 | 570 |
| 571 mutable scoped_ptr<DevToolsNetworkController> network_controller_; |
| 572 |
| 560 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. | 573 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. |
| 561 bool initialized_on_UI_thread_; | 574 bool initialized_on_UI_thread_; |
| 562 | 575 |
| 563 const Profile::ProfileType profile_type_; | 576 const Profile::ProfileType profile_type_; |
| 564 | 577 |
| 565 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); | 578 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); |
| 566 }; | 579 }; |
| 567 | 580 |
| 568 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ | 581 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ |
| OLD | NEW |