| 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 13 matching lines...) Expand all Loading... |
| 24 #include "chrome/browser/sync/profile_sync_service.h" | 24 #include "chrome/browser/sync/profile_sync_service.h" |
| 25 #include "chrome/browser/ui/browser.h" | 25 #include "chrome/browser/ui/browser.h" |
| 26 #include "chrome/browser/ui/browser_window.h" | 26 #include "chrome/browser/ui/browser_window.h" |
| 27 #include "chrome/browser/ui/webui/sync_promo_ui.h" | 27 #include "chrome/browser/ui/webui/sync_promo_ui.h" |
| 28 #include "chrome/common/chrome_constants.h" | 28 #include "chrome/common/chrome_constants.h" |
| 29 #include "chrome/common/chrome_notification_types.h" | 29 #include "chrome/common/chrome_notification_types.h" |
| 30 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
| 31 #include "chrome/common/logging_chrome.h" | 31 #include "chrome/common/logging_chrome.h" |
| 32 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
| 33 #include "chrome/common/url_constants.h" | 33 #include "chrome/common/url_constants.h" |
| 34 #include "content/browser/user_metrics.h" | |
| 35 #include "content/public/browser/browser_thread.h" | 34 #include "content/public/browser/browser_thread.h" |
| 36 #include "content/public/browser/notification_service.h" | 35 #include "content/public/browser/notification_service.h" |
| 36 #include "content/public/browser/user_metrics.h" |
| 37 #include "grit/generated_resources.h" | 37 #include "grit/generated_resources.h" |
| 38 #include "net/http/http_transaction_factory.h" | 38 #include "net/http/http_transaction_factory.h" |
| 39 #include "net/url_request/url_request_context.h" | 39 #include "net/url_request/url_request_context.h" |
| 40 #include "net/url_request/url_request_context_getter.h" | 40 #include "net/url_request/url_request_context_getter.h" |
| 41 #include "net/url_request/url_request_job.h" | 41 #include "net/url_request/url_request_job.h" |
| 42 #include "ui/base/l10n/l10n_util.h" | 42 #include "ui/base/l10n/l10n_util.h" |
| 43 | 43 |
| 44 #if defined(OS_CHROMEOS) | 44 #if defined(OS_CHROMEOS) |
| 45 #include "chrome/browser/chromeos/cros/cros_library.h" | 45 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 46 #include "chrome/browser/chromeos/cros/cryptohome_library.h" | 46 #include "chrome/browser/chromeos/cros/cryptohome_library.h" |
| 47 #endif | 47 #endif |
| 48 | 48 |
| 49 using content::BrowserThread; | 49 using content::BrowserThread; |
| 50 using content::UserMetricsAction; |
| 50 | 51 |
| 51 namespace { | 52 namespace { |
| 52 | 53 |
| 53 // Profiles that should be deleted on shutdown. | 54 // Profiles that should be deleted on shutdown. |
| 54 std::vector<FilePath>& ProfilesToDelete() { | 55 std::vector<FilePath>& ProfilesToDelete() { |
| 55 CR_DEFINE_STATIC_LOCAL(std::vector<FilePath>, profiles_to_delete, ()); | 56 CR_DEFINE_STATIC_LOCAL(std::vector<FilePath>, profiles_to_delete, ()); |
| 56 return profiles_to_delete; | 57 return profiles_to_delete; |
| 57 } | 58 } |
| 58 | 59 |
| 59 // Simple task to log the size of the current profile. | 60 // Simple task to log the size of the current profile. |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 // static | 389 // static |
| 389 void ProfileManager::NewWindowWithProfile( | 390 void ProfileManager::NewWindowWithProfile( |
| 390 Profile* profile, | 391 Profile* profile, |
| 391 BrowserInit::IsProcessStartup process_startup, | 392 BrowserInit::IsProcessStartup process_startup, |
| 392 BrowserInit::IsFirstRun is_first_run) { | 393 BrowserInit::IsFirstRun is_first_run) { |
| 393 DCHECK(profile); | 394 DCHECK(profile); |
| 394 Browser* browser = BrowserList::FindTabbedBrowser(profile, false); | 395 Browser* browser = BrowserList::FindTabbedBrowser(profile, false); |
| 395 if (browser) { | 396 if (browser) { |
| 396 browser->window()->Activate(); | 397 browser->window()->Activate(); |
| 397 } else { | 398 } else { |
| 398 UserMetrics::RecordAction(UserMetricsAction("NewWindow")); | 399 content::RecordAction(UserMetricsAction("NewWindow")); |
| 399 CommandLine command_line(CommandLine::NO_PROGRAM); | 400 CommandLine command_line(CommandLine::NO_PROGRAM); |
| 400 int return_code; | 401 int return_code; |
| 401 BrowserInit browser_init; | 402 BrowserInit browser_init; |
| 402 browser_init.LaunchBrowser(command_line, profile, FilePath(), | 403 browser_init.LaunchBrowser(command_line, profile, FilePath(), |
| 403 process_startup, is_first_run, &return_code); | 404 process_startup, is_first_run, &return_code); |
| 404 } | 405 } |
| 405 } | 406 } |
| 406 | 407 |
| 407 void ProfileManager::Observe( | 408 void ProfileManager::Observe( |
| 408 int type, | 409 int type, |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 profile_info_cache_->RemoveObserver(profile_shortcut_manager_.get()); | 700 profile_info_cache_->RemoveObserver(profile_shortcut_manager_.get()); |
| 700 } | 701 } |
| 701 #endif | 702 #endif |
| 702 | 703 |
| 703 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, | 704 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, |
| 704 Profile* profile, | 705 Profile* profile, |
| 705 Profile::CreateStatus status) { | 706 Profile::CreateStatus status) { |
| 706 for (size_t i = 0; i < callbacks.size(); ++i) | 707 for (size_t i = 0; i < callbacks.size(); ++i) |
| 707 callbacks[i].Run(profile, status); | 708 callbacks[i].Run(profile, status); |
| 708 } | 709 } |
| OLD | NEW |