summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chromeos/cros/network_library.cc21
-rw-r--r--chrome/browser/chromeos/cros/network_library.h3
-rw-r--r--chrome/browser/resources/options/chromeos/internet_options.js2
-rw-r--r--chrome/browser/resources/options2/chromeos/internet_options.js2
-rw-r--r--chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc8
-rw-r--r--chrome/browser/ui/webui/chromeos/mobile_setup_ui.h4
-rw-r--r--chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc20
-rw-r--r--chrome/browser/ui/webui/options/chromeos/internet_options_handler.h1
-rw-r--r--chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.cc20
-rw-r--r--chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.h1
10 files changed, 69 insertions, 13 deletions
diff --git a/chrome/browser/chromeos/cros/network_library.cc b/chrome/browser/chromeos/cros/network_library.cc
index 288bc0c..b99a40e 100644
--- a/chrome/browser/chromeos/cros/network_library.cc
+++ b/chrome/browser/chromeos/cros/network_library.cc
@@ -39,6 +39,7 @@
#include "chrome/browser/chromeos/cros_settings.h"
#include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/chromeos/network_login_observer.h"
+#include "chrome/browser/net/browser_url_util.h"
#include "chrome/common/time_format.h"
#include "content/public/browser/browser_thread.h"
#include "crypto/nss_util.h" // crypto::GetTPMTokenInfo() for 802.1X and VPN.
@@ -122,6 +123,12 @@ const int kRecentPlanPaymentHours = 6;
// If cellular device doesn't have SIM card, then retries are never used.
const int kDefaultSimUnlockRetriesCount = 999;
+// Redirect extension url for POST-ing url parameters to mobile account status
+// sites.
+const char kRedirectExtensionPage[] =
+ "chrome-extension://iadeocfgjdjdmpenejdbfeaocpbikmab/redirect.html?"
+ "autoPost=1";
+
// List of cellular operators names that should have data roaming always enabled
// to be able to connect to any network.
const char* kAlwaysInRoamingOperators[] = {
@@ -1201,6 +1208,20 @@ bool CellularNetwork::SupportsDataPlan() const {
return !usage_url().empty() || !payment_url().empty();
}
+GURL CellularNetwork::GetAccountInfoUrl() const {
+ if (!post_data_.length())
+ return GURL(payment_url());
+
+ GURL base_url(kRedirectExtensionPage);
+ GURL temp_url = chrome_browser_net::AppendQueryParameter(base_url,
+ "post_data",
+ post_data_);
+ GURL redir_url = chrome_browser_net::AppendQueryParameter(temp_url,
+ "formUrl",
+ payment_url());
+ return redir_url;
+}
+
std::string CellularNetwork::GetNetworkTechnologyString() const {
// No need to localize these cellular technology abbreviations.
switch (network_technology_) {
diff --git a/chrome/browser/chromeos/cros/network_library.h b/chrome/browser/chromeos/cros/network_library.h
index 66d0134..7575ec9 100644
--- a/chrome/browser/chromeos/cros/network_library.h
+++ b/chrome/browser/chromeos/cros/network_library.h
@@ -19,6 +19,7 @@
#include "base/string16.h"
#include "base/timer.h"
#include "chrome/browser/chromeos/cros/network_ui_data.h"
+#include "googleurl/src/gurl.h"
#include "third_party/cros/chromeos_network.h"
namespace base {
@@ -1126,6 +1127,8 @@ class CellularNetwork : public WirelessNetwork {
// Returns true if one of the usage_url_ / payment_url_ (or both) is defined.
bool SupportsDataPlan() const;
+ // Return a URL for account info page.
+ GURL GetAccountInfoUrl() const;
// Return a string representation of network technology.
std::string GetNetworkTechnologyString() const;
// Return a string representation of activation state.
diff --git a/chrome/browser/resources/options/chromeos/internet_options.js b/chrome/browser/resources/options/chromeos/internet_options.js
index 5186de8..7bd907b 100644
--- a/chrome/browser/resources/options/chromeos/internet_options.js
+++ b/chrome/browser/resources/options/chromeos/internet_options.js
@@ -95,7 +95,7 @@ cr.define('options', function() {
OptionsPage.closeOverlay();
});
$('viewAccountDetails').addEventListener('click', function(event) {
- chrome.send('buyDataPlan');
+ chrome.send('showMorePlanInfo');
OptionsPage.closeOverlay();
});
$('cellularApnUseDefault').addEventListener('click', function(event) {
diff --git a/chrome/browser/resources/options2/chromeos/internet_options.js b/chrome/browser/resources/options2/chromeos/internet_options.js
index a983d66..04ed13a 100644
--- a/chrome/browser/resources/options2/chromeos/internet_options.js
+++ b/chrome/browser/resources/options2/chromeos/internet_options.js
@@ -95,7 +95,7 @@ cr.define('options', function() {
OptionsPage.closeOverlay();
});
$('viewAccountDetails').addEventListener('click', function(event) {
- chrome.send('buyDataPlan');
+ chrome.send('showMorePlanInfo');
OptionsPage.closeOverlay();
});
$('cellularApnUseDefault').addEventListener('click', function(event) {
diff --git a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc
index 36a1761..2c24a99 100644
--- a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc
@@ -1392,8 +1392,7 @@ void MobileSetupHandler::StartActivationOnUIThread() {
////////////////////////////////////////////////////////////////////////////////
MobileSetupUI::MobileSetupUI(content::WebUI* web_ui)
- : WebUIController(web_ui),
- frame_load_observer_(NULL) {
+ : WebUIController(web_ui) {
chromeos::CellularNetwork* network = GetCellularNetwork();
std::string service_path = network ? network->service_path() : std::string();
web_ui->AddMessageHandler(new MobileSetupHandler(service_path));
@@ -1406,7 +1405,6 @@ MobileSetupUI::MobileSetupUI(content::WebUI* web_ui)
}
void MobileSetupUI::RenderViewCreated(RenderViewHost* host) {
- // Destroyed by the corresponding RenderViewHost.
- frame_load_observer_ =
- new PortalFrameLoadObserver(AsWeakPtr(), host);
+ // Destroyed by the corresponding RenderViewHost
+ new PortalFrameLoadObserver(AsWeakPtr(), host);
}
diff --git a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.h b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.h
index 08800c3..e55740f 100644
--- a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.h
+++ b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.h
@@ -9,7 +9,6 @@
#include "base/memory/weak_ptr.h"
#include "content/public/browser/web_ui_controller.h"
-class PortalFrameLoadObserver;
// A custom WebUI that defines datasource for mobile setup registration page
// that is used in Chrome OS activate modem and perform plan subscription tasks.
class MobileSetupUI : public content::WebUIController,
@@ -17,13 +16,10 @@ class MobileSetupUI : public content::WebUIController,
public:
explicit MobileSetupUI(content::WebUI* web_ui);
- void OnObserverDeleted();
-
private:
// WebUIController overrides.
virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE;
- PortalFrameLoadObserver* frame_load_observer_;
DISALLOW_COPY_AND_ASSIGN(MobileSetupUI);
};
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 44f81df..266bb30a 100644
--- a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
@@ -584,7 +584,7 @@ void InternetOptionsHandler::RegisterMessages() {
base::Bind(&InternetOptionsHandler::BuyDataPlanCallback,
base::Unretained(this)));
web_ui()->RegisterMessageCallback("showMorePlanInfo",
- base::Bind(&InternetOptionsHandler::BuyDataPlanCallback,
+ base::Bind(&InternetOptionsHandler::ShowMorePlanInfoCallback,
base::Unretained(this)));
web_ui()->RegisterMessageCallback("setApn",
base::Bind(&InternetOptionsHandler::SetApnCallback,
@@ -623,6 +623,24 @@ void InternetOptionsHandler::DisableCellularCallback(const ListValue* args) {
cros_->EnableCellularNetworkDevice(false);
}
+void InternetOptionsHandler::ShowMorePlanInfoCallback(const ListValue* args) {
+ if (!web_ui())
+ return;
+ Browser* browser = BrowserList::FindBrowserWithFeature(
+ Profile::FromWebUI(web_ui()), Browser::FEATURE_TABSTRIP);
+ if (!browser)
+ return;
+
+ const chromeos::CellularNetwork* cellular = cros_->cellular_network();
+ if (!cellular)
+ return;
+
+ browser->OpenURL(content::OpenURLParams(
+ cellular->GetAccountInfoUrl(), content::Referrer(),
+ NEW_FOREGROUND_TAB,
+ content::PAGE_TRANSITION_LINK, false));
+}
+
void InternetOptionsHandler::BuyDataPlanCallback(const ListValue* args) {
if (!web_ui())
return;
diff --git a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.h b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.h
index e971a7b..0c9cf32 100644
--- a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.h
+++ b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.h
@@ -93,6 +93,7 @@ class InternetOptionsHandler
void SetSimCardLockCallback(const base::ListValue* args);
void ChangePinCallback(const base::ListValue* args);
void ShareNetworkCallback(const base::ListValue* args);
+ void ShowMorePlanInfoCallback(const ListValue* args);
// Populates the ui with the details of the given device path. This forces
// an overlay to be displayed in the UI.
diff --git a/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.cc b/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.cc
index c11cdcf..c3fa6a8 100644
--- a/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.cc
+++ b/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.cc
@@ -586,7 +586,7 @@ void InternetOptionsHandler::RegisterMessages() {
base::Bind(&InternetOptionsHandler::BuyDataPlanCallback,
base::Unretained(this)));
web_ui()->RegisterMessageCallback("showMorePlanInfo",
- base::Bind(&InternetOptionsHandler::BuyDataPlanCallback,
+ base::Bind(&InternetOptionsHandler::ShowMorePlanInfoCallback,
base::Unretained(this)));
web_ui()->RegisterMessageCallback("setApn",
base::Bind(&InternetOptionsHandler::SetApnCallback,
@@ -625,6 +625,24 @@ void InternetOptionsHandler::DisableCellularCallback(const ListValue* args) {
cros_->EnableCellularNetworkDevice(false);
}
+void InternetOptionsHandler::ShowMorePlanInfoCallback(const ListValue* args) {
+ if (!web_ui())
+ return;
+ Browser* browser = BrowserList::FindBrowserWithFeature(
+ Profile::FromWebUI(web_ui()), Browser::FEATURE_TABSTRIP);
+ if (!browser)
+ return;
+
+ const chromeos::CellularNetwork* cellular = cros_->cellular_network();
+ if (!cellular)
+ return;
+
+ browser->OpenURL(content::OpenURLParams(
+ cellular->GetAccountInfoUrl(), content::Referrer(),
+ NEW_FOREGROUND_TAB,
+ content::PAGE_TRANSITION_LINK, false));
+}
+
void InternetOptionsHandler::BuyDataPlanCallback(const ListValue* args) {
if (!web_ui())
return;
diff --git a/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.h b/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.h
index a81e73f..a43276a 100644
--- a/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.h
+++ b/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.h
@@ -95,6 +95,7 @@ class InternetOptionsHandler
void SetSimCardLockCallback(const base::ListValue* args);
void ChangePinCallback(const base::ListValue* args);
void ShareNetworkCallback(const base::ListValue* args);
+ void ShowMorePlanInfoCallback(const ListValue* args);
// Populates the ui with the details of the given device path. This forces
// an overlay to be displayed in the UI.