| 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 <set> | 5 #include <set> |
| 6 | 6 |
| 7 #include "chrome/browser/profiles/profile_manager.h" | 7 #include "chrome/browser/profiles/profile_manager.h" |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "chrome/browser/sync/profile_sync_service.h" | 25 #include "chrome/browser/sync/profile_sync_service.h" |
| 26 #include "chrome/browser/ui/browser.h" | 26 #include "chrome/browser/ui/browser.h" |
| 27 #include "chrome/browser/ui/browser_window.h" | 27 #include "chrome/browser/ui/browser_window.h" |
| 28 #include "chrome/browser/ui/webui/sync_promo_ui.h" | 28 #include "chrome/browser/ui/webui/sync_promo_ui.h" |
| 29 #include "chrome/common/chrome_constants.h" | 29 #include "chrome/common/chrome_constants.h" |
| 30 #include "chrome/common/chrome_notification_types.h" | 30 #include "chrome/common/chrome_notification_types.h" |
| 31 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
| 32 #include "chrome/common/logging_chrome.h" | 32 #include "chrome/common/logging_chrome.h" |
| 33 #include "chrome/common/pref_names.h" | 33 #include "chrome/common/pref_names.h" |
| 34 #include "chrome/common/url_constants.h" | 34 #include "chrome/common/url_constants.h" |
| 35 #include "content/browser/user_metrics.h" | |
| 36 #include "content/public/browser/browser_thread.h" | 35 #include "content/public/browser/browser_thread.h" |
| 37 #include "content/public/browser/notification_service.h" | 36 #include "content/public/browser/notification_service.h" |
| 37 #include "content/public/browser/user_metrics.h" |
| 38 #include "grit/generated_resources.h" | 38 #include "grit/generated_resources.h" |
| 39 #include "net/http/http_transaction_factory.h" | 39 #include "net/http/http_transaction_factory.h" |
| 40 #include "net/url_request/url_request_context.h" | 40 #include "net/url_request/url_request_context.h" |
| 41 #include "net/url_request/url_request_context_getter.h" | 41 #include "net/url_request/url_request_context_getter.h" |
| 42 #include "net/url_request/url_request_job.h" | 42 #include "net/url_request/url_request_job.h" |
| 43 #include "ui/base/l10n/l10n_util.h" | 43 #include "ui/base/l10n/l10n_util.h" |
| 44 | 44 |
| 45 #if defined(OS_CHROMEOS) | 45 #if defined(OS_CHROMEOS) |
| 46 #include "chrome/browser/chromeos/cros/cros_library.h" | 46 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 47 #include "chrome/browser/chromeos/cros/cryptohome_library.h" | 47 #include "chrome/browser/chromeos/cros/cryptohome_library.h" |
| 48 #endif | 48 #endif |
| 49 | 49 |
| 50 using content::BrowserThread; | 50 using content::BrowserThread; |
| 51 using content::UserMetricsAction; |
| 51 | 52 |
| 52 namespace { | 53 namespace { |
| 53 | 54 |
| 54 // Profiles that should be deleted on shutdown. | 55 // Profiles that should be deleted on shutdown. |
| 55 std::vector<FilePath>& ProfilesToDelete() { | 56 std::vector<FilePath>& ProfilesToDelete() { |
| 56 CR_DEFINE_STATIC_LOCAL(std::vector<FilePath>, profiles_to_delete, ()); | 57 CR_DEFINE_STATIC_LOCAL(std::vector<FilePath>, profiles_to_delete, ()); |
| 57 return profiles_to_delete; | 58 return profiles_to_delete; |
| 58 } | 59 } |
| 59 | 60 |
| 60 // Checks if any user prefs for |profile| have default values. | 61 // Checks if any user prefs for |profile| have default values. |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 // static | 403 // static |
| 403 void ProfileManager::NewWindowWithProfile( | 404 void ProfileManager::NewWindowWithProfile( |
| 404 Profile* profile, | 405 Profile* profile, |
| 405 BrowserInit::IsProcessStartup process_startup, | 406 BrowserInit::IsProcessStartup process_startup, |
| 406 BrowserInit::IsFirstRun is_first_run) { | 407 BrowserInit::IsFirstRun is_first_run) { |
| 407 DCHECK(profile); | 408 DCHECK(profile); |
| 408 Browser* browser = BrowserList::FindTabbedBrowser(profile, false); | 409 Browser* browser = BrowserList::FindTabbedBrowser(profile, false); |
| 409 if (browser) { | 410 if (browser) { |
| 410 browser->window()->Activate(); | 411 browser->window()->Activate(); |
| 411 } else { | 412 } else { |
| 412 UserMetrics::RecordAction(UserMetricsAction("NewWindow")); | 413 content::RecordAction(UserMetricsAction("NewWindow")); |
| 413 CommandLine command_line(CommandLine::NO_PROGRAM); | 414 CommandLine command_line(CommandLine::NO_PROGRAM); |
| 414 int return_code; | 415 int return_code; |
| 415 BrowserInit browser_init; | 416 BrowserInit browser_init; |
| 416 browser_init.LaunchBrowser(command_line, profile, FilePath(), | 417 browser_init.LaunchBrowser(command_line, profile, FilePath(), |
| 417 process_startup, is_first_run, &return_code); | 418 process_startup, is_first_run, &return_code); |
| 418 } | 419 } |
| 419 } | 420 } |
| 420 | 421 |
| 421 void ProfileManager::Observe( | 422 void ProfileManager::Observe( |
| 422 int type, | 423 int type, |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 profile_info_cache_->RemoveObserver(profile_shortcut_manager_.get()); | 755 profile_info_cache_->RemoveObserver(profile_shortcut_manager_.get()); |
| 755 } | 756 } |
| 756 #endif | 757 #endif |
| 757 | 758 |
| 758 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, | 759 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, |
| 759 Profile* profile, | 760 Profile* profile, |
| 760 Profile::CreateStatus status) { | 761 Profile::CreateStatus status) { |
| 761 for (size_t i = 0; i < callbacks.size(); ++i) | 762 for (size_t i = 0; i < callbacks.size(); ++i) |
| 762 callbacks[i].Run(profile, status); | 763 callbacks[i].Run(profile, status); |
| 763 } | 764 } |
| OLD | NEW |