Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(771)

Side by Side Diff: chrome/browser/ui/browser_init.cc

Issue 9748016: [protector] Added UI for invalid Preferences backup case. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Merge Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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);
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
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 prefs_watcher->UpdateBackupSignature();
whywhat 2012/03/20 16:06:01 What does this line do? It's not clear why it is h
Ivan Korotkov 2012/03/20 16:16:02 So that this dialog doesn't appear after Chrome re
1661 protector_service->ShowChange(protector::CreatePrefsBackupInvalidChange());
1662 }
1663 }
1664
1650 std::vector<GURL> BrowserInit::GetURLsFromCommandLine( 1665 std::vector<GURL> BrowserInit::GetURLsFromCommandLine(
1651 const CommandLine& command_line, 1666 const CommandLine& command_line,
1652 const FilePath& cur_dir, 1667 const FilePath& cur_dir,
1653 Profile* profile) { 1668 Profile* profile) {
1654 std::vector<GURL> urls; 1669 std::vector<GURL> urls;
1655 const CommandLine::StringVector& params = command_line.GetArgs(); 1670 const CommandLine::StringVector& params = command_line.GetArgs();
1656 1671
1657 for (size_t i = 0; i < params.size(); ++i) { 1672 for (size_t i = 0; i < params.size(); ++i) {
1658 FilePath param = FilePath(params[i]); 1673 FilePath param = FilePath(params[i]);
1659 // Handle Vista way of searching - "? <search-term>" 1674 // Handle Vista way of searching - "? <search-term>"
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1942 1957
1943 Profile* profile = ProfileManager::GetLastUsedProfile(); 1958 Profile* profile = ProfileManager::GetLastUsedProfile();
1944 if (!profile) { 1959 if (!profile) {
1945 // We should only be able to get here if the profile already exists and 1960 // We should only be able to get here if the profile already exists and
1946 // has been created. 1961 // has been created.
1947 NOTREACHED(); 1962 NOTREACHED();
1948 return; 1963 return;
1949 } 1964 }
1950 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, NULL); 1965 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, NULL);
1951 } 1966 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698