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

Side by Side Diff: chrome/browser/profiles/profile.cc

Issue 7467012: Modifying prefetch to account for multi-profile. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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
OLDNEW
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.h" 5 #include "chrome/browser/profiles/profile.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/file_util.h" 12 #include "base/file_util.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/string_util.h" 15 #include "base/string_util.h"
16 #include "build/build_config.h" 16 #include "build/build_config.h"
17 #include "chrome/browser/background/background_contents_service_factory.h" 17 #include "chrome/browser/background/background_contents_service_factory.h"
18 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
19 #include "chrome/browser/content_settings/host_content_settings_map.h" 19 #include "chrome/browser/content_settings/host_content_settings_map.h"
20 #include "chrome/browser/download/download_manager.h" 20 #include "chrome/browser/download/download_manager.h"
21 #include "chrome/browser/extensions/extension_message_service.h" 21 #include "chrome/browser/extensions/extension_message_service.h"
22 #include "chrome/browser/extensions/extension_pref_store.h" 22 #include "chrome/browser/extensions/extension_pref_store.h"
23 #include "chrome/browser/extensions/extension_process_manager.h" 23 #include "chrome/browser/extensions/extension_process_manager.h"
24 #include "chrome/browser/extensions/extension_service.h" 24 #include "chrome/browser/extensions/extension_service.h"
25 #include "chrome/browser/extensions/extension_special_storage_policy.h" 25 #include "chrome/browser/extensions/extension_special_storage_policy.h"
26 #include "chrome/browser/io_thread.h"
27 #include "chrome/browser/net/predictor_api.h"
26 #include "chrome/browser/net/pref_proxy_config_service.h" 28 #include "chrome/browser/net/pref_proxy_config_service.h"
27 #include "chrome/browser/prefs/pref_service.h" 29 #include "chrome/browser/prefs/pref_service.h"
28 #include "chrome/browser/profiles/off_the_record_profile_io_data.h" 30 #include "chrome/browser/profiles/off_the_record_profile_io_data.h"
29 #include "chrome/browser/profiles/profile_dependency_manager.h" 31 #include "chrome/browser/profiles/profile_dependency_manager.h"
30 #include "chrome/browser/sync/profile_sync_service.h" 32 #include "chrome/browser/sync/profile_sync_service.h"
31 #include "chrome/browser/themes/theme_service.h" 33 #include "chrome/browser/themes/theme_service.h"
32 #include "chrome/browser/transport_security_persister.h" 34 #include "chrome/browser/transport_security_persister.h"
33 #include "chrome/browser/ui/browser_list.h" 35 #include "chrome/browser/ui/browser_list.h"
34 #include "chrome/browser/ui/find_bar/find_bar_state.h" 36 #include "chrome/browser/ui/find_bar/find_bar_state.h"
35 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 37 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 #endif 203 #endif
202 } 204 }
203 205
204 bool Profile::IsSyncAccessible() { 206 bool Profile::IsSyncAccessible() {
205 ProfileSyncService* syncService = GetProfileSyncService(); 207 ProfileSyncService* syncService = GetProfileSyncService();
206 return syncService && !syncService->IsManaged(); 208 return syncService && !syncService->IsManaged();
207 } 209 }
208 210
209 //////////////////////////////////////////////////////////////////////////////// 211 ////////////////////////////////////////////////////////////////////////////////
210 // 212 //
213 // This section supports the about:dns page.
214 //
215 ////////////////////////////////////////////////////////////////////////////////
216
217 // Provide global support for the about:dns page.
218 void Profile::PredictorGetHtmlInfo(std::string* output) {
219 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
220
221 output->append("<html><head><title>About DNS</title>"
222 // We'd like the following no-cache... but it doesn't work.
223 // "<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">"
224 "</head><body>");
225 chrome_browser_net::Predictor* predictor = GetPredictor();
226 if (predictor && predictor->predictor_enabled()) {
Miranda Callahan 2011/07/21 14:38:04 Isn't there be a race condition here if you allow
rpetterson 2011/08/10 02:24:46 I've fixed EnablePredictor to post a task to enabl
227 output->append("DNS pre-resolution and TCP pre-connection is disabled.");
228 } else {
229 if (!predictor->on_the_record()) {
230 output->append("Incognito mode is active in a window.");
231 } else {
232 // Show list of prediction results.
233 predictor->GetHtmlInfo(output);
234 }
235 }
236 output->append("</body></html>");
237 }
238
239 void Profile::PredictorOnTheRecord(bool enable) {
240 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
241 if (GetPredictor()->on_the_record() == enable)
242 return;
243 GetPredictor()->SetOnTheRecord(enable);
244 if (GetPredictor()->on_the_record())
245 g_browser_process->io_thread()->ChangedToOnTheRecord(this);
246 }
247
248 ////////////////////////////////////////////////////////////////////////////////
249 //
211 // OffTheRecordProfileImpl is a profile subclass that wraps an existing profile 250 // OffTheRecordProfileImpl is a profile subclass that wraps an existing profile
212 // to make it suitable for the incognito mode. 251 // to make it suitable for the incognito mode.
213 // 252 //
214 //////////////////////////////////////////////////////////////////////////////// 253 ////////////////////////////////////////////////////////////////////////////////
215 class OffTheRecordProfileImpl : public Profile, 254 class OffTheRecordProfileImpl : public Profile,
216 public BrowserList::Observer { 255 public BrowserList::Observer {
217 public: 256 public:
218 explicit OffTheRecordProfileImpl(Profile* real_profile) 257 explicit OffTheRecordProfileImpl(Profile* real_profile)
219 : profile_(real_profile), 258 : profile_(real_profile),
220 prefs_(real_profile->GetOffTheRecordPrefs()), 259 prefs_(real_profile->GetOffTheRecordPrefs()),
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 }; 890 };
852 #endif 891 #endif
853 892
854 Profile* Profile::CreateOffTheRecordProfile() { 893 Profile* Profile::CreateOffTheRecordProfile() {
855 #if defined(OS_CHROMEOS) 894 #if defined(OS_CHROMEOS)
856 if (Profile::IsGuestSession()) 895 if (Profile::IsGuestSession())
857 return new GuestSessionProfile(this); 896 return new GuestSessionProfile(this);
858 #endif 897 #endif
859 return new OffTheRecordProfileImpl(this); 898 return new OffTheRecordProfileImpl(this);
860 } 899 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698