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

Unified Diff: chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc

Issue 10832148: Send e-mail to the verizon portal. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc
diff --git a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc
index b83a10c313c024955d4ead5e6297247c2f284662..8b415809014e3dd7105a8a633a30d0e548160247 100644
--- a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc
@@ -22,6 +22,7 @@
#include "base/values.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/cros/network_library.h"
+#include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/chromeos/mobile/mobile_activator.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_list.h"
@@ -36,6 +37,7 @@
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_message_handler.h"
#include "googleurl/src/gurl.h"
+#include "googleurl/src/url_util.h"
#include "grit/browser_resources.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -67,6 +69,8 @@ const char kJsPortalFrameLoadFailedCallback[] =
const char kJsPortalFrameLoadCompletedCallback[] =
"mobile.MobileSetup.portalFrameLoadCompleted";
+const char kEmailParam[] = "&email=";
+
} // namespace
// Observes IPC messages from the rederer and notifies JS if frame loading error
@@ -314,8 +318,22 @@ void MobileSetupHandler::GetDeviceInfo(CellularNetwork* network,
return;
value->SetString("carrier", network->name());
value->SetString("payment_url", network->payment_url());
- if (network->using_post() && network->post_data().length())
- value->SetString("post_data", network->post_data());
+ if (network->using_post() && network->post_data().length()) {
+ std::string post_data = network->post_data();
+ // Append the current e-mail address to the post data to allow Verizon
+ // to pre-populate it on their form.
+ chromeos::UserManager* manager = chromeos::UserManager::Get();
+ if (manager->IsUserLoggedIn()) {
+ url_canon::RawCanonOutputT<char> output;
+ std::string email = manager->GetLoggedInUser().display_email();
+ url_util::EncodeURIComponent(email.c_str(), email.length(), &output);
+ std::string escaped_email(output.data(), output.length());
+
+ post_data.append(kEmailParam).append(escaped_email);
+ }
+
+ value->SetString("post_data", post_data);
+ }
const chromeos::NetworkDevice* device =
cros->FindNetworkDeviceByPath(network->device_path());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698