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 96bbcf4524b23cde619c99f2397dfe40033319c8..7d62498fadaec3177ce1e0e9611173e5ebe7ebf0 100644 |
--- a/chrome/browser/chromeos/status/network_menu_button.cc |
+++ b/chrome/browser/chromeos/status/network_menu_button.cc |
@@ -132,7 +132,7 @@ NetworkMenuButton::~NetworkMenuButton() { |
if (!cellular_device_path_.empty()) |
netlib->RemoveNetworkDeviceObserver(cellular_device_path_, this); |
if (mobile_data_bubble_) |
- mobile_data_bubble_->Close(); |
+ mobile_data_bubble_->GetWidget()->Close(); |
} |
// static |
@@ -241,21 +241,19 @@ void NetworkMenuButton::NetworkMenuIconChanged() { |
} |
//////////////////////////////////////////////////////////////////////////////// |
-// MessageBubbleDelegate implementation: |
+// views::Widget::Observer implementation: |
+ |
+void NetworkMenuButton::OnWidgetClosing(views::Widget* widget) { |
+ if (!mobile_data_bubble_ || mobile_data_bubble_->GetWidget() != widget) |
Nikita (slow)
2011/11/23 13:30:12
I've checked this patch on Chrome OS.
OnWidgetClos
msw
2011/11/29 00:11:07
Fixed (added the observer on bubble construction).
|
+ return; |
-void NetworkMenuButton::BubbleClosing(Bubble* bubble, bool closed_by_escape) { |
mobile_data_bubble_ = NULL; |
deal_info_url_.clear(); |
deal_topup_url_.clear(); |
} |
-bool NetworkMenuButton::CloseOnEscape() { |
- return true; |
-} |
- |
-bool NetworkMenuButton::FadeInOnShow() { |
- return false; |
-} |
+//////////////////////////////////////////////////////////////////////////////// |
+// MessageBubbleLinkListener implementation: |
void NetworkMenuButton::OnLinkActivated(size_t index) { |
// If we have deal info URL defined that means that there're |
@@ -263,7 +261,7 @@ void NetworkMenuButton::OnLinkActivated(size_t index) { |
// to navigate to second link. |
// mobile_data_bubble_ will be set to NULL in BubbleClosing callback. |
if (deal_info_url_.empty() && mobile_data_bubble_) |
- mobile_data_bubble_->Close(); |
+ mobile_data_bubble_->GetWidget()->Close(); |
std::string deal_url_to_open; |
if (index == 0) { |
@@ -412,13 +410,12 @@ void NetworkMenuButton::ShowOptionalMobileDataPromoNotification( |
} |
// Add deal text if it's defined. |
- std::wstring notification_text; |
- std::wstring default_text = |
- UTF16ToWide(l10n_util::GetStringUTF16(IDS_3G_NOTIFICATION_MESSAGE)); |
+ string16 notification_text; |
+ string16 default_text = |
+ l10n_util::GetStringUTF16(IDS_3G_NOTIFICATION_MESSAGE); |
if (!deal_text.empty()) { |
- notification_text = StringPrintf(L"%ls\n\n%ls", |
- UTF8ToWide(deal_text).c_str(), |
- default_text.c_str()); |
+ notification_text = |
+ UTF8ToUTF16(deal_text) + UTF8ToUTF16("\n\n") + default_text; |
} else { |
notification_text = default_text; |
} |
@@ -430,18 +427,18 @@ void NetworkMenuButton::ShowOptionalMobileDataPromoNotification( |
else |
link_message_id = IDS_STATUSBAR_NETWORK_VIEW_ACCOUNT; |
- std::vector<std::wstring> links; |
- links.push_back(UTF16ToWide(l10n_util::GetStringUTF16(link_message_id))); |
+ std::vector<string16> links; |
+ links.push_back(l10n_util::GetStringUTF16(link_message_id)); |
if (!deal_info_url_.empty()) |
- links.push_back(UTF16ToWide(l10n_util::GetStringUTF16(IDS_LEARN_MORE))); |
- mobile_data_bubble_ = MessageBubble::ShowWithLinks( |
- GetWidget(), |
- button_bounds, |
- views::BubbleBorder::TOP_RIGHT , |
+ links.push_back(l10n_util::GetStringUTF16(IDS_LEARN_MORE)); |
+ mobile_data_bubble_ = new MessageBubble( |
+ this, |
+ views::BubbleBorder::TOP_RIGHT, |
ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_NOTIFICATION_3G), |
notification_text, |
- links, |
- this); |
+ links); |
+ mobile_data_bubble_->set_link_listener(this); |
+ MessageBubble::ShowBubble(mobile_data_bubble_); |
check_for_promo_ = false; |
SetShow3gPromoNotification(false); |