Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2028)

Unified Diff: chrome/browser/profiles/profile_impl.cc

Issue 7838030: WIP: Introduce per-TabContents PrefService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/profiles/profile_impl.cc
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 159e6b8238b178369521c69321f0b76f0786777a..62a14a2f95f126fee34ea724b08c19d71c2e5087 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -96,6 +96,7 @@
#include "content/browser/renderer_host/render_process_host.h"
#include "content/browser/speech/speech_input_manager.h"
#include "content/browser/ssl/ssl_host_state.h"
+#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/user_metrics.h"
#include "content/common/notification_service.h"
#include "grit/browser_resources.h"
@@ -941,6 +942,21 @@ PrefService* ProfileImpl::GetOffTheRecordPrefs() {
return otr_prefs_.get();
}
+PrefService* ProfileImpl::GetPrefsForTabContents(TabContents* contents) {
+ static PropertyAccessor<PrefService*>* accessor = NULL;
+ if (!accessor)
+ accessor = new PropertyAccessor<PrefService*>;
+
+ PrefService** prefs_property =
+ accessor->GetProperty(contents->property_bag());
+ if (prefs_property && *prefs_property)
+ return *prefs_property;
+
+ PrefService* prefs = GetPrefs()->CreateTabContentsPrefService();
+ accessor->SetProperty(contents->property_bag(), prefs);
+ return prefs;
+}
+
FilePath ProfileImpl::GetPrefFilePath() {
FilePath pref_file_path = path_;
pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename);
« chrome/browser/profiles/profile.h ('K') | « chrome/browser/profiles/profile_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698