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

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

Issue 10056001: chromeos: Remove old status-area related code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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 "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/chromeos/cros/cros_library.h" 9 #include "chrome/browser/chromeos/cros/cros_library.h"
10 #include "chrome/browser/chromeos/cros/network_library.h" 10 #include "chrome/browser/chromeos/cros/network_library.h"
11 #include "chrome/browser/chromeos/login/helper.h" 11 #include "chrome/browser/chromeos/login/helper.h"
12 #include "chrome/browser/chromeos/login/message_bubble.h" 12 #include "chrome/browser/chromeos/login/message_bubble.h"
13 #include "chrome/browser/chromeos/login/user_manager.h" 13 #include "chrome/browser/chromeos/login/user_manager.h"
14 #include "chrome/browser/chromeos/mobile_config.h" 14 #include "chrome/browser/chromeos/mobile_config.h"
15 #include "chrome/browser/chromeos/status/status_area_view_chromeos.h"
16 #include "chrome/browser/prefs/pref_service.h" 15 #include "chrome/browser/prefs/pref_service.h"
17 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/profiles/profile_manager.h" 17 #include "chrome/browser/profiles/profile_manager.h"
19 #include "chrome/browser/ui/browser.h" 18 #include "chrome/browser/ui/browser.h"
20 #include "chrome/browser/ui/browser_list.h" 19 #include "chrome/browser/ui/browser_list.h"
21 #include "chrome/browser/ui/views/window.h" 20 #include "chrome/browser/ui/views/window.h"
22 #include "chrome/common/pref_names.h" 21 #include "chrome/common/pref_names.h"
23 #include "grit/generated_resources.h" 22 #include "grit/generated_resources.h"
24 #include "grit/theme_resources.h" 23 #include "grit/theme_resources.h"
25 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 : mobile_data_bubble_(NULL), 118 : mobile_data_bubble_(NULL),
120 check_for_promo_(true), 119 check_for_promo_(true),
121 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { 120 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {
122 } 121 }
123 122
124 DataPromoNotification::~DataPromoNotification() { 123 DataPromoNotification::~DataPromoNotification() {
125 if (mobile_data_bubble_) 124 if (mobile_data_bubble_)
126 mobile_data_bubble_->GetWidget()->Close(); 125 mobile_data_bubble_->GetWidget()->Close();
127 } 126 }
128 127
128 void DataPromoNotification::RegisterPrefs(PrefService* local_state) {
129 // Carrier deal notification shown count defaults to 0.
130 local_state->RegisterIntegerPref(prefs::kCarrierDealPromoShown, 0);
131 }
132
129 void DataPromoNotification::ShowOptionalMobileDataPromoNotification( 133 void DataPromoNotification::ShowOptionalMobileDataPromoNotification(
130 NetworkLibrary* cros, 134 NetworkLibrary* cros,
131 views::View* host, 135 views::View* host,
132 MessageBubbleLinkListener* listener) { 136 MessageBubbleLinkListener* listener) {
133 // Display one-time notification for non-Guest users on first use 137 // Display one-time notification for non-Guest users on first use
134 // of Mobile Data connection or if there's a carrier deal defined 138 // of Mobile Data connection or if there's a carrier deal defined
135 // show that even if user has already seen generic promo. 139 // show that even if user has already seen generic promo.
136 if (StatusAreaViewChromeos::IsBrowserMode() && 140 if (UserManager::Get()->IsUserLoggedIn() &&
137 !UserManager::Get()->IsLoggedInAsGuest() && 141 !UserManager::Get()->IsLoggedInAsGuest() &&
138 check_for_promo_ && 142 check_for_promo_ &&
139 cros->cellular_connected() && !cros->ethernet_connected() && 143 cros->cellular_connected() && !cros->ethernet_connected() &&
140 !cros->wifi_connected()) { 144 !cros->wifi_connected()) {
141 std::string deal_text; 145 std::string deal_text;
142 int carrier_deal_promo_pref = kNotificationCountPrefDefault; 146 int carrier_deal_promo_pref = kNotificationCountPrefDefault;
143 const MobileConfig::CarrierDeal* deal = NULL; 147 const MobileConfig::CarrierDeal* deal = NULL;
144 const MobileConfig::Carrier* carrier = GetCarrier(cros); 148 const MobileConfig::Carrier* carrier = GetCarrier(cros);
145 if (carrier) 149 if (carrier)
146 deal = GetCarrierDeal(carrier); 150 deal = GetCarrierDeal(carrier);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 void DataPromoNotification::OnWidgetClosing(views::Widget* widget) { 225 void DataPromoNotification::OnWidgetClosing(views::Widget* widget) {
222 if (!mobile_data_bubble_ || mobile_data_bubble_->GetWidget() != widget) 226 if (!mobile_data_bubble_ || mobile_data_bubble_->GetWidget() != widget)
223 return; 227 return;
224 228
225 mobile_data_bubble_ = NULL; 229 mobile_data_bubble_ = NULL;
226 deal_info_url_.clear(); 230 deal_info_url_.clear();
227 deal_topup_url_.clear(); 231 deal_topup_url_.clear();
228 } 232 }
229 233
230 } // namespace chromeos 234 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/status/data_promo_notification.h ('k') | chrome/browser/chromeos/status/input_method_menu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698