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