| 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/ui/browser_init.h" | 5 #include "chrome/browser/ui/browser_init.h" |
| 6 | 6 |
| 7 #include <algorithm> // For max(). | 7 #include <algorithm> // For max(). |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 48 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 49 #include "chrome/browser/prefs/pref_service.h" | 49 #include "chrome/browser/prefs/pref_service.h" |
| 50 #include "chrome/browser/prefs/session_startup_pref.h" | 50 #include "chrome/browser/prefs/session_startup_pref.h" |
| 51 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 51 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
| 52 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" | 52 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" |
| 53 #include "chrome/browser/printing/print_dialog_cloud.h" | 53 #include "chrome/browser/printing/print_dialog_cloud.h" |
| 54 #include "chrome/browser/profiles/profile.h" | 54 #include "chrome/browser/profiles/profile.h" |
| 55 #include "chrome/browser/profiles/profile_io_data.h" | 55 #include "chrome/browser/profiles/profile_io_data.h" |
| 56 #include "chrome/browser/profiles/profile_manager.h" | 56 #include "chrome/browser/profiles/profile_manager.h" |
| 57 #include "chrome/browser/protector/base_setting_change.h" | 57 #include "chrome/browser/protector/base_setting_change.h" |
| 58 #include "chrome/browser/protector/protected_prefs_watcher.h" |
| 58 #include "chrome/browser/protector/protector_service.h" | 59 #include "chrome/browser/protector/protector_service.h" |
| 59 #include "chrome/browser/protector/protector_service_factory.h" | 60 #include "chrome/browser/protector/protector_service_factory.h" |
| 60 #include "chrome/browser/search_engines/template_url.h" | 61 #include "chrome/browser/search_engines/template_url.h" |
| 61 #include "chrome/browser/search_engines/template_url_service.h" | 62 #include "chrome/browser/search_engines/template_url_service.h" |
| 62 #include "chrome/browser/search_engines/template_url_service_factory.h" | 63 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 63 #include "chrome/browser/sessions/session_restore.h" | 64 #include "chrome/browser/sessions/session_restore.h" |
| 64 #include "chrome/browser/sessions/session_service.h" | 65 #include "chrome/browser/sessions/session_service.h" |
| 65 #include "chrome/browser/sessions/session_service_factory.h" | 66 #include "chrome/browser/sessions/session_service_factory.h" |
| 66 #include "chrome/browser/shell_integration.h" | 67 #include "chrome/browser/shell_integration.h" |
| 67 #include "chrome/browser/tab_contents/link_infobar_delegate.h" | 68 #include "chrome/browser/tab_contents/link_infobar_delegate.h" |
| (...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 // Check whether we are the default browser. | 936 // Check whether we are the default browser. |
| 936 CheckDefaultBrowser(profile); | 937 CheckDefaultBrowser(profile); |
| 937 } | 938 } |
| 938 } | 939 } |
| 939 #if defined(OS_MACOSX) | 940 #if defined(OS_MACOSX) |
| 940 // Check whether the auto-update system needs to be promoted from user | 941 // Check whether the auto-update system needs to be promoted from user |
| 941 // to system. | 942 // to system. |
| 942 KeystoneInfoBar::PromotionInfoBar(profile); | 943 KeystoneInfoBar::PromotionInfoBar(profile); |
| 943 #endif | 944 #endif |
| 944 } | 945 } |
| 946 |
| 947 // Notify user if the Preferences backup is invalid. |
| 948 CheckPreferencesBackup(profile); |
| 945 } | 949 } |
| 946 | 950 |
| 947 #if defined(OS_WIN) | 951 #if defined(OS_WIN) |
| 948 // Print the selected page if the command line switch exists. Note that the | 952 // Print the selected page if the command line switch exists. Note that the |
| 949 // current selected tab would be the page which will be printed. | 953 // current selected tab would be the page which will be printed. |
| 950 if (command_line_.HasSwitch(switches::kPrint)) { | 954 if (command_line_.HasSwitch(switches::kPrint)) { |
| 951 Browser* browser = BrowserList::GetLastActive(); | 955 Browser* browser = BrowserList::GetLastActive(); |
| 952 browser->Print(); | 956 browser->Print(); |
| 953 } | 957 } |
| 954 #endif | 958 #endif |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1576 if (command_line.HasSwitch(switches::kAutoLaunchAtStartup) || | 1580 if (command_line.HasSwitch(switches::kAutoLaunchAtStartup) || |
| 1577 first_run::IsChromeFirstRun()) { | 1581 first_run::IsChromeFirstRun()) { |
| 1578 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 1582 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 1579 base::Bind(&CheckAutoLaunchCallback)); | 1583 base::Bind(&CheckAutoLaunchCallback)); |
| 1580 return true; | 1584 return true; |
| 1581 } | 1585 } |
| 1582 #endif | 1586 #endif |
| 1583 return false; | 1587 return false; |
| 1584 } | 1588 } |
| 1585 | 1589 |
| 1590 void BrowserInit::LaunchWithProfile::CheckPreferencesBackup(Profile* profile) { |
| 1591 protector::ProtectorService* protector_service = |
| 1592 protector::ProtectorServiceFactory::GetForProfile(profile); |
| 1593 protector::ProtectedPrefsWatcher* prefs_watcher = |
| 1594 protector_service->GetPrefsWatcher(); |
| 1595 if (protector::IsEnabled() && !prefs_watcher->is_backup_valid()) |
| 1596 protector_service->ShowChange(protector::CreatePrefsBackupInvalidChange()); |
| 1597 } |
| 1598 |
| 1586 std::vector<GURL> BrowserInit::GetURLsFromCommandLine( | 1599 std::vector<GURL> BrowserInit::GetURLsFromCommandLine( |
| 1587 const CommandLine& command_line, | 1600 const CommandLine& command_line, |
| 1588 const FilePath& cur_dir, | 1601 const FilePath& cur_dir, |
| 1589 Profile* profile) { | 1602 Profile* profile) { |
| 1590 std::vector<GURL> urls; | 1603 std::vector<GURL> urls; |
| 1591 const CommandLine::StringVector& params = command_line.GetArgs(); | 1604 const CommandLine::StringVector& params = command_line.GetArgs(); |
| 1592 | 1605 |
| 1593 for (size_t i = 0; i < params.size(); ++i) { | 1606 for (size_t i = 0; i < params.size(); ++i) { |
| 1594 FilePath param = FilePath(params[i]); | 1607 FilePath param = FilePath(params[i]); |
| 1595 // Handle Vista way of searching - "? <search-term>" | 1608 // Handle Vista way of searching - "? <search-term>" |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1878 | 1891 |
| 1879 Profile* profile = ProfileManager::GetLastUsedProfile(); | 1892 Profile* profile = ProfileManager::GetLastUsedProfile(); |
| 1880 if (!profile) { | 1893 if (!profile) { |
| 1881 // We should only be able to get here if the profile already exists and | 1894 // We should only be able to get here if the profile already exists and |
| 1882 // has been created. | 1895 // has been created. |
| 1883 NOTREACHED(); | 1896 NOTREACHED(); |
| 1884 return; | 1897 return; |
| 1885 } | 1898 } |
| 1886 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, NULL); | 1899 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, NULL); |
| 1887 } | 1900 } |
| OLD | NEW |