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/environment.h" | 8 #include "base/environment.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
16 #include "chrome/browser/about_flags.h" | |
17 #include "chrome/browser/appcache/chrome_appcache_service.h" | 16 #include "chrome/browser/appcache/chrome_appcache_service.h" |
18 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 17 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
19 #include "chrome/browser/autofill/personal_data_manager.h" | 18 #include "chrome/browser/autofill/personal_data_manager.h" |
20 #include "chrome/browser/background_contents_service.h" | 19 #include "chrome/browser/background_contents_service.h" |
21 #include "chrome/browser/background_mode_manager.h" | 20 #include "chrome/browser/background_mode_manager.h" |
22 #include "chrome/browser/bookmarks/bookmark_model.h" | 21 #include "chrome/browser/bookmarks/bookmark_model.h" |
23 #include "chrome/browser/browser_list.h" | 22 #include "chrome/browser/browser_list.h" |
24 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
25 #include "chrome/browser/browser_signin.h" | 24 #include "chrome/browser/browser_signin.h" |
26 #include "chrome/browser/browser_thread.h" | 25 #include "chrome/browser/browser_thread.h" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this, | 270 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this, |
272 &ProfileImpl::EnsureSessionServiceCreated); | 271 &ProfileImpl::EnsureSessionServiceCreated); |
273 | 272 |
274 PrefService* prefs = GetPrefs(); | 273 PrefService* prefs = GetPrefs(); |
275 pref_change_registrar_.Init(prefs); | 274 pref_change_registrar_.Init(prefs); |
276 pref_change_registrar_.Add(prefs::kSpellCheckDictionary, this); | 275 pref_change_registrar_.Add(prefs::kSpellCheckDictionary, this); |
277 pref_change_registrar_.Add(prefs::kEnableSpellCheck, this); | 276 pref_change_registrar_.Add(prefs::kEnableSpellCheck, this); |
278 pref_change_registrar_.Add(prefs::kEnableAutoSpellCorrect, this); | 277 pref_change_registrar_.Add(prefs::kEnableAutoSpellCorrect, this); |
279 pref_change_registrar_.Add(prefs::kClearSiteDataOnExit, this); | 278 pref_change_registrar_.Add(prefs::kClearSiteDataOnExit, this); |
280 | 279 |
281 // Convert active labs into switches. Modifies the current command line. | |
282 about_flags::ConvertFlagsToSwitches(prefs, CommandLine::ForCurrentProcess()); | |
283 | |
284 // It would be nice to use PathService for fetching this directory, but | 280 // It would be nice to use PathService for fetching this directory, but |
285 // the cache directory depends on the profile directory, which isn't available | 281 // the cache directory depends on the profile directory, which isn't available |
286 // to PathService. | 282 // to PathService. |
287 chrome::GetUserCacheDirectory(path_, &base_cache_path_); | 283 chrome::GetUserCacheDirectory(path_, &base_cache_path_); |
288 file_util::CreateDirectory(base_cache_path_); | 284 file_util::CreateDirectory(base_cache_path_); |
289 | 285 |
290 // Listen for theme installations from our original profile. | 286 // Listen for theme installations from our original profile. |
291 registrar_.Add(this, NotificationType::THEME_INSTALLED, | 287 registrar_.Add(this, NotificationType::THEME_INSTALLED, |
292 Source<Profile>(GetOriginalProfile())); | 288 Source<Profile>(GetOriginalProfile())); |
293 | 289 |
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1403 } | 1399 } |
1404 | 1400 |
1405 PrerenderManager* ProfileImpl::GetPrerenderManager() { | 1401 PrerenderManager* ProfileImpl::GetPrerenderManager() { |
1406 CommandLine* cl = CommandLine::ForCurrentProcess(); | 1402 CommandLine* cl = CommandLine::ForCurrentProcess(); |
1407 if (!cl->HasSwitch(switches::kEnablePagePrerender)) | 1403 if (!cl->HasSwitch(switches::kEnablePagePrerender)) |
1408 return NULL; | 1404 return NULL; |
1409 if (!prerender_manager_) | 1405 if (!prerender_manager_) |
1410 prerender_manager_ = new PrerenderManager(this); | 1406 prerender_manager_ = new PrerenderManager(this); |
1411 return prerender_manager_; | 1407 return prerender_manager_; |
1412 } | 1408 } |
OLD | NEW |