Chromium Code Reviews| Index: chrome/browser/chromeos/status/network_menu_button.cc |
| diff --git a/chrome/browser/chromeos/status/network_menu_button.cc b/chrome/browser/chromeos/status/network_menu_button.cc |
| index 947fb638e1adb74322a63fed21ff4c0e731401df..aba3973c85bde582f19d581dc4427fbed70cb1a7 100644 |
| --- a/chrome/browser/chromeos/status/network_menu_button.cc |
| +++ b/chrome/browser/chromeos/status/network_menu_button.cc |
| @@ -48,13 +48,8 @@ bool GetBooleanPref(const char* pref_name) { |
| return prefs->GetBoolean(pref_name); |
| } |
| -int GetIntegerPref(const char* pref_name) { |
| - Browser* browser = BrowserList::GetLastActive(); |
| - // Default to "safe" value. |
| - if (!browser || !browser->profile()) |
| - return kNotificationCountPrefDefault; |
| - |
| - PrefService* prefs = browser->profile()->GetPrefs(); |
| +int GetIntegerLocalPref(const char* pref_name) { |
| + PrefService* prefs = g_browser_process->local_state(); |
| return prefs->GetInteger(pref_name); |
| } |
| @@ -67,12 +62,8 @@ void SetBooleanPref(const char* pref_name, bool value) { |
| prefs->SetBoolean(pref_name, value); |
| } |
| -void SetIntegerPref(const char* pref_name, int value) { |
| - Browser* browser = BrowserList::GetLastActive(); |
| - if (!browser || !browser->profile()) |
| - return; |
| - |
| - PrefService* prefs = browser->profile()->GetPrefs(); |
| +void SetIntegerLocalPref(const char* pref_name, int value) { |
| + PrefService* prefs = g_browser_process->local_state(); |
| prefs->SetInteger(pref_name, value); |
| } |
| @@ -86,14 +77,13 @@ void SetShow3gPromoNotification(bool value) { |
| SetBooleanPref(prefs::kShow3gPromoNotification, value); |
| } |
| // Returns prefs::kCarrierDealPromoShown which is number of times |
|
Dmitry Polukhin
2011/05/23 12:46:59
Please add empty line above the comment.
Nikita (slow)
2011/05/24 08:22:53
Done.
|
| -// carrier deal notification has been shown to user or -1 |
| -// if there's no active browser. |
| +// carrier deal notification has been shown to users on this machine. |
| int GetCarrierDealPromoShown() { |
| - return GetIntegerPref(prefs::kCarrierDealPromoShown); |
| + return GetIntegerLocalPref(prefs::kCarrierDealPromoShown); |
| } |
| void SetCarrierDealPromoShown(int value) { |
| - SetIntegerPref(prefs::kCarrierDealPromoShown, value); |
| + SetIntegerLocalPref(prefs::kCarrierDealPromoShown, value); |
| } |
| } // namespace |
| @@ -140,6 +130,12 @@ NetworkMenuButton::~NetworkMenuButton() { |
| 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: |