| 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 #include "chrome/browser/profiles/profile_impl.h" | 5 #include "chrome/browser/profiles/profile_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/environment.h" | 9 #include "base/environment.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 #include "content/browser/appcache/chrome_appcache_service.h" | 89 #include "content/browser/appcache/chrome_appcache_service.h" |
| 90 #include "content/browser/browser_thread.h" | 90 #include "content/browser/browser_thread.h" |
| 91 #include "content/browser/chrome_blob_storage_context.h" | 91 #include "content/browser/chrome_blob_storage_context.h" |
| 92 #include "content/browser/download/download_manager.h" | 92 #include "content/browser/download/download_manager.h" |
| 93 #include "content/browser/file_system/browser_file_system_helper.h" | 93 #include "content/browser/file_system/browser_file_system_helper.h" |
| 94 #include "content/browser/host_zoom_map.h" | 94 #include "content/browser/host_zoom_map.h" |
| 95 #include "content/browser/in_process_webkit/webkit_context.h" | 95 #include "content/browser/in_process_webkit/webkit_context.h" |
| 96 #include "content/browser/renderer_host/render_process_host.h" | 96 #include "content/browser/renderer_host/render_process_host.h" |
| 97 #include "content/browser/speech/speech_input_manager.h" | 97 #include "content/browser/speech/speech_input_manager.h" |
| 98 #include "content/browser/ssl/ssl_host_state.h" | 98 #include "content/browser/ssl/ssl_host_state.h" |
| 99 #include "content/browser/tab_contents/tab_contents.h" |
| 99 #include "content/browser/user_metrics.h" | 100 #include "content/browser/user_metrics.h" |
| 100 #include "content/common/notification_service.h" | 101 #include "content/common/notification_service.h" |
| 101 #include "grit/browser_resources.h" | 102 #include "grit/browser_resources.h" |
| 102 #include "grit/locale_settings.h" | 103 #include "grit/locale_settings.h" |
| 103 #include "net/base/transport_security_state.h" | 104 #include "net/base/transport_security_state.h" |
| 104 #include "ui/base/resource/resource_bundle.h" | 105 #include "ui/base/resource/resource_bundle.h" |
| 105 #include "webkit/database/database_tracker.h" | 106 #include "webkit/database/database_tracker.h" |
| 106 #include "webkit/quota/quota_manager.h" | 107 #include "webkit/quota/quota_manager.h" |
| 107 | 108 |
| 108 #if defined(OS_WIN) | 109 #if defined(OS_WIN) |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 PrefService* ProfileImpl::GetOffTheRecordPrefs() { | 935 PrefService* ProfileImpl::GetOffTheRecordPrefs() { |
| 935 if (!otr_prefs_.get()) { | 936 if (!otr_prefs_.get()) { |
| 936 // The new ExtensionPrefStore is ref_counted and the new PrefService | 937 // The new ExtensionPrefStore is ref_counted and the new PrefService |
| 937 // stores a reference so that we do not leak memory here. | 938 // stores a reference so that we do not leak memory here. |
| 938 otr_prefs_.reset(GetPrefs()->CreateIncognitoPrefService( | 939 otr_prefs_.reset(GetPrefs()->CreateIncognitoPrefService( |
| 939 new ExtensionPrefStore(GetExtensionPrefValueMap(), true))); | 940 new ExtensionPrefStore(GetExtensionPrefValueMap(), true))); |
| 940 } | 941 } |
| 941 return otr_prefs_.get(); | 942 return otr_prefs_.get(); |
| 942 } | 943 } |
| 943 | 944 |
| 945 PrefService* ProfileImpl::GetPrefsForTabContents(TabContents* contents) { |
| 946 static PropertyAccessor<PrefService*>* accessor = NULL; |
| 947 if (!accessor) |
| 948 accessor = new PropertyAccessor<PrefService*>; |
| 949 |
| 950 PrefService** prefs_property = |
| 951 accessor->GetProperty(contents->property_bag()); |
| 952 if (prefs_property && *prefs_property) |
| 953 return *prefs_property; |
| 954 |
| 955 PrefService* prefs = GetPrefs()->CreateTabContentsPrefService(); |
| 956 accessor->SetProperty(contents->property_bag(), prefs); |
| 957 return prefs; |
| 958 } |
| 959 |
| 944 FilePath ProfileImpl::GetPrefFilePath() { | 960 FilePath ProfileImpl::GetPrefFilePath() { |
| 945 FilePath pref_file_path = path_; | 961 FilePath pref_file_path = path_; |
| 946 pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename); | 962 pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename); |
| 947 return pref_file_path; | 963 return pref_file_path; |
| 948 } | 964 } |
| 949 | 965 |
| 950 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() { | 966 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() { |
| 951 net::URLRequestContextGetter* request_context = | 967 net::URLRequestContextGetter* request_context = |
| 952 io_data_.GetMainRequestContextGetter(); | 968 io_data_.GetMainRequestContextGetter(); |
| 953 // The first request context is always a normal (non-OTR) request context. | 969 // The first request context is always a normal (non-OTR) request context. |
| (...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1736 #endif | 1752 #endif |
| 1737 } | 1753 } |
| 1738 return prerender_manager_.get(); | 1754 return prerender_manager_.get(); |
| 1739 } | 1755 } |
| 1740 | 1756 |
| 1741 SpellCheckProfile* ProfileImpl::GetSpellCheckProfile() { | 1757 SpellCheckProfile* ProfileImpl::GetSpellCheckProfile() { |
| 1742 if (!spellcheck_profile_.get()) | 1758 if (!spellcheck_profile_.get()) |
| 1743 spellcheck_profile_.reset(new SpellCheckProfile()); | 1759 spellcheck_profile_.reset(new SpellCheckProfile()); |
| 1744 return spellcheck_profile_.get(); | 1760 return spellcheck_profile_.get(); |
| 1745 } | 1761 } |
| OLD | NEW |