summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chromeos/customization_document.cc32
-rw-r--r--chrome/browser/chromeos/customization_document.h24
-rw-r--r--chrome/browser/chromeos/customization_document_unittest.cc8
-rw-r--r--chrome/browser/chromeos/login/eula_view.cc3
-rw-r--r--chrome/browser/chromeos/login/eula_view.h2
-rw-r--r--chrome/browser/chromeos/login/message_bubble.cc56
-rw-r--r--chrome/browser/chromeos/login/message_bubble.h23
-rw-r--r--chrome/browser/chromeos/login/screen_locker.cc3
-rw-r--r--chrome/browser/chromeos/login/screen_locker.h2
-rw-r--r--chrome/browser/chromeos/login/views_login_display.cc3
-rw-r--r--chrome/browser/chromeos/login/views_login_display.h2
-rw-r--r--chrome/browser/chromeos/login/views_network_screen_actor.cc2
-rw-r--r--chrome/browser/chromeos/login/views_network_screen_actor.h2
-rw-r--r--chrome/browser/chromeos/status/network_menu.cc4
-rw-r--r--chrome/browser/chromeos/status/network_menu_button.cc54
-rw-r--r--chrome/browser/chromeos/status/network_menu_button.h9
-rw-r--r--chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc4
17 files changed, 165 insertions, 68 deletions
diff --git a/chrome/browser/chromeos/customization_document.cc b/chrome/browser/chromeos/customization_document.cc
index 73db372..8af62dc 100644
--- a/chrome/browser/chromeos/customization_document.cc
+++ b/chrome/browser/chromeos/customization_document.cc
@@ -47,6 +47,7 @@ const char kHardwareClass[] = "hardware_class";
// Carrier deals attributes.
const char kCarrierDealsAttr[] = "carrier_deals";
const char kDealLocaleAttr[] = "deal_locale";
+const char kInfoURLAttr[] = "info_url";
const char kTopUpURLAttr[] = "top_up_url";
const char kNotificationCountAttr[] = "notification_count";
const char kDealExpireDateAttr[] = "expire_date";
@@ -222,28 +223,33 @@ std::string StartupCustomizationDocument::GetEULAPage(
ServicesCustomizationDocument::CarrierDeal::CarrierDeal(
DictionaryValue* deal_dict)
- : notification_count(0),
- localized_strings(NULL) {
- deal_dict->GetString(kDealLocaleAttr, &deal_locale);
- deal_dict->GetString(kTopUpURLAttr, &top_up_url);
- deal_dict->GetInteger(kNotificationCountAttr, &notification_count);
+ : notification_count_(0),
+ localized_strings_(NULL) {
+ deal_dict->GetString(kDealLocaleAttr, &deal_locale_);
+ deal_dict->GetString(kInfoURLAttr, &info_url_);
+ deal_dict->GetString(kTopUpURLAttr, &top_up_url_);
+ deal_dict->GetInteger(kNotificationCountAttr, &notification_count_);
std::string date_string;
if (deal_dict->GetString(kDealExpireDateAttr, &date_string)) {
- if (!base::Time::FromString(ASCIIToWide(date_string).c_str(), &expire_date))
+ if (!base::Time::FromString(ASCIIToWide(date_string).c_str(),
+ &expire_date_))
LOG(ERROR) << "Error parsing deal_expire_date: " << date_string;
}
- deal_dict->GetDictionary(kLocalizedContentAttr, &localized_strings);
+ deal_dict->GetDictionary(kLocalizedContentAttr, &localized_strings_);
+}
+
+ServicesCustomizationDocument::CarrierDeal::~CarrierDeal() {
}
std::string ServicesCustomizationDocument::CarrierDeal::GetLocalizedString(
const std::string& locale, const std::string& id) const {
std::string result;
- if (localized_strings) {
+ if (localized_strings_) {
DictionaryValue* locale_dict = NULL;
- if (localized_strings->GetDictionary(locale, &locale_dict) &&
+ if (localized_strings_->GetDictionary(locale, &locale_dict) &&
locale_dict->GetString(id, &result)) {
return result;
- } else if (localized_strings->GetDictionary(kDefaultAttr, &locale_dict) &&
+ } else if (localized_strings_->GetDictionary(kDefaultAttr, &locale_dict) &&
locale_dict->GetString(id, &result)) {
return result;
}
@@ -372,12 +378,12 @@ ServicesCustomizationDocument::GetCarrierDeal(const std::string& carrier_id,
CarrierDeal* deal = iter->second;
if (check_restrictions) {
// Deal locale has to match initial_locale (= launch country).
- if (initial_locale_ != deal->deal_locale)
+ if (initial_locale_ != deal->deal_locale())
return NULL;
// Make sure that deal is still active,
// i.e. if deal expire date is defined, check it.
- if (!deal->expire_date.is_null() &&
- deal->expire_date <= base::Time::Now()) {
+ if (!deal->expire_date().is_null() &&
+ deal->expire_date() <= base::Time::Now()) {
return NULL;
}
}
diff --git a/chrome/browser/chromeos/customization_document.h b/chrome/browser/chromeos/customization_document.h
index 735c323..ea12c89b 100644
--- a/chrome/browser/chromeos/customization_document.h
+++ b/chrome/browser/chromeos/customization_document.h
@@ -107,8 +107,10 @@ class ServicesCustomizationDocument : public CustomizationDocument,
private URLFetcher::Delegate {
public:
// OEM specific carrier deal.
- struct CarrierDeal {
+ class CarrierDeal {
+ public:
explicit CarrierDeal(DictionaryValue* deal_dict);
+ ~CarrierDeal();
// Returns string with the specified |locale| and |id|.
// If there's no version for |locale|, default one is returned.
@@ -116,11 +118,21 @@ class ServicesCustomizationDocument : public CustomizationDocument,
std::string GetLocalizedString(const std::string& locale,
const std::string& id) const;
- std::string deal_locale;
- std::string top_up_url;
- int notification_count;
- base::Time expire_date;
- DictionaryValue* localized_strings;
+ const std::string& deal_locale() const { return deal_locale_; }
+ const std::string& info_url() const { return info_url_; }
+ const std::string& top_up_url() const { return top_up_url_; }
+ int notification_count() const { return notification_count_; }
+ base::Time expire_date() const { return expire_date_; }
+
+ private:
+ std::string deal_locale_;
+ std::string info_url_;
+ std::string top_up_url_;
+ int notification_count_;
+ base::Time expire_date_;
+ DictionaryValue* localized_strings_;
+
+ DISALLOW_COPY_AND_ASSIGN(CarrierDeal);
};
// Carrier ID (ex. "Verizon (us)") mapping to carrier deals.
diff --git a/chrome/browser/chromeos/customization_document_unittest.cc b/chrome/browser/chromeos/customization_document_unittest.cc
index 04d8d55..262e0f5 100644
--- a/chrome/browser/chromeos/customization_document_unittest.cc
+++ b/chrome/browser/chromeos/customization_document_unittest.cc
@@ -195,9 +195,9 @@ TEST(ServicesCustomizationDocumentTest, Basic) {
const ServicesCustomizationDocument::CarrierDeal* deal;
deal = customization.GetCarrierDeal("Carrier (country)", true);
EXPECT_TRUE(deal != NULL);
- EXPECT_EQ("en-US", deal->deal_locale);
- EXPECT_EQ("http://www.carrier.com/", deal->top_up_url);
- EXPECT_EQ(1, deal->notification_count);
+ EXPECT_EQ("en-US", deal->deal_locale());
+ EXPECT_EQ("http://www.carrier.com/", deal->top_up_url());
+ EXPECT_EQ(1, deal->notification_count());
EXPECT_EQ("3G connectivity : Carrier.",
deal->GetLocalizedString("en-US", "notification_text"));
EXPECT_EQ("default_text.",
@@ -205,7 +205,7 @@ TEST(ServicesCustomizationDocumentTest, Basic) {
base::Time reference_time;
base::Time::FromString(L"31/12/12 0:00", &reference_time);
- EXPECT_EQ(reference_time, deal->expire_date);
+ EXPECT_EQ(reference_time, deal->expire_date());
}
TEST(ServicesCustomizationDocumentTest, OldDeal) {
diff --git a/chrome/browser/chromeos/login/eula_view.cc b/chrome/browser/chromeos/login/eula_view.cc
index 5b94b31..10cd607 100644
--- a/chrome/browser/chromeos/login/eula_view.cc
+++ b/chrome/browser/chromeos/login/eula_view.cc
@@ -536,4 +536,7 @@ bool EulaView::FadeInOnShow() {
return false;
}
+void EulaView::OnLinkActivated(size_t index) {
+}
+
} // namespace chromeos
diff --git a/chrome/browser/chromeos/login/eula_view.h b/chrome/browser/chromeos/login/eula_view.h
index 8a7ee8b..8d44d50 100644
--- a/chrome/browser/chromeos/login/eula_view.h
+++ b/chrome/browser/chromeos/login/eula_view.h
@@ -114,7 +114,7 @@ class EulaView
virtual void BubbleClosing(Bubble* bubble, bool closed_by_escape);
virtual bool CloseOnEscape();
virtual bool FadeInOnShow();
- virtual void OnHelpLinkActivated() {}
+ virtual void OnLinkActivated(size_t index);
// Dialog controls.
views::Label* google_eula_label_;
diff --git a/chrome/browser/chromeos/login/message_bubble.cc b/chrome/browser/chromeos/login/message_bubble.cc
index 428815b..305d10b 100644
--- a/chrome/browser/chromeos/login/message_bubble.cc
+++ b/chrome/browser/chromeos/login/message_bubble.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/chromeos/login/message_bubble.h"
+#include <vector>
+
#include "base/logging.h"
#include "chrome/browser/chromeos/login/helper.h"
#include "grit/generated_resources.h"
@@ -25,12 +27,11 @@ MessageBubble::MessageBubble(views::Widget::InitParams::Type type,
views::Widget* parent,
SkBitmap* image,
const std::wstring& text,
- const std::wstring& help,
+ const std::vector<std::wstring>& links,
bool grab_enabled,
MessageBubbleDelegate* delegate)
: Bubble(type, false), // don't show while screen is locked
parent_(parent),
- help_link_(NULL),
message_delegate_(delegate),
grab_enabled_(grab_enabled) {
using views::GridLayout;
@@ -47,7 +48,7 @@ MessageBubble::MessageBubble(views::Widget::InitParams::Type type,
column_set->AddPaddingColumn(0, kBorderSize);
column_set->AddColumn(GridLayout::TRAILING, GridLayout::LEADING, 0,
GridLayout::USE_PREF, 0, 0);
- if (!help.empty()) {
+ if (!links.empty()) {
column_set = layout->AddColumnSet(1);
column_set->AddPaddingColumn(0, kBorderSize + image->width());
column_set->AddColumn(GridLayout::LEADING, GridLayout::LEADING, 1,
@@ -76,9 +77,10 @@ MessageBubble::MessageBubble(views::Widget::InitParams::Type type,
rb.GetBitmapNamed(IDR_CLOSE_BAR_P));
layout->AddView(close_button_);
- if (!help.empty()) {
+ for (size_t i = 0; i < links.size(); ++i) {
layout->StartRowWithPadding(0, 1, 0, kBorderSize);
- help_link_ = new views::Link(help);
+ views::Link* help_link_ = new views::Link(links[i]);
+ help_links_.push_back(help_link_);
help_link_->set_listener(this);
help_link_->SetNormalColor(login::kLinkColor);
help_link_->SetHighlightedColor(login::kLinkColor);
@@ -86,6 +88,9 @@ MessageBubble::MessageBubble(views::Widget::InitParams::Type type,
}
}
+MessageBubble::~MessageBubble() {
+}
+
void MessageBubble::ButtonPressed(views::Button* sender,
const views::Event& event) {
if (sender == close_button_) {
@@ -96,12 +101,15 @@ void MessageBubble::ButtonPressed(views::Button* sender,
}
void MessageBubble::LinkClicked(views::Link* source, int event_flags) {
- if (source == help_link_) {
- if (message_delegate_)
- message_delegate_->OnHelpLinkActivated();
- } else {
- NOTREACHED() << "Unknown view";
+ if (!message_delegate_)
+ return;
+ for (size_t i = 0; i < help_links_.size(); ++i) {
+ if (source == help_links_[i]) {
+ message_delegate_->OnLinkActivated(i);
+ return;
+ }
}
+ NOTREACHED() << "Unknown view";
}
// static
@@ -112,9 +120,30 @@ MessageBubble* MessageBubble::Show(views::Widget* parent,
const std::wstring& text,
const std::wstring& help,
MessageBubbleDelegate* delegate) {
+ std::vector<std::wstring> links;
+ if (!help.empty())
+ links.push_back(help);
+ return MessageBubble::ShowWithLinks(parent,
+ position_relative_to,
+ arrow_location,
+ image,
+ text,
+ links,
+ delegate);
+}
+
+// static
+MessageBubble* MessageBubble::ShowWithLinks(
+ views::Widget* parent,
+ const gfx::Rect& position_relative_to,
+ BubbleBorder::ArrowLocation arrow_location,
+ SkBitmap* image,
+ const std::wstring& text,
+ const std::vector<std::wstring>& links,
+ MessageBubbleDelegate* delegate) {
// The bubble will be destroyed when it is closed.
MessageBubble* bubble = new MessageBubble(
- views::Widget::InitParams::TYPE_POPUP, parent, image, text, help,
+ views::Widget::InitParams::TYPE_POPUP, parent, image, text, links,
true, delegate);
bubble->InitBubble(parent, position_relative_to, arrow_location,
bubble->text_->parent(), delegate);
@@ -130,9 +159,12 @@ MessageBubble* MessageBubble::ShowNoGrab(
const std::wstring& text,
const std::wstring& help,
MessageBubbleDelegate* delegate) {
+ std::vector<std::wstring> links;
+ if (!help.empty())
+ links.push_back(help);
// The bubble will be destroyed when it is closed.
MessageBubble* bubble = new MessageBubble(
- views::Widget::InitParams::TYPE_CONTROL, parent, image, text, help,
+ views::Widget::InitParams::TYPE_CONTROL, parent, image, text, links,
false, delegate);
bubble->InitBubble(parent, position_relative_to, arrow_location,
bubble->text_->parent(), delegate);
diff --git a/chrome/browser/chromeos/login/message_bubble.h b/chrome/browser/chromeos/login/message_bubble.h
index 3be9f64..c3dfa75 100644
--- a/chrome/browser/chromeos/login/message_bubble.h
+++ b/chrome/browser/chromeos/login/message_bubble.h
@@ -6,6 +6,8 @@
#define CHROME_BROWSER_CHROMEOS_LOGIN_MESSAGE_BUBBLE_H_
#pragma once
+#include <vector>
+
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "chrome/browser/ui/views/bubble/bubble.h"
@@ -27,7 +29,8 @@ namespace chromeos {
class MessageBubbleDelegate : public BubbleDelegate {
public:
// Called when the user clicked on help link.
- virtual void OnHelpLinkActivated() = 0;
+ // |index| identifies which link was clicked if there's more than one.
+ virtual void OnLinkActivated(size_t index) = 0;
};
// MessageBubble is used to show error and info messages on OOBE screens.
@@ -36,6 +39,7 @@ class MessageBubble : public Bubble,
public views::LinkListener {
public:
// Create and show bubble. position_relative_to must be in screen coordinates.
+ // |links| is an optional vector of links texts.
static MessageBubble* Show(views::Widget* parent,
const gfx::Rect& position_relative_to,
BubbleBorder::ArrowLocation arrow_location,
@@ -44,6 +48,17 @@ class MessageBubble : public Bubble,
const std::wstring& help,
MessageBubbleDelegate* delegate);
+ // Create and show bubble. position_relative_to must be in screen coordinates.
+ // |links| is an optional vector of links texts.
+ static MessageBubble* ShowWithLinks(
+ views::Widget* parent,
+ const gfx::Rect& position_relative_to,
+ BubbleBorder::ArrowLocation arrow_location,
+ SkBitmap* image,
+ const std::wstring& text,
+ const std::vector<std::wstring>& links,
+ MessageBubbleDelegate* delegate);
+
// Create and show bubble which does not grab pointer. This creates
// a TYPE_CHILD NativeWidgetGtk and |position_relative_to| must be in parent's
// coordinates.
@@ -61,6 +76,8 @@ class MessageBubble : public Bubble,
virtual gboolean OnButtonPress(GtkWidget* widget, GdkEventButton* event);
protected:
+ virtual ~MessageBubble();
+
// Overridden from views::ButtonListener:
virtual void ButtonPressed(views::Button* sender,
const views::Event& event);
@@ -77,7 +94,7 @@ class MessageBubble : public Bubble,
views::Widget* parent,
SkBitmap* image,
const std::wstring& text,
- const std::wstring& help,
+ const std::vector<std::wstring>& links,
bool grab_enabled,
MessageBubbleDelegate* delegate);
@@ -85,7 +102,7 @@ class MessageBubble : public Bubble,
views::ImageView* icon_;
views::Label* text_;
views::ImageButton* close_button_;
- views::Link* help_link_;
+ std::vector<views::Link*> help_links_;
MessageBubbleDelegate* message_delegate_;
bool grab_enabled_;
diff --git a/chrome/browser/chromeos/login/screen_locker.cc b/chrome/browser/chromeos/login/screen_locker.cc
index f4dfc28..78e6543 100644
--- a/chrome/browser/chromeos/login/screen_locker.cc
+++ b/chrome/browser/chromeos/login/screen_locker.cc
@@ -902,6 +902,9 @@ bool ScreenLocker::FadeInOnShow() {
return false;
}
+void ScreenLocker::OnLinkActivated(size_t index) {
+}
+
void ScreenLocker::OnCaptchaEntered(const std::string& captcha) {
// Captcha dialog is only shown when LoginPerformer instance exists,
// i.e. blocking UI after password change is in place.
diff --git a/chrome/browser/chromeos/login/screen_locker.h b/chrome/browser/chromeos/login/screen_locker.h
index 195fd96..9cfff73 100644
--- a/chrome/browser/chromeos/login/screen_locker.h
+++ b/chrome/browser/chromeos/login/screen_locker.h
@@ -78,7 +78,7 @@ class ScreenLocker : public LoginStatusConsumer,
virtual void BubbleClosing(Bubble* bubble, bool closed_by_escape);
virtual bool CloseOnEscape();
virtual bool FadeInOnShow();
- virtual void OnHelpLinkActivated() {}
+ virtual void OnLinkActivated(size_t index);
// CaptchaView::Delegate implementation:
virtual void OnCaptchaEntered(const std::string& captcha);
diff --git a/chrome/browser/chromeos/login/views_login_display.cc b/chrome/browser/chromeos/login/views_login_display.cc
index 398d6e1..6f5654b 100644
--- a/chrome/browser/chromeos/login/views_login_display.cc
+++ b/chrome/browser/chromeos/login/views_login_display.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/chromeos/login/views_login_display.h"
#include <algorithm>
+#include <vector>
#include "base/stl_util-inl.h"
#include "base/utf_string_conversions.h"
@@ -309,7 +310,7 @@ bool ViewsLoginDisplay::FadeInOnShow() {
return false;
}
-void ViewsLoginDisplay::OnHelpLinkActivated() {
+void ViewsLoginDisplay::OnLinkActivated(size_t index) {
ClearErrors();
if (error_msg_id_ == IDS_LOGIN_ERROR_CAPTIVE_PORTAL) {
delegate()->FixCaptivePortal();
diff --git a/chrome/browser/chromeos/login/views_login_display.h b/chrome/browser/chromeos/login/views_login_display.h
index 4ffd14f..cb5fd3e8 100644
--- a/chrome/browser/chromeos/login/views_login_display.h
+++ b/chrome/browser/chromeos/login/views_login_display.h
@@ -63,7 +63,7 @@ class ViewsLoginDisplay : public LoginDisplay,
virtual void BubbleClosing(Bubble* bubble, bool closed_by_escape);
virtual bool CloseOnEscape();
virtual bool FadeInOnShow();
- virtual void OnHelpLinkActivated();
+ virtual void OnLinkActivated(size_t index);
private:
// Returns existing UserController instance by |email|.
diff --git a/chrome/browser/chromeos/login/views_network_screen_actor.cc b/chrome/browser/chromeos/login/views_network_screen_actor.cc
index 2f6172a..006280f 100644
--- a/chrome/browser/chromeos/login/views_network_screen_actor.cc
+++ b/chrome/browser/chromeos/login/views_network_screen_actor.cc
@@ -152,7 +152,7 @@ bool ViewsNetworkScreenActor::FadeInOnShow() {
return false;
}
-void ViewsNetworkScreenActor::OnHelpLinkActivated() {
+void ViewsNetworkScreenActor::OnLinkActivated(size_t index) {
ClearErrors();
if (!help_app_.get()) {
help_app_ = new HelpAppLauncher(
diff --git a/chrome/browser/chromeos/login/views_network_screen_actor.h b/chrome/browser/chromeos/login/views_network_screen_actor.h
index 0505e96..ed4a357 100644
--- a/chrome/browser/chromeos/login/views_network_screen_actor.h
+++ b/chrome/browser/chromeos/login/views_network_screen_actor.h
@@ -73,7 +73,7 @@ class ViewsNetworkScreenActor : public ViewScreen<NetworkSelectionView>,
virtual void BubbleClosing(Bubble* bubble, bool closed_by_escape);
virtual bool CloseOnEscape();
virtual bool FadeInOnShow();
- virtual void OnHelpLinkActivated();
+ virtual void OnLinkActivated(size_t index);
// ViewScreen implementation:
virtual void CreateView();
diff --git a/chrome/browser/chromeos/status/network_menu.cc b/chrome/browser/chromeos/status/network_menu.cc
index 72a1716..2987ab0 100644
--- a/chrome/browser/chromeos/status/network_menu.cc
+++ b/chrome/browser/chromeos/status/network_menu.cc
@@ -743,8 +743,8 @@ void MainMenuModel::InitMenuItems(bool is_browser_mode,
// Ignoring deal restrictions, use any carrier information available.
const ServicesCustomizationDocument::CarrierDeal* deal =
customization->GetCarrierDeal(carrier_id, false);
- if (deal && !deal->top_up_url.empty())
- top_up_url_ = deal->top_up_url;
+ if (deal && !deal->top_up_url().empty())
+ top_up_url_ = deal->top_up_url();
}
if (!top_up_url_.empty()) {
menu_items_.push_back(MenuItem(
diff --git a/chrome/browser/chromeos/status/network_menu_button.cc b/chrome/browser/chromeos/status/network_menu_button.cc
index e517a46..5799f44 100644
--- a/chrome/browser/chromeos/status/network_menu_button.cc
+++ b/chrome/browser/chromeos/status/network_menu_button.cc
@@ -238,6 +238,8 @@ void NetworkMenuButton::OnLocaleChanged() {
void NetworkMenuButton::BubbleClosing(Bubble* bubble, bool closed_by_escape) {
mobile_data_bubble_ = NULL;
+ deal_info_url_.clear();
+ deal_topup_url_.clear();
}
bool NetworkMenuButton::CloseOnEscape() {
@@ -248,22 +250,35 @@ bool NetworkMenuButton::FadeInOnShow() {
return false;
}
-void NetworkMenuButton::OnHelpLinkActivated() {
- // mobile_data_bubble_ will be set to NULL in callback.
- if (mobile_data_bubble_)
+void NetworkMenuButton::OnLinkActivated(size_t index) {
+ // If we have deal info URL defined that means that there're
+ // 2 links in bubble. Let the user close it manually then thus giving ability
+ // 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();
- if (!deal_url_.empty()) {
+
+ std::string deal_url_to_open;
+ if (index == 0) {
+ if (!deal_topup_url_.empty()) {
+ deal_url_to_open = deal_topup_url_;
+ } else {
+ const Network* cellular =
+ CrosLibrary::Get()->GetNetworkLibrary()->cellular_network();
+ if (!cellular)
+ return;
+ ShowTabbedNetworkSettings(cellular);
+ return;
+ }
+ } else if (index == 1) {
+ deal_url_to_open = deal_info_url_;
+ }
+
+ if (!deal_url_to_open.empty()) {
Browser* browser = BrowserList::GetLastActive();
if (!browser)
return;
- browser->ShowSingletonTab(GURL(deal_url_));
- deal_url_.clear();
- } else {
- const Network* cellular =
- CrosLibrary::Get()->GetNetworkLibrary()->cellular_network();
- if (!cellular)
- return;
- ShowTabbedNetworkSettings(cellular);
+ browser->ShowSingletonTab(GURL(deal_url_to_open));
}
}
@@ -289,7 +304,7 @@ NetworkMenuButton::GetCarrierDeal(
if (deal) {
// Check deal for validity.
int carrier_deal_promo_pref = GetCarrierDealPromoShown();
- if (carrier_deal_promo_pref >= deal->notification_count)
+ if (carrier_deal_promo_pref >= deal->notification_count())
return NULL;
const std::string locale = g_browser_process->GetApplicationLocale();
std::string deal_text = deal->GetLocalizedString(locale,
@@ -458,7 +473,8 @@ void NetworkMenuButton::ShowOptionalMobileDataPromoNotification(
carrier_deal_promo_pref = GetCarrierDealPromoShown();
const std::string locale = g_browser_process->GetApplicationLocale();
deal_text = deal->GetLocalizedString(locale, "notification_text");
- deal_url_ = deal->top_up_url;
+ deal_info_url_ = deal->info_url();
+ deal_topup_url_ = deal->top_up_url();
} else if (!ShouldShow3gPromoNotification()) {
check_for_promo_ = false;
return;
@@ -500,18 +516,22 @@ void NetworkMenuButton::ShowOptionalMobileDataPromoNotification(
// Use deal URL if it's defined or general "Network Settings" URL.
int link_message_id;
- if (deal_url_.empty())
+ if (deal_topup_url_.empty())
link_message_id = IDS_OFFLINE_NETWORK_SETTINGS;
else
link_message_id = IDS_STATUSBAR_NETWORK_VIEW_ACCOUNT;
- mobile_data_bubble_ = MessageBubble::Show(
+ std::vector<std::wstring> links;
+ links.push_back(UTF16ToWide(l10n_util::GetStringUTF16(link_message_id)));
+ if (!deal_topup_url_.empty())
+ links.push_back(UTF16ToWide(l10n_util::GetStringUTF16(IDS_LEARN_MORE)));
+ mobile_data_bubble_ = MessageBubble::ShowWithLinks(
GetWidget(),
button_bounds,
BubbleBorder::TOP_RIGHT ,
ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_NOTIFICATION_3G),
notification_text,
- UTF16ToWide(l10n_util::GetStringUTF16(link_message_id)),
+ links,
this);
check_for_promo_ = false;
diff --git a/chrome/browser/chromeos/status/network_menu_button.h b/chrome/browser/chromeos/status/network_menu_button.h
index 967f9cd9..4ef308d 100644
--- a/chrome/browser/chromeos/status/network_menu_button.h
+++ b/chrome/browser/chromeos/status/network_menu_button.h
@@ -94,7 +94,7 @@ class NetworkMenuButton : public StatusAreaButton,
virtual void BubbleClosing(Bubble* bubble, bool closed_by_escape);
virtual bool CloseOnEscape();
virtual bool FadeInOnShow();
- virtual void OnHelpLinkActivated();
+ virtual void OnLinkActivated(size_t index);
private:
// Returns carrier deal if it's specified and should be shown,
@@ -157,8 +157,11 @@ class NetworkMenuButton : public StatusAreaButton,
// whose status is displayed in the network menu button.
std::string active_network_;
- // Current carrier deal URL.
- std::string deal_url_;
+ // Current carrier deal info URL.
+ std::string deal_info_url_;
+
+ // Current carrier deal top-up URL.
+ std::string deal_topup_url_;
// Factory for delaying showing promo notification.
ScopedRunnableMethodFactory<NetworkMenuButton> method_factory_;
diff --git a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
index 4c706e8..6ba6910 100644
--- a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
@@ -789,8 +789,8 @@ void InternetOptionsHandler::PopulateCellularDetails(
std::string carrier_id = cros_->GetCellularHomeCarrierId();
const chromeos::ServicesCustomizationDocument::CarrierDeal* deal =
customization->GetCarrierDeal(carrier_id, false);
- if (deal && !deal->top_up_url.empty())
- dictionary->SetString("carrierUrl", deal->top_up_url);
+ if (deal && !deal->top_up_url().empty())
+ dictionary->SetString("carrierUrl", deal->top_up_url());
}
}