| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/debug/stack_trace.h" |
| 11 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 15 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
| 16 #include "chrome/browser/net/chrome_url_request_context.h" | 17 #include "chrome/browser/net/chrome_url_request_context.h" |
| 17 #include "chrome/browser/prefs/pref_member.h" | 18 #include "chrome/browser/prefs/pref_member.h" |
| 18 #include "content/browser/resource_context.h" | 19 #include "content/browser/resource_context.h" |
| 19 #include "net/base/cookie_monster.h" | 20 #include "net/base/cookie_monster.h" |
| 20 | 21 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 class ProfileIOData : public base::RefCountedThreadSafe<ProfileIOData> { | 73 class ProfileIOData : public base::RefCountedThreadSafe<ProfileIOData> { |
| 73 public: | 74 public: |
| 74 // Returns true if |scheme| is handled in Chrome, or by default handlers in | 75 // Returns true if |scheme| is handled in Chrome, or by default handlers in |
| 75 // net::URLRequest. | 76 // net::URLRequest. |
| 76 static bool IsHandledProtocol(const std::string& scheme); | 77 static bool IsHandledProtocol(const std::string& scheme); |
| 77 | 78 |
| 78 // Returns true if |url| is handled in Chrome, or by default handlers in | 79 // Returns true if |url| is handled in Chrome, or by default handlers in |
| 79 // net::URLRequest. | 80 // net::URLRequest. |
| 80 static bool IsHandledURL(const GURL& url); | 81 static bool IsHandledURL(const GURL& url); |
| 81 | 82 |
| 82 // Called by Profile. | |
| 83 const content::ResourceContext& GetResourceContext() const; | |
| 84 ChromeURLDataManagerBackend* GetChromeURLDataManagerBackend() const; | |
| 85 | |
| 86 // These should only be called at most once each. Ownership is reversed when | 83 // These should only be called at most once each. Ownership is reversed when |
| 87 // they get called, from ProfileIOData owning ChromeURLRequestContext to vice | 84 // they get called, from ProfileIOData owning ChromeURLRequestContext to vice |
| 88 // versa. | 85 // versa. |
| 89 scoped_refptr<ChromeURLRequestContext> GetMainRequestContext() const; | 86 scoped_refptr<ChromeURLRequestContext> GetMainRequestContext() const; |
| 90 scoped_refptr<ChromeURLRequestContext> GetMediaRequestContext() const; | 87 scoped_refptr<ChromeURLRequestContext> GetMediaRequestContext() const; |
| 91 scoped_refptr<ChromeURLRequestContext> GetExtensionsRequestContext() const; | 88 scoped_refptr<ChromeURLRequestContext> GetExtensionsRequestContext() const; |
| 92 scoped_refptr<ChromeURLRequestContext> GetIsolatedAppRequestContext( | 89 scoped_refptr<ChromeURLRequestContext> GetIsolatedAppRequestContext( |
| 93 scoped_refptr<ChromeURLRequestContext> main_context, | 90 scoped_refptr<ChromeURLRequestContext> main_context, |
| 94 const std::string& app_id) const; | 91 const std::string& app_id) const; |
| 92 const content::ResourceContext& GetResourceContext() const; |
| 95 | 93 |
| 96 // These are useful when the Chrome layer is called from the content layer | 94 // These are useful when the Chrome layer is called from the content layer |
| 97 // with a content::ResourceContext, and they want access to Chrome data for | 95 // with a content::ResourceContext, and they want access to Chrome data for |
| 98 // that profile. | 96 // that profile. |
| 99 ExtensionInfoMap* GetExtensionInfoMap() const; | 97 ExtensionInfoMap* GetExtensionInfoMap() const; |
| 100 HostContentSettingsMap* GetHostContentSettingsMap() const; | 98 HostContentSettingsMap* GetHostContentSettingsMap() const; |
| 101 DesktopNotificationService* GetNotificationService() const; | 99 DesktopNotificationService* GetNotificationService() const; |
| 102 | 100 |
| 103 BooleanPrefMember* clear_local_state_on_exit() const { | 101 BooleanPrefMember* clear_local_state_on_exit() const { |
| 104 return &clear_local_state_on_exit_; | 102 return &clear_local_state_on_exit_; |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 // Weak pointers to the request contexts. Only valid after LazyInitialize. | 307 // Weak pointers to the request contexts. Only valid after LazyInitialize. |
| 310 // These are weak so that they don't hold a reference to the RequestContext, | 308 // These are weak so that they don't hold a reference to the RequestContext, |
| 311 // because that holds a reference back to ProfileIOData. | 309 // because that holds a reference back to ProfileIOData. |
| 312 mutable base::WeakPtr<ChromeURLRequestContext> | 310 mutable base::WeakPtr<ChromeURLRequestContext> |
| 313 weak_extensions_request_context_; | 311 weak_extensions_request_context_; |
| 314 | 312 |
| 315 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); | 313 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); |
| 316 }; | 314 }; |
| 317 | 315 |
| 318 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ | 316 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ |
| OLD | NEW |