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

Side by Side Diff: chrome/browser/chromeos/status/data_promo_notification.cc

Issue 11741003: Remove PrefServiceSimple, replacing it with PrefService and PrefRegistrySimple. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix double registration in Chrome Frame test. Created 7 years, 10 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser/chromeos/status/data_promo_notification.h" 5 #include "chrome/browser/chromeos/status/data_promo_notification.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_window_ids.h" 8 #include "ash/shell_window_ids.h"
9 #include "ash/system/chromeos/network/network_observer.h" 9 #include "ash/system/chromeos/network/network_observer.h"
10 #include "ash/system/tray/system_tray.h" 10 #include "ash/system/tray/system_tray.h"
11 #include "ash/system/tray/system_tray_notifier.h" 11 #include "ash/system/tray/system_tray_notifier.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/chromeos/cros/cros_library.h" 14 #include "chrome/browser/chromeos/cros/cros_library.h"
15 #include "chrome/browser/chromeos/cros/network_library.h" 15 #include "chrome/browser/chromeos/cros/network_library.h"
16 #include "chrome/browser/chromeos/login/helper.h" 16 #include "chrome/browser/chromeos/login/helper.h"
17 #include "chrome/browser/chromeos/login/user_manager.h" 17 #include "chrome/browser/chromeos/login/user_manager.h"
18 #include "chrome/browser/chromeos/mobile_config.h" 18 #include "chrome/browser/chromeos/mobile_config.h"
19 #include "chrome/browser/prefs/pref_registry_simple.h"
19 #include "chrome/browser/prefs/pref_service.h" 20 #include "chrome/browser/prefs/pref_service.h"
20 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/profiles/profile_manager.h" 22 #include "chrome/browser/profiles/profile_manager.h"
22 #include "chrome/browser/ui/browser.h" 23 #include "chrome/browser/ui/browser.h"
23 #include "chrome/browser/ui/browser_list.h" 24 #include "chrome/browser/ui/browser_list.h"
24 #include "chrome/common/pref_names.h" 25 #include "chrome/common/pref_names.h"
25 #include "grit/generated_resources.h" 26 #include "grit/generated_resources.h"
26 #include "grit/theme_resources.h" 27 #include "grit/theme_resources.h"
27 #include "ui/base/l10n/l10n_util.h" 28 #include "ui/base/l10n/l10n_util.h"
28 #include "ui/base/resource/resource_bundle.h" 29 #include "ui/base/resource/resource_bundle.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 121
121 DataPromoNotification::DataPromoNotification() 122 DataPromoNotification::DataPromoNotification()
122 : check_for_promo_(true), 123 : check_for_promo_(true),
123 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { 124 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {
124 } 125 }
125 126
126 DataPromoNotification::~DataPromoNotification() { 127 DataPromoNotification::~DataPromoNotification() {
127 CloseNotification(); 128 CloseNotification();
128 } 129 }
129 130
130 void DataPromoNotification::RegisterPrefs(PrefServiceSimple* local_state) { 131 void DataPromoNotification::RegisterPrefs(PrefRegistrySimple* registry) {
131 // Carrier deal notification shown count defaults to 0. 132 // Carrier deal notification shown count defaults to 0.
132 local_state->RegisterIntegerPref(prefs::kCarrierDealPromoShown, 0); 133 registry->RegisterIntegerPref(prefs::kCarrierDealPromoShown, 0);
133 } 134 }
134 135
135 void DataPromoNotification::ShowOptionalMobileDataPromoNotification( 136 void DataPromoNotification::ShowOptionalMobileDataPromoNotification(
136 NetworkLibrary* cros, 137 NetworkLibrary* cros,
137 views::View* host, 138 views::View* host,
138 ash::NetworkTrayDelegate* listener) { 139 ash::NetworkTrayDelegate* listener) {
139 // Display one-time notification for non-Guest users on first use 140 // Display one-time notification for non-Guest users on first use
140 // of Mobile Data connection or if there's a carrier deal defined 141 // of Mobile Data connection or if there's a carrier deal defined
141 // show that even if user has already seen generic promo. 142 // show that even if user has already seen generic promo.
142 if (UserManager::Get()->IsUserLoggedIn() && 143 if (UserManager::Get()->IsUserLoggedIn() &&
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 SetCarrierDealPromoShown(carrier_deal_promo_pref + 1); 201 SetCarrierDealPromoShown(carrier_deal_promo_pref + 1);
201 } 202 }
202 } 203 }
203 204
204 void DataPromoNotification::CloseNotification() { 205 void DataPromoNotification::CloseNotification() {
205 ash::Shell::GetInstance()->system_tray_notifier()->NotifyClearNetworkMessage( 206 ash::Shell::GetInstance()->system_tray_notifier()->NotifyClearNetworkMessage(
206 ash::NetworkObserver::MESSAGE_DATA_PROMO); 207 ash::NetworkObserver::MESSAGE_DATA_PROMO);
207 } 208 }
208 209
209 } // namespace chromeos 210 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698