OLD | NEW |
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" |
| 8 #include "ash/shell_window_ids.h" |
7 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/chromeos/cros/cros_library.h" | 11 #include "chrome/browser/chromeos/cros/cros_library.h" |
10 #include "chrome/browser/chromeos/cros/network_library.h" | 12 #include "chrome/browser/chromeos/cros/network_library.h" |
11 #include "chrome/browser/chromeos/login/helper.h" | 13 #include "chrome/browser/chromeos/login/helper.h" |
12 #include "chrome/browser/chromeos/login/message_bubble.h" | 14 #include "chrome/browser/chromeos/login/message_bubble.h" |
13 #include "chrome/browser/chromeos/login/user_manager.h" | 15 #include "chrome/browser/chromeos/login/user_manager.h" |
14 #include "chrome/browser/chromeos/mobile_config.h" | 16 #include "chrome/browser/chromeos/mobile_config.h" |
15 #include "chrome/browser/prefs/pref_service.h" | 17 #include "chrome/browser/prefs/pref_service.h" |
16 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 links.push_back(l10n_util::GetStringUTF16(link_message_id)); | 201 links.push_back(l10n_util::GetStringUTF16(link_message_id)); |
200 if (!deal_info_url_.empty()) | 202 if (!deal_info_url_.empty()) |
201 links.push_back(l10n_util::GetStringUTF16(IDS_LEARN_MORE)); | 203 links.push_back(l10n_util::GetStringUTF16(IDS_LEARN_MORE)); |
202 mobile_data_bubble_ = new MessageBubble( | 204 mobile_data_bubble_ = new MessageBubble( |
203 host, | 205 host, |
204 views::BubbleBorder::TOP_RIGHT, | 206 views::BubbleBorder::TOP_RIGHT, |
205 ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_NOTIFICATION_3G), | 207 ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_NOTIFICATION_3G), |
206 message, | 208 message, |
207 links); | 209 links); |
208 mobile_data_bubble_->set_link_listener(listener); | 210 mobile_data_bubble_->set_link_listener(listener); |
209 browser::CreateViewsBubbleAboveLockScreen(mobile_data_bubble_); | 211 mobile_data_bubble_->set_parent_window( |
| 212 ash::Shell::GetInstance()->GetContainer( |
| 213 ash::internal::kShellWindowId_SettingBubbleContainer)); |
| 214 views::BubbleDelegateView::CreateBubble(mobile_data_bubble_); |
210 mobile_data_bubble_->Show(); | 215 mobile_data_bubble_->Show(); |
211 mobile_data_bubble_->GetWidget()->AddObserver(this); | 216 mobile_data_bubble_->GetWidget()->AddObserver(this); |
212 | 217 |
213 check_for_promo_ = false; | 218 check_for_promo_ = false; |
214 SetShow3gPromoNotification(false); | 219 SetShow3gPromoNotification(false); |
215 if (carrier_deal_promo_pref != kNotificationCountPrefDefault) | 220 if (carrier_deal_promo_pref != kNotificationCountPrefDefault) |
216 SetCarrierDealPromoShown(carrier_deal_promo_pref + 1); | 221 SetCarrierDealPromoShown(carrier_deal_promo_pref + 1); |
217 } | 222 } |
218 } | 223 } |
219 | 224 |
220 void DataPromoNotification::CloseNotification() { | 225 void DataPromoNotification::CloseNotification() { |
221 if (mobile_data_bubble_) | 226 if (mobile_data_bubble_) |
222 mobile_data_bubble_->GetWidget()->Close(); | 227 mobile_data_bubble_->GetWidget()->Close(); |
223 } | 228 } |
224 | 229 |
225 void DataPromoNotification::OnWidgetClosing(views::Widget* widget) { | 230 void DataPromoNotification::OnWidgetClosing(views::Widget* widget) { |
226 if (!mobile_data_bubble_ || mobile_data_bubble_->GetWidget() != widget) | 231 if (!mobile_data_bubble_ || mobile_data_bubble_->GetWidget() != widget) |
227 return; | 232 return; |
228 | 233 |
229 mobile_data_bubble_ = NULL; | 234 mobile_data_bubble_ = NULL; |
230 deal_info_url_.clear(); | 235 deal_info_url_.clear(); |
231 deal_topup_url_.clear(); | 236 deal_topup_url_.clear(); |
232 } | 237 } |
233 | 238 |
234 } // namespace chromeos | 239 } // namespace chromeos |
OLD | NEW |