diff options
author | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-25 20:47:58 +0000 |
---|---|---|
committer | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-25 20:47:58 +0000 |
commit | 8aaba6608dfe2f1e9faf15a1c72547a20f7435f3 (patch) | |
tree | b2aaf59c336253ce3d354831ddc55334503f9c12 /chrome/browser | |
parent | 4ccd3199c69cf97bbc11b334162eb5247f6a2306 (diff) | |
download | chromium_src-8aaba6608dfe2f1e9faf15a1c72547a20f7435f3.zip chromium_src-8aaba6608dfe2f1e9faf15a1c72547a20f7435f3.tar.gz chromium_src-8aaba6608dfe2f1e9faf15a1c72547a20f7435f3.tar.bz2 |
Remove old Mac First Run Migration code.
We've gone through 2 dev release cycles so most users should be upgraded by now,
removing code.
Review URL: http://codereview.chromium.org/244011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27240 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/first_run_mac.mm | 84 | ||||
-rw-r--r-- | chrome/browser/first_run_migration_mac_unittest.mm | 62 |
2 files changed, 0 insertions, 146 deletions
diff --git a/chrome/browser/first_run_mac.mm b/chrome/browser/first_run_mac.mm index 52e18a6..f46bf4f 100644 --- a/chrome/browser/first_run_mac.mm +++ b/chrome/browser/first_run_mac.mm @@ -15,83 +15,6 @@ #include "chrome/installer/util/google_update_constants.h" #include "chrome/installer/util/google_update_settings.h" -//------------------ Start Temporary Code --------------------- -// The Mac version used to store first run in the user defaults, this has -// now been moved to the profile directory like other platforms. -// These functions are here to use for migration, they should be removed -// in the near future once most people are upgraded. -// This should be removed after 2 dev release cycles following the checkin -// of this code, or by 15-Sept-2009. Whichever comes first. -namespace old_first_run_mac { - -const NSString *kOldUsageStatsPrefName = @"usagestats"; - -// returns true if the first run sentinel is present in the dictionary -// false if no sentinel is present. -// |usage_stats_enabled| - Where the usage stats previously enabled? -bool IsOldChromeFirstRunFromDictionary(NSDictionary *dict, - bool *usage_stats_enabled) { - *usage_stats_enabled = false; - - // Use presence of kOldUsageStatsPrefName key as an indicator of whether or - // not this is the first run. - NSNumber* val = [dict objectForKey:kOldUsageStatsPrefName]; - - if (val == nil) { - return false; - } - - if ([val respondsToSelector:@selector(boolValue)]) { - *usage_stats_enabled = [val boolValue] ? true : false; - } - - return true; -} - -bool IsOldChromeFirstRun(bool *usage_stats_enabled) { - NSUserDefaults* std_defaults = [NSUserDefaults standardUserDefaults]; - NSDictionary* defaults_dict = [std_defaults dictionaryRepresentation]; - - return IsOldChromeFirstRunFromDictionary(defaults_dict, usage_stats_enabled); -} - -// Remove the old first run key from the defaults dictionary. -void RemoveOldFirstRunDefaultsKey() { - NSUserDefaults* std_defaults = [NSUserDefaults standardUserDefaults]; - [std_defaults removeObjectForKey:kOldUsageStatsPrefName]; - [std_defaults synchronize]; -} - -// returns: -// true - If old first run sentinel found and migration was performed. -// false - no previous first run sentinel found. -bool MigrateOldFirstRun() { - bool usage_stats_enabled = false; - - if (!IsOldChromeFirstRun(&usage_stats_enabled)) - return false; - - FirstRun::CreateSentinel(); - GoogleUpdateSettings::SetCollectStatsConsent(usage_stats_enabled); - - // Migrate old first run data. -#if defined(GOOGLE_CHROME_BUILD) - // Breakpad is normally enabled very early in the startup process, - // however, on the first run it's off by default. If the user opts-in to - // stats, enable breakpad. - if (usage_stats_enabled) { - InitCrashReporter(); - InitCrashProcessInfo(); - } -#endif // GOOGLE_CHROME_BUILD - - RemoveOldFirstRunDefaultsKey(); - return true; -} - -} // namespace old_first_run_mac -//------------------ End Temporary Code --------------------- - // Class that handles conducting the first run operation. // FirstRunController deletes itself when the first run operation ends. class FirstRunController : public ImportObserver { @@ -156,13 +79,6 @@ bool FirstRunController::DoFirstRun(Profile* profile, // before this point. Then remove the need for that dialog here. DCHECK(!IsCrashReporterEnabled()); - //------------------ Start Temporary Code --------------------- - // Migrate old first run format. - if (old_first_run_mac::MigrateOldFirstRun()) { - return true; - } - //------------------ End Temporary Code --------------------- - scoped_nsobject<FirstRunDialogController> dialog( [[FirstRunDialogController alloc] init]); diff --git a/chrome/browser/first_run_migration_mac_unittest.mm b/chrome/browser/first_run_migration_mac_unittest.mm deleted file mode 100644 index 23955e2..0000000 --- a/chrome/browser/first_run_migration_mac_unittest.mm +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import <Foundation/Foundation.h> - -#include "base/basictypes.h" -#include "base/logging.h" -#include "base/sys_string_conversions.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "testing/platform_test.h" - -// This is a test for temporary code, see chrome/browser/first_run_mac.mm -// for details. - -namespace old_first_run_mac { - -bool IsOldChromeFirstRunFromDictionary(NSDictionary *dict, - bool *usage_stats_enabled); - -extern const NSString *kOldUsageStatsPrefName; -} // namespace google_update - - -class FirstRunMigrationTest : public PlatformTest { -}; - -TEST_F(FirstRunMigrationTest, MigrateOldFirstRunSettings) { - using old_first_run_mac::IsOldChromeFirstRunFromDictionary; - using old_first_run_mac::kOldUsageStatsPrefName; - - // Stats are off by default. - bool stats_on; - NSDictionary* empty_dict = [NSDictionary dictionary]; - EXPECT_FALSE(IsOldChromeFirstRunFromDictionary(empty_dict, &stats_on)); - EXPECT_FALSE(stats_on); - - // Stats reporting is ON. - NSNumber* stats_enabled = [NSNumber numberWithBool:YES]; - NSDictionary* enabled_dict = [NSDictionary - dictionaryWithObject:stats_enabled - forKey:kOldUsageStatsPrefName]; - EXPECT_TRUE(IsOldChromeFirstRunFromDictionary(enabled_dict, &stats_on)); - EXPECT_TRUE(stats_on); - - // Stats reporting is OFF. - stats_enabled = [NSNumber numberWithBool:NO]; - enabled_dict = [NSDictionary - dictionaryWithObject:stats_enabled - forKey:kOldUsageStatsPrefName]; - EXPECT_TRUE(IsOldChromeFirstRunFromDictionary(enabled_dict, &stats_on)); - EXPECT_FALSE(stats_on); - - - // If an object of the wrong type is present, we still consider this to - // be a first run, but stats reporting is disabled. - NSDictionary* wrong_type_dict = [NSDictionary - dictionaryWithObject:empty_dict - forKey:kOldUsageStatsPrefName]; - EXPECT_TRUE(IsOldChromeFirstRunFromDictionary(wrong_type_dict, &stats_on)); - EXPECT_FALSE(stats_on); -} |