[cros] Move carrier deal shown property to LocalState.

BUG=chromium-os:15631
TEST=Manual.

Review URL: http://codereview.chromium.org/7019039

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86413 0039d316-1c4b-4281-b951-d872f2087c98
parent 7b7fc636
...@@ -183,11 +183,6 @@ void Preferences::RegisterUserPrefs(PrefService* prefs) { ...@@ -183,11 +183,6 @@ void Preferences::RegisterUserPrefs(PrefService* prefs) {
true, true,
PrefService::UNSYNCABLE_PREF); PrefService::UNSYNCABLE_PREF);
// Carrier deal notification shown count defaults to 0.
prefs->RegisterIntegerPref(prefs::kCarrierDealPromoShown,
0,
PrefService::UNSYNCABLE_PREF);
// The map of timestamps of the last used file browser handlers. // The map of timestamps of the last used file browser handlers.
prefs->RegisterDictionaryPref(prefs::kLastUsedFileBrowserHandlers, prefs->RegisterDictionaryPref(prefs::kLastUsedFileBrowserHandlers,
PrefService::UNSYNCABLE_PREF); PrefService::UNSYNCABLE_PREF);
......
...@@ -48,13 +48,8 @@ bool GetBooleanPref(const char* pref_name) { ...@@ -48,13 +48,8 @@ bool GetBooleanPref(const char* pref_name) {
return prefs->GetBoolean(pref_name); return prefs->GetBoolean(pref_name);
} }
int GetIntegerPref(const char* pref_name) { int GetIntegerLocalPref(const char* pref_name) {
Browser* browser = BrowserList::GetLastActive(); PrefService* prefs = g_browser_process->local_state();
// Default to "safe" value.
if (!browser || !browser->profile())
return kNotificationCountPrefDefault;
PrefService* prefs = browser->profile()->GetPrefs();
return prefs->GetInteger(pref_name); return prefs->GetInteger(pref_name);
} }
...@@ -67,12 +62,8 @@ void SetBooleanPref(const char* pref_name, bool value) { ...@@ -67,12 +62,8 @@ void SetBooleanPref(const char* pref_name, bool value) {
prefs->SetBoolean(pref_name, value); prefs->SetBoolean(pref_name, value);
} }
void SetIntegerPref(const char* pref_name, int value) { void SetIntegerLocalPref(const char* pref_name, int value) {
Browser* browser = BrowserList::GetLastActive(); PrefService* prefs = g_browser_process->local_state();
if (!browser || !browser->profile())
return;
PrefService* prefs = browser->profile()->GetPrefs();
prefs->SetInteger(pref_name, value); prefs->SetInteger(pref_name, value);
} }
...@@ -85,15 +76,15 @@ bool ShouldShow3gPromoNotification() { ...@@ -85,15 +76,15 @@ bool ShouldShow3gPromoNotification() {
void SetShow3gPromoNotification(bool value) { void SetShow3gPromoNotification(bool value) {
SetBooleanPref(prefs::kShow3gPromoNotification, value); SetBooleanPref(prefs::kShow3gPromoNotification, value);
} }
// Returns prefs::kCarrierDealPromoShown which is number of times // Returns prefs::kCarrierDealPromoShown which is number of times
// carrier deal notification has been shown to user or -1 // carrier deal notification has been shown to users on this machine.
// if there's no active browser.
int GetCarrierDealPromoShown() { int GetCarrierDealPromoShown() {
return GetIntegerPref(prefs::kCarrierDealPromoShown); return GetIntegerLocalPref(prefs::kCarrierDealPromoShown);
} }
void SetCarrierDealPromoShown(int value) { void SetCarrierDealPromoShown(int value) {
SetIntegerPref(prefs::kCarrierDealPromoShown, value); SetIntegerLocalPref(prefs::kCarrierDealPromoShown, value);
} }
} // namespace } // namespace
...@@ -140,6 +131,12 @@ NetworkMenuButton::~NetworkMenuButton() { ...@@ -140,6 +131,12 @@ NetworkMenuButton::~NetworkMenuButton() {
mobile_data_bubble_->Close(); mobile_data_bubble_->Close();
} }
// static
void NetworkMenuButton::RegisterPrefs(PrefService* local_state) {
// Carrier deal notification shown count defaults to 0.
local_state->RegisterIntegerPref(prefs::kCarrierDealPromoShown, 0);
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// NetworkMenuButton, ui::AnimationDelegate implementation: // NetworkMenuButton, ui::AnimationDelegate implementation:
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#include "chrome/browser/chromeos/status/status_area_button.h" #include "chrome/browser/chromeos/status/status_area_button.h"
#include "ui/base/animation/throb_animation.h" #include "ui/base/animation/throb_animation.h"
class PrefService;
namespace gfx { namespace gfx {
class Canvas; class Canvas;
} }
...@@ -60,6 +62,8 @@ class NetworkMenuButton : public StatusAreaButton, ...@@ -60,6 +62,8 @@ class NetworkMenuButton : public StatusAreaButton,
explicit NetworkMenuButton(StatusAreaHost* host); explicit NetworkMenuButton(StatusAreaHost* host);
virtual ~NetworkMenuButton(); virtual ~NetworkMenuButton();
static void RegisterPrefs(PrefService* local_state);
// ui::AnimationDelegate implementation. // ui::AnimationDelegate implementation.
virtual void AnimationProgressed(const ui::Animation* animation); virtual void AnimationProgressed(const ui::Animation* animation);
......
...@@ -77,6 +77,7 @@ ...@@ -77,6 +77,7 @@
#include "chrome/browser/chromeos/login/wizard_controller.h" #include "chrome/browser/chromeos/login/wizard_controller.h"
#include "chrome/browser/chromeos/preferences.h" #include "chrome/browser/chromeos/preferences.h"
#include "chrome/browser/chromeos/status/input_method_menu.h" #include "chrome/browser/chromeos/status/input_method_menu.h"
#include "chrome/browser/chromeos/status/network_menu_button.h"
#include "chrome/browser/chromeos/user_cros_settings_provider.h" #include "chrome/browser/chromeos/user_cros_settings_provider.h"
#endif #endif
...@@ -118,6 +119,7 @@ void RegisterLocalState(PrefService* local_state) { ...@@ -118,6 +119,7 @@ void RegisterLocalState(PrefService* local_state) {
chromeos::InputMethodMenu::RegisterPrefs(local_state); chromeos::InputMethodMenu::RegisterPrefs(local_state);
chromeos::ServicesCustomizationDocument::RegisterPrefs(local_state); chromeos::ServicesCustomizationDocument::RegisterPrefs(local_state);
chromeos::SignedSettingsTempStorage::RegisterPrefs(local_state); chromeos::SignedSettingsTempStorage::RegisterPrefs(local_state);
chromeos::NetworkMenuButton::RegisterPrefs(local_state);
#endif #endif
} }
......
...@@ -482,11 +482,6 @@ const char kShowPlanNotifications[] = ...@@ -482,11 +482,6 @@ const char kShowPlanNotifications[] =
const char kShow3gPromoNotification[] = const char kShow3gPromoNotification[] =
"settings.internet.mobile.show_3g_promo_notification"; "settings.internet.mobile.show_3g_promo_notification";
// An integer pref which shows number of times carrier deal promo
// notification has been shown to user.
const char kCarrierDealPromoShown[] =
"settings.internet.mobile.carrier_deal_promo_shown";
// Map of timestamps of the last used file browser tasks. // Map of timestamps of the last used file browser tasks.
const char kLastUsedFileBrowserHandlers[] = const char kLastUsedFileBrowserHandlers[] =
"filebrowser.handler.lastused"; "filebrowser.handler.lastused";
...@@ -1274,6 +1269,11 @@ const char kSignedSettingsTempStorage[] = "signed_settings_temp_storage"; ...@@ -1274,6 +1269,11 @@ const char kSignedSettingsTempStorage[] = "signed_settings_temp_storage";
// The hardware keyboard layout of the device. This should look like // The hardware keyboard layout of the device. This should look like
// "xkb:us::eng". // "xkb:us::eng".
const char kHardwareKeyboardLayout[] = "intl.hardware_keyboard"; const char kHardwareKeyboardLayout[] = "intl.hardware_keyboard";
// An integer pref which shows number of times carrier deal promo
// notification has been shown to user.
const char kCarrierDealPromoShown[] =
"settings.internet.mobile.carrier_deal_promo_shown";
#endif #endif
// Whether there is a Flash version installed that supports clearing LSO data. // Whether there is a Flash version installed that supports clearing LSO data.
......
...@@ -166,7 +166,6 @@ extern const char kLabsMediaplayerEnabled[]; ...@@ -166,7 +166,6 @@ extern const char kLabsMediaplayerEnabled[];
extern const char kEnableScreenLock[]; extern const char kEnableScreenLock[];
extern const char kShowPlanNotifications[]; extern const char kShowPlanNotifications[];
extern const char kShow3gPromoNotification[]; extern const char kShow3gPromoNotification[];
extern const char kCarrierDealPromoShown[];
extern const char kLastUsedFileBrowserHandlers[]; extern const char kLastUsedFileBrowserHandlers[];
#endif #endif
extern const char kIpcDisabledMessages[]; extern const char kIpcDisabledMessages[];
...@@ -481,6 +480,7 @@ extern const char kManagedPopupsBlockedForUrls[]; ...@@ -481,6 +480,7 @@ extern const char kManagedPopupsBlockedForUrls[];
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
extern const char kSignedSettingsTempStorage[]; extern const char kSignedSettingsTempStorage[];
extern const char kHardwareKeyboardLayout[]; extern const char kHardwareKeyboardLayout[];
extern const char kCarrierDealPromoShown[];
#endif #endif
extern const char kClearPluginLSODataEnabled[]; extern const char kClearPluginLSODataEnabled[];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment