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

Unified Diff: chrome/browser/chromeos/status/network_menu_button.cc

Issue 8557005: Rebase the MessageBubble on the new views bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase on updated bubble move codereview.chromium.org/8650001. Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698