OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 #include "chrome/browser/profiles/profile_metrics.h" | 72 #include "chrome/browser/profiles/profile_metrics.h" |
73 #include "chrome/browser/search_engines/template_url_fetcher.h" | 73 #include "chrome/browser/search_engines/template_url_fetcher.h" |
74 #include "chrome/browser/sessions/session_service_factory.h" | 74 #include "chrome/browser/sessions/session_service_factory.h" |
75 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 75 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
76 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 76 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
77 #include "chrome/browser/webdata/web_data_service.h" | 77 #include "chrome/browser/webdata/web_data_service.h" |
78 #include "chrome/common/chrome_constants.h" | 78 #include "chrome/common/chrome_constants.h" |
79 #include "chrome/common/chrome_paths_internal.h" | 79 #include "chrome/common/chrome_paths_internal.h" |
80 #include "chrome/common/chrome_switches.h" | 80 #include "chrome/common/chrome_switches.h" |
81 #include "chrome/common/chrome_version_info.h" | 81 #include "chrome/common/chrome_version_info.h" |
82 #include "chrome/common/net/url_fixer_upper.h" | |
83 #include "chrome/common/pref_names.h" | 82 #include "chrome/common/pref_names.h" |
84 #include "chrome/common/url_constants.h" | 83 #include "chrome/common/url_constants.h" |
85 #include "components/bookmarks/browser/bookmark_model.h" | 84 #include "components/bookmarks/browser/bookmark_model.h" |
86 #include "components/dom_distiller/content/dom_distiller_viewer_source.h" | 85 #include "components/dom_distiller/content/dom_distiller_viewer_source.h" |
87 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 86 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
88 #include "components/pref_registry/pref_registry_syncable.h" | 87 #include "components/pref_registry/pref_registry_syncable.h" |
89 #include "components/startup_metric_utils/startup_metric_utils.h" | 88 #include "components/startup_metric_utils/startup_metric_utils.h" |
| 89 #include "components/url_fixer/url_fixer.h" |
90 #include "components/user_prefs/user_prefs.h" | 90 #include "components/user_prefs/user_prefs.h" |
91 #include "content/public/browser/browser_thread.h" | 91 #include "content/public/browser/browser_thread.h" |
92 #include "content/public/browser/dom_storage_context.h" | 92 #include "content/public/browser/dom_storage_context.h" |
93 #include "content/public/browser/host_zoom_map.h" | 93 #include "content/public/browser/host_zoom_map.h" |
94 #include "content/public/browser/notification_service.h" | 94 #include "content/public/browser/notification_service.h" |
95 #include "content/public/browser/render_process_host.h" | 95 #include "content/public/browser/render_process_host.h" |
96 #include "content/public/browser/storage_partition.h" | 96 #include "content/public/browser/storage_partition.h" |
97 #include "content/public/browser/url_data_source.h" | 97 #include "content/public/browser/url_data_source.h" |
98 #include "content/public/browser/user_metrics.h" | 98 #include "content/public/browser/user_metrics.h" |
99 #include "content/public/common/content_constants.h" | 99 #include "content/public/common/content_constants.h" |
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1261 // --homepage overrides any preferences. | 1261 // --homepage overrides any preferences. |
1262 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 1262 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
1263 if (command_line.HasSwitch(switches::kHomePage)) { | 1263 if (command_line.HasSwitch(switches::kHomePage)) { |
1264 // TODO(evanm): clean up usage of DIR_CURRENT. | 1264 // TODO(evanm): clean up usage of DIR_CURRENT. |
1265 // http://code.google.com/p/chromium/issues/detail?id=60630 | 1265 // http://code.google.com/p/chromium/issues/detail?id=60630 |
1266 // For now, allow this code to call getcwd(). | 1266 // For now, allow this code to call getcwd(). |
1267 base::ThreadRestrictions::ScopedAllowIO allow_io; | 1267 base::ThreadRestrictions::ScopedAllowIO allow_io; |
1268 | 1268 |
1269 base::FilePath browser_directory; | 1269 base::FilePath browser_directory; |
1270 PathService::Get(base::DIR_CURRENT, &browser_directory); | 1270 PathService::Get(base::DIR_CURRENT, &browser_directory); |
1271 GURL home_page(URLFixerUpper::FixupRelativeFile(browser_directory, | 1271 GURL home_page(url_fixer::FixupRelativeFile( |
| 1272 browser_directory, |
1272 command_line.GetSwitchValuePath(switches::kHomePage))); | 1273 command_line.GetSwitchValuePath(switches::kHomePage))); |
1273 if (home_page.is_valid()) | 1274 if (home_page.is_valid()) |
1274 return home_page; | 1275 return home_page; |
1275 } | 1276 } |
1276 | 1277 |
1277 if (GetPrefs()->GetBoolean(prefs::kHomePageIsNewTabPage)) | 1278 if (GetPrefs()->GetBoolean(prefs::kHomePageIsNewTabPage)) |
1278 return GURL(chrome::kChromeUINewTabURL); | 1279 return GURL(chrome::kChromeUINewTabURL); |
1279 GURL home_page(URLFixerUpper::FixupURL( | 1280 GURL home_page(url_fixer::FixupURL(GetPrefs()->GetString(prefs::kHomePage), |
1280 GetPrefs()->GetString(prefs::kHomePage), | 1281 std::string())); |
1281 std::string())); | |
1282 if (!home_page.is_valid()) | 1282 if (!home_page.is_valid()) |
1283 return GURL(chrome::kChromeUINewTabURL); | 1283 return GURL(chrome::kChromeUINewTabURL); |
1284 return home_page; | 1284 return home_page; |
1285 } | 1285 } |
1286 | 1286 |
1287 void ProfileImpl::UpdateProfileUserNameCache() { | 1287 void ProfileImpl::UpdateProfileUserNameCache() { |
1288 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 1288 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
1289 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); | 1289 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); |
1290 size_t index = cache.GetIndexOfProfileWithPath(GetPath()); | 1290 size_t index = cache.GetIndexOfProfileWithPath(GetPath()); |
1291 if (index != std::string::npos) { | 1291 if (index != std::string::npos) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1359 PrefProxyConfigTracker* ProfileImpl::CreateProxyConfigTracker() { | 1359 PrefProxyConfigTracker* ProfileImpl::CreateProxyConfigTracker() { |
1360 #if defined(OS_CHROMEOS) | 1360 #if defined(OS_CHROMEOS) |
1361 if (chromeos::ProfileHelper::IsSigninProfile(this)) { | 1361 if (chromeos::ProfileHelper::IsSigninProfile(this)) { |
1362 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( | 1362 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( |
1363 g_browser_process->local_state()); | 1363 g_browser_process->local_state()); |
1364 } | 1364 } |
1365 #endif // defined(OS_CHROMEOS) | 1365 #endif // defined(OS_CHROMEOS) |
1366 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( | 1366 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( |
1367 GetPrefs(), g_browser_process->local_state()); | 1367 GetPrefs(), g_browser_process->local_state()); |
1368 } | 1368 } |
OLD | NEW |