Index: chrome/browser/google_update_settings_mac.mm |
diff --git a/chrome/browser/google_update_settings_mac.mm b/chrome/browser/google_update_settings_mac.mm |
new file mode 100644 |
index 0000000000000000000000000000000000000000..85004d3e41d085046e503f7f3bf2a2cf555b3cb0 |
--- /dev/null |
+++ b/chrome/browser/google_update_settings_mac.mm |
@@ -0,0 +1,87 @@ |
+// 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. |
+ |
+#include <Foundation/Foundation.h> |
+ |
+#include "chrome/installer/util/google_update_settings.h" |
+ |
+#include "base/basictypes.h" |
+#include "base/logging.h" |
+#include "base/sys_string_conversions.h" |
+#include "chrome/installer/util/google_update_constants.h" |
+ |
+namespace google_update { |
+ |
+// This is copied from chrome/installer/util/google_update_constants.cc |
+// Reasons duplication acceptable: |
+// 1. At the time of this writing, this code is a one-off for the dev release. |
+// 2. The value of this constant is unlikely to change and even if it does |
+// that negates the point of reusing it in the Mac version. |
+// 3. To make x-platform usage fo the constants in google_update_constants.cc |
+// we probably want to split them up into windows-only and x-platform strings. |
+const wchar_t kRegUsageStatsField[] = L"usagestats"; |
+ |
+// Declared in a public namespace for testing purposes. |
John Grabowski
2009/05/18 21:49:50
Extra comments:
// If pref not set, assume yes
|
+bool GetCollectStatsConsentFromDictionary(NSDictionary *dict) { |
John Grabowski
2009/05/18 21:49:50
NSDictionary * --> NSDictionary*
NSString * --> NS
|
+ NSString *collect_stats_key = base::SysWideToNSString( |
+ google_update::kRegUsageStatsField); |
+ NSNumber *val = [dict objectForKey:collect_stats_key]; |
+ |
+ if (val == nil || ![val respondsToSelector:@selector(boolValue)]) { |
pink (ping after 24hrs)
2009/05/18 21:21:09
nil check not needed.
|
+ return true; |
+ } |
+ |
+ return ([val boolValue] == YES); |
+} |
+ |
+} // namespace google_update |
+ |
+// static |
+bool GoogleUpdateSettings::GetCollectStatsConsent() { |
+ // TODO(mac): This value should be read from the Chrome prefs setting. |
+ // For Dev-relesae purposes, we read this value from the user's |
+ // defaults. This allows easy control of the setting from the terminal. |
+ // To turn stat reporting off, run the following command from the terminal: |
+ // $ defaults write com.google.Chrome usagestats -bool 'NO' |
+ NSUserDefaults *std_defaults = [NSUserDefaults standardUserDefaults]; |
+ return google_update::GetCollectStatsConsentFromDictionary( |
+ [std_defaults dictionaryRepresentation]); |
+} |
+ |
+// static |
+bool GoogleUpdateSettings::SetCollectStatsConsent(bool consented) { |
+ NOTIMPLEMENTED(); |
+ return false; |
+} |
+ |
+// static |
+bool GoogleUpdateSettings::GetBrowser(std::wstring* browser) { |
+ NOTIMPLEMENTED(); |
+ return false; |
+} |
+ |
+// static |
+bool GoogleUpdateSettings::GetLanguage(std::wstring* language) { |
+ NOTIMPLEMENTED(); |
+ return false; |
+} |
+ |
+// static |
+bool GoogleUpdateSettings::GetBrand(std::wstring* brand) { |
+ NOTIMPLEMENTED(); |
+ return false; |
+} |
+ |
+// static |
+bool GoogleUpdateSettings::GetReferral(std::wstring* referral) { |
+ NOTIMPLEMENTED(); |
+ return false; |
+} |
+ |
+// static |
+bool GoogleUpdateSettings::ClearReferral() { |
+ NOTIMPLEMENTED(); |
+ return false; |
+} |
+ |