| 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" | |
| 12 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 13 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 16 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
| 17 #include "chrome/browser/net/chrome_url_request_context.h" | 16 #include "chrome/browser/net/chrome_url_request_context.h" |
| 18 #include "chrome/browser/prefs/pref_member.h" | 17 #include "chrome/browser/prefs/pref_member.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 20 #include "content/browser/resource_context.h" | 19 #include "content/browser/resource_context.h" |
| 21 #include "net/base/cookie_monster.h" | 20 #include "net/base/cookie_monster.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 class ProfileIOData : public base::RefCountedThreadSafe<ProfileIOData> { | 70 class ProfileIOData : public base::RefCountedThreadSafe<ProfileIOData> { |
| 72 public: | 71 public: |
| 73 // Returns true if |scheme| is handled in Chrome, or by default handlers in | 72 // Returns true if |scheme| is handled in Chrome, or by default handlers in |
| 74 // net::URLRequest. | 73 // net::URLRequest. |
| 75 static bool IsHandledProtocol(const std::string& scheme); | 74 static bool IsHandledProtocol(const std::string& scheme); |
| 76 | 75 |
| 77 // Returns true if |url| is handled in Chrome, or by default handlers in | 76 // Returns true if |url| is handled in Chrome, or by default handlers in |
| 78 // net::URLRequest. | 77 // net::URLRequest. |
| 79 static bool IsHandledURL(const GURL& url); | 78 static bool IsHandledURL(const GURL& url); |
| 80 | 79 |
| 80 // Called by Profile. |
| 81 const content::ResourceContext& GetResourceContext() const; |
| 82 ChromeURLDataManagerBackend* GetChromeURLDataManagerBackend() const; |
| 83 |
| 81 // These should only be called at most once each. Ownership is reversed when | 84 // These should only be called at most once each. Ownership is reversed when |
| 82 // they get called, from ProfileIOData owning ChromeURLRequestContext to vice | 85 // they get called, from ProfileIOData owning ChromeURLRequestContext to vice |
| 83 // versa. | 86 // versa. |
| 84 scoped_refptr<ChromeURLRequestContext> GetMainRequestContext() const; | 87 scoped_refptr<ChromeURLRequestContext> GetMainRequestContext() const; |
| 85 scoped_refptr<ChromeURLRequestContext> GetMediaRequestContext() const; | 88 scoped_refptr<ChromeURLRequestContext> GetMediaRequestContext() const; |
| 86 scoped_refptr<ChromeURLRequestContext> GetExtensionsRequestContext() const; | 89 scoped_refptr<ChromeURLRequestContext> GetExtensionsRequestContext() const; |
| 87 scoped_refptr<ChromeURLRequestContext> GetIsolatedAppRequestContext( | 90 scoped_refptr<ChromeURLRequestContext> GetIsolatedAppRequestContext( |
| 88 scoped_refptr<ChromeURLRequestContext> main_context, | 91 scoped_refptr<ChromeURLRequestContext> main_context, |
| 89 const std::string& app_id) const; | 92 const std::string& app_id) const; |
| 90 const content::ResourceContext& GetResourceContext() const; | |
| 91 | 93 |
| 92 // 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 |
| 93 // 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 |
| 94 // that profile. | 96 // that profile. |
| 95 ExtensionInfoMap* GetExtensionInfoMap() const; | 97 ExtensionInfoMap* GetExtensionInfoMap() const; |
| 96 HostContentSettingsMap* GetHostContentSettingsMap() const; | 98 HostContentSettingsMap* GetHostContentSettingsMap() const; |
| 97 DesktopNotificationService* GetNotificationService() const; | 99 DesktopNotificationService* GetNotificationService() const; |
| 98 | 100 |
| 99 BooleanPrefMember* clear_local_state_on_exit() const { | 101 BooleanPrefMember* clear_local_state_on_exit() const { |
| 100 return &clear_local_state_on_exit_; | 102 return &clear_local_state_on_exit_; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 // Weak pointers to the request contexts. Only valid after LazyInitialize. | 278 // Weak pointers to the request contexts. Only valid after LazyInitialize. |
| 277 // These are weak so that they don't hold a reference to the RequestContext, | 279 // These are weak so that they don't hold a reference to the RequestContext, |
| 278 // because that holds a reference back to ProfileIOData. | 280 // because that holds a reference back to ProfileIOData. |
| 279 mutable base::WeakPtr<ChromeURLRequestContext> | 281 mutable base::WeakPtr<ChromeURLRequestContext> |
| 280 weak_extensions_request_context_; | 282 weak_extensions_request_context_; |
| 281 | 283 |
| 282 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); | 284 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); |
| 283 }; | 285 }; |
| 284 | 286 |
| 285 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ | 287 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ |
| OLD | NEW |