| 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_manager.h" | 5 #include "chrome/browser/profiles/profile_manager.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/deferred_sequenced_task_runner.h" | 15 #include "base/deferred_sequenced_task_runner.h" |
| 16 #include "base/feature_list.h" | 16 #include "base/feature_list.h" |
| 17 #include "base/files/file_enumerator.h" | 17 #include "base/files/file_enumerator.h" |
| 18 #include "base/files/file_path.h" | 18 #include "base/files/file_path.h" |
| 19 #include "base/files/file_util.h" | 19 #include "base/files/file_util.h" |
| 20 #include "base/metrics/histogram_macros.h" | 20 #include "base/metrics/histogram_macros.h" |
| 21 #include "base/metrics/user_metrics.h" |
| 21 #include "base/strings/string_number_conversions.h" | 22 #include "base/strings/string_number_conversions.h" |
| 22 #include "base/strings/string_util.h" | 23 #include "base/strings/string_util.h" |
| 23 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
| 24 #include "base/trace_event/trace_event.h" | 25 #include "base/trace_event/trace_event.h" |
| 25 #include "base/value_conversions.h" | 26 #include "base/value_conversions.h" |
| 26 #include "build/build_config.h" | 27 #include "build/build_config.h" |
| 27 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 28 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 28 #include "chrome/browser/bookmarks/startup_task_runner_service_factory.h" | 29 #include "chrome/browser/bookmarks/startup_task_runner_service_factory.h" |
| 29 #include "chrome/browser/browser_process.h" | 30 #include "chrome/browser/browser_process.h" |
| 30 #include "chrome/browser/chrome_notification_types.h" | 31 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 #include "components/prefs/scoped_user_pref_update.h" | 79 #include "components/prefs/scoped_user_pref_update.h" |
| 79 #include "components/search_engines/default_search_manager.h" | 80 #include "components/search_engines/default_search_manager.h" |
| 80 #include "components/signin/core/browser/account_fetcher_service.h" | 81 #include "components/signin/core/browser/account_fetcher_service.h" |
| 81 #include "components/signin/core/browser/account_tracker_service.h" | 82 #include "components/signin/core/browser/account_tracker_service.h" |
| 82 #include "components/signin/core/browser/gaia_cookie_manager_service.h" | 83 #include "components/signin/core/browser/gaia_cookie_manager_service.h" |
| 83 #include "components/signin/core/browser/signin_manager.h" | 84 #include "components/signin/core/browser/signin_manager.h" |
| 84 #include "components/signin/core/common/signin_pref_names.h" | 85 #include "components/signin/core/common/signin_pref_names.h" |
| 85 #include "components/sync/base/stop_source.h" | 86 #include "components/sync/base/stop_source.h" |
| 86 #include "content/public/browser/browser_thread.h" | 87 #include "content/public/browser/browser_thread.h" |
| 87 #include "content/public/browser/notification_service.h" | 88 #include "content/public/browser/notification_service.h" |
| 88 #include "content/public/browser/user_metrics.h" | |
| 89 #include "content/public/common/content_switches.h" | 89 #include "content/public/common/content_switches.h" |
| 90 #include "extensions/features/features.h" | 90 #include "extensions/features/features.h" |
| 91 #include "net/http/http_transaction_factory.h" | 91 #include "net/http/http_transaction_factory.h" |
| 92 #include "net/url_request/url_request_context.h" | 92 #include "net/url_request/url_request_context.h" |
| 93 #include "net/url_request/url_request_context_getter.h" | 93 #include "net/url_request/url_request_context_getter.h" |
| 94 #include "net/url_request/url_request_job.h" | 94 #include "net/url_request/url_request_job.h" |
| 95 #include "ui/base/l10n/l10n_util.h" | 95 #include "ui/base/l10n/l10n_util.h" |
| 96 | 96 |
| 97 #if BUILDFLAG(ENABLE_EXTENSIONS) | 97 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 98 #include "chrome/browser/extensions/extension_service.h" | 98 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 info = RegisterProfile(CreateProfileAsyncHelper(profile_path, this), false); | 549 info = RegisterProfile(CreateProfileAsyncHelper(profile_path, this), false); |
| 550 size_t icon_index; | 550 size_t icon_index; |
| 551 DCHECK(base::IsStringASCII(icon_url)); | 551 DCHECK(base::IsStringASCII(icon_url)); |
| 552 if (profiles::IsDefaultAvatarIconUrl(icon_url, &icon_index)) { | 552 if (profiles::IsDefaultAvatarIconUrl(icon_url, &icon_index)) { |
| 553 // add profile to cache with user selected name and avatar | 553 // add profile to cache with user selected name and avatar |
| 554 GetProfileAttributesStorage().AddProfile(profile_path, name, | 554 GetProfileAttributesStorage().AddProfile(profile_path, name, |
| 555 std::string(), base::string16(), icon_index, supervised_user_id); | 555 std::string(), base::string16(), icon_index, supervised_user_id); |
| 556 } | 556 } |
| 557 | 557 |
| 558 if (!supervised_user_id.empty()) { | 558 if (!supervised_user_id.empty()) { |
| 559 content::RecordAction( | 559 base::RecordAction( |
| 560 UserMetricsAction("ManagedMode_LocallyManagedUserCreated")); | 560 UserMetricsAction("ManagedMode_LocallyManagedUserCreated")); |
| 561 } | 561 } |
| 562 | 562 |
| 563 ProfileMetrics::UpdateReportedProfilesStatistics(this); | 563 ProfileMetrics::UpdateReportedProfilesStatistics(this); |
| 564 } | 564 } |
| 565 | 565 |
| 566 // Call or enqueue the callback. | 566 // Call or enqueue the callback. |
| 567 if (!callback.is_null()) { | 567 if (!callback.is_null()) { |
| 568 if (iter != profiles_info_.end() && info->created) { | 568 if (iter != profiles_info_.end() && info->created) { |
| 569 Profile* profile = info->profile.get(); | 569 Profile* profile = info->profile.get(); |
| (...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1793 | 1793 |
| 1794 const base::FilePath new_active_profile_dir = | 1794 const base::FilePath new_active_profile_dir = |
| 1795 found_entry ? found_entry->GetPath() : GenerateNextProfileDirectoryPath(); | 1795 found_entry ? found_entry->GetPath() : GenerateNextProfileDirectoryPath(); |
| 1796 FinishDeletingProfile(profile_dir, new_active_profile_dir); | 1796 FinishDeletingProfile(profile_dir, new_active_profile_dir); |
| 1797 } | 1797 } |
| 1798 #endif // !defined(OS_ANDROID) | 1798 #endif // !defined(OS_ANDROID) |
| 1799 | 1799 |
| 1800 ProfileManagerWithoutInit::ProfileManagerWithoutInit( | 1800 ProfileManagerWithoutInit::ProfileManagerWithoutInit( |
| 1801 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { | 1801 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { |
| 1802 } | 1802 } |
| OLD | NEW |