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

Side by Side Diff: chrome/installer/util/google_chrome_distribution.cc

Issue 10826144: Delete both regular and Metro user data dirs on uninstall. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: factored in gab's comments Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « chrome/installer/util/auto_launch_util.cc ('k') | chrome/installer/util/helper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // This file defines specific implementation of BrowserDistribution class for 5 // This file defines specific implementation of BrowserDistribution class for
6 // Google Chrome. 6 // Google Chrome.
7 7
8 #include "chrome/installer/util/google_chrome_distribution.h" 8 #include "chrome/installer/util/google_chrome_distribution.h"
9 9
10 #include <vector> 10 #include <vector>
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 // Check that the user was not already drafted in this experiment. 757 // Check that the user was not already drafted in this experiment.
758 string16 client; 758 string16 client;
759 GoogleUpdateSettings::GetClient(&client); 759 GoogleUpdateSettings::GetClient(&client);
760 if (client.size() > 2) { 760 if (client.size() > 2) {
761 if (base_group == client.substr(0, 2)) { 761 if (base_group == client.substr(0, 2)) {
762 VLOG(1) << "User already participated in this experiment"; 762 VLOG(1) << "User already participated in this experiment";
763 return; 763 return;
764 } 764 }
765 } 765 }
766 // Check browser usage inactivity by the age of the last-write time of the 766 // Check browser usage inactivity by the age of the last-write time of the
767 // chrome user data directory. 767 // most recently-used chrome user data directory.
768 FilePath user_data_dir(product.GetUserDataPath()); 768 std::vector<FilePath> user_data_dirs;
769 product.GetUserDataPaths(&user_data_dirs);
770 int dir_age_hours = -1;
771 for (size_t i = 0; i < user_data_dirs.size(); ++i) {
772 int this_age = GetDirectoryWriteAgeInHours(
773 user_data_dirs[i].value().c_str());
774 if (this_age >= 0 && (dir_age_hours < 0 || this_age < dir_age_hours))
775 dir_age_hours = this_age;
776 }
769 777
770 const bool experiment_enabled = false; 778 const bool experiment_enabled = false;
771 const int kThirtyDays = 30 * 24; 779 const int kThirtyDays = 30 * 24;
772 780
773 int dir_age_hours = GetDirectoryWriteAgeInHours(
774 user_data_dir.value().c_str());
775 if (!experiment_enabled) { 781 if (!experiment_enabled) {
776 VLOG(1) << "Toast experiment is disabled."; 782 VLOG(1) << "Toast experiment is disabled.";
777 return; 783 return;
778 } else if (dir_age_hours < 0) { 784 } else if (dir_age_hours < 0) {
779 // This means that we failed to find the user data dir. The most likely 785 // This means that we failed to find the user data dir. The most likely
780 // cause is that this user has not ever used chrome at all which can 786 // cause is that this user has not ever used chrome at all which can
781 // happen in a system-level install. 787 // happen in a system-level install.
782 SetClient(base_group + kToastUDDirFailure, true); 788 SetClient(base_group + kToastUDDirFailure, true);
783 return; 789 return;
784 } else if (dir_age_hours < kThirtyDays) { 790 } else if (dir_age_hours < kThirtyDays) {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 // we waited for chrome to exit so the uninstall would not detect chrome 878 // we waited for chrome to exit so the uninstall would not detect chrome
873 // running. 879 // running.
874 bool system_level_toast = CommandLine::ForCurrentProcess()->HasSwitch( 880 bool system_level_toast = CommandLine::ForCurrentProcess()->HasSwitch(
875 installer::switches::kSystemLevelToast); 881 installer::switches::kSystemLevelToast);
876 882
877 CommandLine cmd(InstallUtil::GetChromeUninstallCmd(system_level_toast, 883 CommandLine cmd(InstallUtil::GetChromeUninstallCmd(system_level_toast,
878 GetType())); 884 GetType()));
879 base::LaunchProcess(cmd, base::LaunchOptions(), NULL); 885 base::LaunchProcess(cmd, base::LaunchOptions(), NULL);
880 } 886 }
881 #endif 887 #endif
OLDNEW
« no previous file with comments | « chrome/installer/util/auto_launch_util.cc ('k') | chrome/installer/util/helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698