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

Side by Side Diff: profile.cc

Issue 19748: Ensure that the proper UA string is set while in incognito mode.... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/release_154.next/src/chrome/browser/
Patch Set: Created 11 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/profile.h" 5 #include "chrome/browser/profile.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/lock.h" 9 #include "base/lock.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 default_request_context_ = this; 147 default_request_context_ = this;
148 NotificationService::current()->Notify( 148 NotificationService::current()->Notify(
149 NOTIFY_DEFAULT_REQUEST_CONTEXT_AVAILABLE, 149 NOTIFY_DEFAULT_REQUEST_CONTEXT_AVAILABLE,
150 NotificationService::AllSources(), NotificationService::NoDetails()); 150 NotificationService::AllSources(), NotificationService::NoDetails());
151 151
152 // Register for notifications about prefs. 152 // Register for notifications about prefs.
153 prefs_->AddPrefObserver(prefs::kAcceptLanguages, this); 153 prefs_->AddPrefObserver(prefs::kAcceptLanguages, this);
154 prefs_->AddPrefObserver(prefs::kCookieBehavior, this); 154 prefs_->AddPrefObserver(prefs::kCookieBehavior, this);
155 } 155 }
156 156
157 const std::string& GetUserAgent( 157 const std::string& GetUserAgent(const GURL& url) const {
158 const GURL& url) const {
159 return webkit_glue::GetUserAgent(url); 158 return webkit_glue::GetUserAgent(url);
160 } 159 }
161 160
162 // NotificationObserver implementation. 161 // NotificationObserver implementation.
163 virtual void Observe(NotificationType type, 162 virtual void Observe(NotificationType type,
164 const NotificationSource& source, 163 const NotificationSource& source,
165 const NotificationDetails& details) { 164 const NotificationDetails& details) {
166 if (NOTIFY_PREF_CHANGED == type) { 165 if (NOTIFY_PREF_CHANGED == type) {
167 std::wstring* pref_name_in = Details<std::wstring>(details).ptr(); 166 std::wstring* pref_name_in = Details<std::wstring>(details).ptr();
168 PrefService* prefs = Source<PrefService>(source).ptr(); 167 PrefService* prefs = Source<PrefService>(source).ptr();
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 prefs_->GetInteger(prefs::kCookieBehavior))); 255 prefs_->GetInteger(prefs::kCookieBehavior)));
257 accept_language_ = original_context_->accept_language(); 256 accept_language_ = original_context_->accept_language();
258 accept_charset_ = original_context_->accept_charset(); 257 accept_charset_ = original_context_->accept_charset();
259 is_off_the_record_ = true; 258 is_off_the_record_ = true;
260 259
261 // Register for notifications about prefs. 260 // Register for notifications about prefs.
262 prefs_->AddPrefObserver(prefs::kAcceptLanguages, this); 261 prefs_->AddPrefObserver(prefs::kAcceptLanguages, this);
263 prefs_->AddPrefObserver(prefs::kCookieBehavior, this); 262 prefs_->AddPrefObserver(prefs::kCookieBehavior, this);
264 } 263 }
265 264
265 const std::string& GetUserAgent(const GURL& url) const {
266 return original_context_->GetUserAgent(url);
267 }
268
266 // Since OffTheRecordProfileImpl maybe be destroyed after destroying 269 // Since OffTheRecordProfileImpl maybe be destroyed after destroying
267 // PrefService, but all PrefService observers are needed to clear in 270 // PrefService, but all PrefService observers are needed to clear in
268 // before destroying PrefService. So we use to CleanupBeforeDestroy 271 // before destroying PrefService. So we use to CleanupBeforeDestroy
269 // to do this thing. This function need to be called on destructor 272 // to do this thing. This function need to be called on destructor
270 // of ProfileImpl. 273 // of ProfileImpl.
271 void CleanupBeforeDestroy() { 274 void CleanupBeforeDestroy() {
272 // Unregister for pref notifications. 275 // Unregister for pref notifications.
273 prefs_->RemovePrefObserver(prefs::kAcceptLanguages, this); 276 prefs_->RemovePrefObserver(prefs::kAcceptLanguages, this);
274 prefs_->RemovePrefObserver(prefs::kCookieBehavior, this); 277 prefs_->RemovePrefObserver(prefs::kCookieBehavior, this);
275 prefs_ = NULL; 278 prefs_ = NULL;
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 } 973 }
971 974
972 #ifdef CHROME_PERSONALIZATION 975 #ifdef CHROME_PERSONALIZATION
973 ProfilePersonalization* ProfileImpl::GetProfilePersonalization() { 976 ProfilePersonalization* ProfileImpl::GetProfilePersonalization() {
974 if (!personalization_.get()) 977 if (!personalization_.get())
975 personalization_.reset( 978 personalization_.reset(
976 Personalization::CreateProfilePersonalization(this)); 979 Personalization::CreateProfilePersonalization(this));
977 return personalization_.get(); 980 return personalization_.get();
978 } 981 }
979 #endif 982 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698