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

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

Issue 13495003: Add LoginState class to src/chromeos/login (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Restore LOGGED_IN_KIOSK_APP Created 7 years, 8 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/prefs/pref_registry_simple.h" 12 #include "base/prefs/pref_registry_simple.h"
13 #include "base/prefs/pref_service.h" 13 #include "base/prefs/pref_service.h"
14 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
15 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/chromeos/cros/cros_library.h" 16 #include "chrome/browser/chromeos/cros/cros_library.h"
17 #include "chrome/browser/chromeos/cros/network_library.h" 17 #include "chrome/browser/chromeos/cros/network_library.h"
18 #include "chrome/browser/chromeos/login/helper.h" 18 #include "chrome/browser/chromeos/login/helper.h"
19 #include "chrome/browser/chromeos/login/user_manager.h"
20 #include "chrome/browser/chromeos/mobile_config.h" 19 #include "chrome/browser/chromeos/mobile_config.h"
21 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/browser/profiles/profile_manager.h" 21 #include "chrome/browser/profiles/profile_manager.h"
23 #include "chrome/browser/ui/browser.h" 22 #include "chrome/browser/ui/browser.h"
24 #include "chrome/browser/ui/browser_list.h" 23 #include "chrome/browser/ui/browser_list.h"
25 #include "chrome/common/pref_names.h" 24 #include "chrome/common/pref_names.h"
25 #include "chromeos/login/login_state.h"
26 #include "grit/generated_resources.h" 26 #include "grit/generated_resources.h"
27 #include "grit/theme_resources.h" 27 #include "grit/theme_resources.h"
28 #include "ui/base/l10n/l10n_util.h" 28 #include "ui/base/l10n/l10n_util.h"
29 #include "ui/base/resource/resource_bundle.h" 29 #include "ui/base/resource/resource_bundle.h"
30 #include "ui/views/view.h" 30 #include "ui/views/view.h"
31 #include "ui/views/widget/widget.h" 31 #include "ui/views/widget/widget.h"
32 32
33 namespace { 33 namespace {
34 34
35 // Time in milliseconds to delay showing of promo 35 // Time in milliseconds to delay showing of promo
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 registry->RegisterIntegerPref(prefs::kCarrierDealPromoShown, 0); 133 registry->RegisterIntegerPref(prefs::kCarrierDealPromoShown, 0);
134 } 134 }
135 135
136 void DataPromoNotification::ShowOptionalMobileDataPromoNotification( 136 void DataPromoNotification::ShowOptionalMobileDataPromoNotification(
137 NetworkLibrary* cros, 137 NetworkLibrary* cros,
138 views::View* host, 138 views::View* host,
139 ash::NetworkTrayDelegate* listener) { 139 ash::NetworkTrayDelegate* listener) {
140 // Display one-time notification for non-Guest users on first use 140 // Display one-time notification for non-Guest users on first use
141 // 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
142 // show that even if user has already seen generic promo. 142 // show that even if user has already seen generic promo.
143 if (UserManager::Get()->IsUserLoggedIn() && 143 if (LoginState::Get()->IsUserLoggedIn() &&
144 !UserManager::Get()->IsLoggedInAsGuest() && 144 LoginState::Get()->GetLoginState() != LoginState::LOGGED_IN_GUEST &&
xiyuan 2013/04/04 21:24:54 Out of curiosity and out of the scope of the CL. S
stevenjb 2013/04/04 21:35:47 Good point, I think it can/should be safely fixed
145 check_for_promo_ && 145 check_for_promo_ &&
146 cros->cellular_connected() && !cros->ethernet_connected() && 146 cros->cellular_connected() && !cros->ethernet_connected() &&
147 !cros->wifi_connected() && !cros->wimax_connected()) { 147 !cros->wifi_connected() && !cros->wimax_connected()) {
148 std::string deal_text; 148 std::string deal_text;
149 int carrier_deal_promo_pref = kNotificationCountPrefDefault; 149 int carrier_deal_promo_pref = kNotificationCountPrefDefault;
150 const MobileConfig::CarrierDeal* deal = NULL; 150 const MobileConfig::CarrierDeal* deal = NULL;
151 const MobileConfig::Carrier* carrier = GetCarrier(cros); 151 const MobileConfig::Carrier* carrier = GetCarrier(cros);
152 if (carrier) 152 if (carrier)
153 deal = GetCarrierDeal(carrier); 153 deal = GetCarrierDeal(carrier);
154 deal_info_url_.clear(); 154 deal_info_url_.clear();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 SetCarrierDealPromoShown(carrier_deal_promo_pref + 1); 201 SetCarrierDealPromoShown(carrier_deal_promo_pref + 1);
202 } 202 }
203 } 203 }
204 204
205 void DataPromoNotification::CloseNotification() { 205 void DataPromoNotification::CloseNotification() {
206 ash::Shell::GetInstance()->system_tray_notifier()->NotifyClearNetworkMessage( 206 ash::Shell::GetInstance()->system_tray_notifier()->NotifyClearNetworkMessage(
207 ash::NetworkObserver::MESSAGE_DATA_PROMO); 207 ash::NetworkObserver::MESSAGE_DATA_PROMO);
208 } 208 }
209 209
210 } // namespace chromeos 210 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698