Chromium Code Reviews| 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 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 938 // Check whether we are the default browser. | 939 // Check whether we are the default browser. |
| 939 CheckDefaultBrowser(profile); | 940 CheckDefaultBrowser(profile); |
| 940 } | 941 } |
| 941 } | 942 } |
| 942 #if defined(OS_MACOSX) | 943 #if defined(OS_MACOSX) |
| 943 // Check whether the auto-update system needs to be promoted from user | 944 // Check whether the auto-update system needs to be promoted from user |
| 944 // to system. | 945 // to system. |
| 945 KeystoneInfoBar::PromotionInfoBar(profile); | 946 KeystoneInfoBar::PromotionInfoBar(profile); |
| 946 #endif | 947 #endif |
| 947 } | 948 } |
| 949 | |
| 950 // Notify user if the Preferences backup is invalid. | |
| 951 CheckPreferencesBackup(profile); | |
|
sky
2012/03/20 17:23:18
Don't we only want to do this once per profile?
Ivan Korotkov
2012/03/20 17:40:59
Hm, right, thanks -- I'll update the CL tomorrow t
Ivan Korotkov
2012/03/21 10:02:06
It actually works with multiprofiles as well -- th
| |
| 948 } | 952 } |
| 949 | 953 |
| 950 #if defined(OS_WIN) | 954 #if defined(OS_WIN) |
| 951 // Print the selected page if the command line switch exists. Note that the | 955 // Print the selected page if the command line switch exists. Note that the |
| 952 // current selected tab would be the page which will be printed. | 956 // current selected tab would be the page which will be printed. |
| 953 if (command_line_.HasSwitch(switches::kPrint)) { | 957 if (command_line_.HasSwitch(switches::kPrint)) { |
| 954 Browser* browser = BrowserList::GetLastActive(); | 958 Browser* browser = BrowserList::GetLastActive(); |
| 955 browser->Print(); | 959 browser->Print(); |
| 956 } | 960 } |
| 957 #endif | 961 #endif |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1640 // index 0. The tab spawned by the dialog will be at index 1 so return | 1644 // index 0. The tab spawned by the dialog will be at index 1 so return |
| 1641 // 0 to make it the active tab. | 1645 // 0 to make it the active tab. |
| 1642 return 1; | 1646 return 1; |
| 1643 } | 1647 } |
| 1644 } | 1648 } |
| 1645 } | 1649 } |
| 1646 | 1650 |
| 1647 return std::string::npos; | 1651 return std::string::npos; |
| 1648 } | 1652 } |
| 1649 | 1653 |
| 1654 void BrowserInit::LaunchWithProfile::CheckPreferencesBackup(Profile* profile) { | |
| 1655 protector::ProtectorService* protector_service = | |
| 1656 protector::ProtectorServiceFactory::GetForProfile(profile); | |
| 1657 protector::ProtectedPrefsWatcher* prefs_watcher = | |
| 1658 protector_service->GetPrefsWatcher(); | |
| 1659 if (protector::IsEnabled() && !prefs_watcher->is_backup_valid()) { | |
| 1660 // Sign the backup so that the bubble won't be shown on next browser start. | |
| 1661 prefs_watcher->UpdateBackupSignature(); | |
| 1662 protector_service->ShowChange(protector::CreatePrefsBackupInvalidChange()); | |
| 1663 } | |
| 1664 } | |
| 1665 | |
| 1650 std::vector<GURL> BrowserInit::GetURLsFromCommandLine( | 1666 std::vector<GURL> BrowserInit::GetURLsFromCommandLine( |
| 1651 const CommandLine& command_line, | 1667 const CommandLine& command_line, |
| 1652 const FilePath& cur_dir, | 1668 const FilePath& cur_dir, |
| 1653 Profile* profile) { | 1669 Profile* profile) { |
| 1654 std::vector<GURL> urls; | 1670 std::vector<GURL> urls; |
| 1655 const CommandLine::StringVector& params = command_line.GetArgs(); | 1671 const CommandLine::StringVector& params = command_line.GetArgs(); |
| 1656 | 1672 |
| 1657 for (size_t i = 0; i < params.size(); ++i) { | 1673 for (size_t i = 0; i < params.size(); ++i) { |
| 1658 FilePath param = FilePath(params[i]); | 1674 FilePath param = FilePath(params[i]); |
| 1659 // Handle Vista way of searching - "? <search-term>" | 1675 // Handle Vista way of searching - "? <search-term>" |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1942 | 1958 |
| 1943 Profile* profile = ProfileManager::GetLastUsedProfile(); | 1959 Profile* profile = ProfileManager::GetLastUsedProfile(); |
| 1944 if (!profile) { | 1960 if (!profile) { |
| 1945 // We should only be able to get here if the profile already exists and | 1961 // We should only be able to get here if the profile already exists and |
| 1946 // has been created. | 1962 // has been created. |
| 1947 NOTREACHED(); | 1963 NOTREACHED(); |
| 1948 return; | 1964 return; |
| 1949 } | 1965 } |
| 1950 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, NULL); | 1966 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, NULL); |
| 1951 } | 1967 } |
| OLD | NEW |