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

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

Issue 218683013: Remove stale code to delete the metro user data dir. It never shipped. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: gab comments Created 6 years, 8 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/installer/util/user_experiment.h" 5 #include "chrome/installer/util/user_experiment.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <sddl.h> 8 #include <sddl.h>
9 #include <wtsapi32.h> 9 #include <wtsapi32.h>
10 #include <vector> 10 #include <vector>
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 base::string16 client; 420 base::string16 client;
421 GoogleUpdateSettings::GetClient(&client); 421 GoogleUpdateSettings::GetClient(&client);
422 if (client.size() > 2) { 422 if (client.size() > 2) {
423 if (base_group == client.substr(0, 2)) { 423 if (base_group == client.substr(0, 2)) {
424 VLOG(1) << "User already participated in this experiment"; 424 VLOG(1) << "User already participated in this experiment";
425 return; 425 return;
426 } 426 }
427 } 427 }
428 // Check browser usage inactivity by the age of the last-write time of the 428 // Check browser usage inactivity by the age of the last-write time of the
429 // most recently-used chrome user data directory. 429 // most recently-used chrome user data directory.
430 std::vector<base::FilePath> user_data_dirs;
431 BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution( 430 BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution(
432 BrowserDistribution::CHROME_BROWSER); 431 BrowserDistribution::CHROME_BROWSER);
433 GetChromeUserDataPaths(dist, &user_data_dirs); 432 base::FilePath user_data_dir(GetChromeUserDataPath(dist));
434 int dir_age_hours = -1;
435 for (size_t i = 0; i < user_data_dirs.size(); ++i) {
436 int this_age = GetDirectoryWriteAgeInHours(
437 user_data_dirs[i].value().c_str());
438 if (this_age >= 0 && (dir_age_hours < 0 || this_age < dir_age_hours))
439 dir_age_hours = this_age;
440 }
441 433
442 const bool experiment_enabled = false; 434 const bool experiment_enabled = false;
443 const int kThirtyDays = 30 * 24; 435 const int kThirtyDays = 30 * 24;
444 436
437 int dir_age_hours = GetDirectoryWriteAgeInHours(
438 user_data_dir.value().c_str());
445 if (!experiment_enabled) { 439 if (!experiment_enabled) {
446 VLOG(1) << "Toast experiment is disabled."; 440 VLOG(1) << "Toast experiment is disabled.";
447 return; 441 return;
448 } else if (dir_age_hours < 0) { 442 } else if (dir_age_hours < 0) {
449 // This means that we failed to find the user data dir. The most likely 443 // This means that we failed to find the user data dir. The most likely
450 // cause is that this user has not ever used chrome at all which can 444 // cause is that this user has not ever used chrome at all which can
451 // happen in a system-level install. 445 // happen in a system-level install.
452 SetClient(base_group + kToastUDDirFailure, true); 446 SetClient(base_group + kToastUDDirFailure, true);
453 return; 447 return;
454 } else if (dir_age_hours < kThirtyDays) { 448 } else if (dir_age_hours < kThirtyDays) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 // running. 523 // running.
530 bool system_level_toast = CommandLine::ForCurrentProcess()->HasSwitch( 524 bool system_level_toast = CommandLine::ForCurrentProcess()->HasSwitch(
531 switches::kSystemLevelToast); 525 switches::kSystemLevelToast);
532 526
533 CommandLine cmd(InstallUtil::GetChromeUninstallCmd( 527 CommandLine cmd(InstallUtil::GetChromeUninstallCmd(
534 system_level_toast, product.distribution()->GetType())); 528 system_level_toast, product.distribution()->GetType()));
535 base::LaunchProcess(cmd, base::LaunchOptions(), NULL); 529 base::LaunchProcess(cmd, base::LaunchOptions(), NULL);
536 } 530 }
537 531
538 } // namespace installer 532 } // namespace installer
OLDNEW
« chrome/installer/setup/uninstall.cc ('K') | « chrome/installer/util/product_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698