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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/chromeos/mobile_setup_ui.h" 5 #include "chrome/browser/ui/webui/chromeos/mobile_setup_ui.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/file_util.h" 13 #include "base/file_util.h"
14 #include "base/json/json_writer.h" 14 #include "base/json/json_writer.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/memory/ref_counted_memory.h" 16 #include "base/memory/ref_counted_memory.h"
17 #include "base/message_loop.h" 17 #include "base/message_loop.h"
18 #include "base/metrics/histogram.h" 18 #include "base/metrics/histogram.h"
19 #include "base/string_piece.h" 19 #include "base/string_piece.h"
20 #include "base/string_util.h" 20 #include "base/string_util.h"
21 #include "base/utf_string_conversions.h" 21 #include "base/utf_string_conversions.h"
22 #include "base/values.h" 22 #include "base/values.h"
23 #include "chrome/browser/chromeos/cros/cros_library.h" 23 #include "chrome/browser/chromeos/cros/cros_library.h"
24 #include "chrome/browser/chromeos/cros/network_library.h" 24 #include "chrome/browser/chromeos/cros/network_library.h"
25 #include "chrome/browser/chromeos/login/user_manager.h"
25 #include "chrome/browser/chromeos/mobile/mobile_activator.h" 26 #include "chrome/browser/chromeos/mobile/mobile_activator.h"
26 #include "chrome/browser/profiles/profile.h" 27 #include "chrome/browser/profiles/profile.h"
27 #include "chrome/browser/ui/browser_list.h" 28 #include "chrome/browser/ui/browser_list.h"
28 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 29 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
29 #include "chrome/common/jstemplate_builder.h" 30 #include "chrome/common/jstemplate_builder.h"
30 #include "chrome/common/pref_names.h" 31 #include "chrome/common/pref_names.h"
31 #include "chrome/common/render_messages.h" 32 #include "chrome/common/render_messages.h"
32 #include "chrome/common/url_constants.h" 33 #include "chrome/common/url_constants.h"
33 #include "content/public/browser/browser_thread.h" 34 #include "content/public/browser/browser_thread.h"
34 #include "content/public/browser/render_view_host_observer.h" 35 #include "content/public/browser/render_view_host_observer.h"
(...skipping 25 matching lines...) Expand all
60 const char kJsApiPaymentPortalLoad[] = "paymentPortalLoad"; 61 const char kJsApiPaymentPortalLoad[] = "paymentPortalLoad";
61 const char kJsApiResultOK[] = "ok"; 62 const char kJsApiResultOK[] = "ok";
62 63
63 const char kJsDeviceStatusChangedCallback[] = 64 const char kJsDeviceStatusChangedCallback[] =
64 "mobile.MobileSetup.deviceStateChanged"; 65 "mobile.MobileSetup.deviceStateChanged";
65 const char kJsPortalFrameLoadFailedCallback[] = 66 const char kJsPortalFrameLoadFailedCallback[] =
66 "mobile.MobileSetup.portalFrameLoadError"; 67 "mobile.MobileSetup.portalFrameLoadError";
67 const char kJsPortalFrameLoadCompletedCallback[] = 68 const char kJsPortalFrameLoadCompletedCallback[] =
68 "mobile.MobileSetup.portalFrameLoadCompleted"; 69 "mobile.MobileSetup.portalFrameLoadCompleted";
69 70
71 const char kEmailParam[] = "&email=";
72
70 } // namespace 73 } // namespace
71 74
72 // Observes IPC messages from the rederer and notifies JS if frame loading error 75 // Observes IPC messages from the rederer and notifies JS if frame loading error
73 // appears. 76 // appears.
74 class PortalFrameLoadObserver : public content::RenderViewHostObserver { 77 class PortalFrameLoadObserver : public content::RenderViewHostObserver {
75 public: 78 public:
76 PortalFrameLoadObserver(const base::WeakPtr<MobileSetupUI>& parent, 79 PortalFrameLoadObserver(const base::WeakPtr<MobileSetupUI>& parent,
77 RenderViewHost* host) 80 RenderViewHost* host)
78 : content::RenderViewHostObserver(host), parent_(parent) { 81 : content::RenderViewHostObserver(host), parent_(parent) {
79 Send(new ChromeViewMsg_StartFrameSniffer(routing_id(), 82 Send(new ChromeViewMsg_StartFrameSniffer(routing_id(),
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 310
308 void MobileSetupHandler::GetDeviceInfo(CellularNetwork* network, 311 void MobileSetupHandler::GetDeviceInfo(CellularNetwork* network,
309 DictionaryValue* value) { 312 DictionaryValue* value) {
310 DCHECK(network); 313 DCHECK(network);
311 chromeos::NetworkLibrary* cros = 314 chromeos::NetworkLibrary* cros =
312 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); 315 chromeos::CrosLibrary::Get()->GetNetworkLibrary();
313 if (!cros) 316 if (!cros)
314 return; 317 return;
315 value->SetString("carrier", network->name()); 318 value->SetString("carrier", network->name());
316 value->SetString("payment_url", network->payment_url()); 319 value->SetString("payment_url", network->payment_url());
317 if (network->using_post() && network->post_data().length()) 320 if (network->using_post() && network->post_data().length()) {
318 value->SetString("post_data", network->post_data()); 321 std::string post_data = network->post_data();
322 // Append the current e-mail address to the post data to allow Verizon
323 // to pre-populate it on their form.
324 chromeos::UserManager* manager = chromeos::UserManager::Get();
325 if (manager) {
Nikita (slow) 2012/08/03 22:59:01 I don't think you need such check. If UserManager
rkc1 2012/08/03 23:08:15 Done.
326 post_data.append(kEmailParam).append(
zel 2012/08/03 22:29:55 no encoding here?
rkc1 2012/08/03 22:47:46 The post data is escaped in JS: http://code.google
zel 2012/08/03 23:09:01 no, that's not the same thing. it's escaped there
rkc1 2012/08/03 23:38:29 Done.
327 manager->GetLoggedInUser().display_email());
Nikita (slow) 2012/08/03 22:59:01 Add check if (manager->IsUserLoggedIn())
Nikita (slow) 2012/08/03 22:59:40 Otherwise it will return NULL when not in user ses
rkc1 2012/08/03 23:08:15 Thanks for catching this; I keep forgetting that w
328 }
329
330 value->SetString("post_data", post_data);
331 }
319 332
320 const chromeos::NetworkDevice* device = 333 const chromeos::NetworkDevice* device =
321 cros->FindNetworkDeviceByPath(network->device_path()); 334 cros->FindNetworkDeviceByPath(network->device_path());
322 if (device) { 335 if (device) {
323 value->SetString("MEID", device->meid()); 336 value->SetString("MEID", device->meid());
324 value->SetString("IMEI", device->imei()); 337 value->SetString("IMEI", device->imei());
325 value->SetString("MDN", device->mdn()); 338 value->SetString("MDN", device->mdn());
326 } 339 }
327 } 340 }
328 341
(...skipping 10 matching lines...) Expand all
339 352
340 // Set up the chrome://mobilesetup/ source. 353 // Set up the chrome://mobilesetup/ source.
341 Profile* profile = Profile::FromWebUI(web_ui); 354 Profile* profile = Profile::FromWebUI(web_ui);
342 ChromeURLDataManager::AddDataSource(profile, html_source); 355 ChromeURLDataManager::AddDataSource(profile, html_source);
343 } 356 }
344 357
345 void MobileSetupUI::RenderViewCreated(RenderViewHost* host) { 358 void MobileSetupUI::RenderViewCreated(RenderViewHost* host) {
346 // Destroyed by the corresponding RenderViewHost 359 // Destroyed by the corresponding RenderViewHost
347 new PortalFrameLoadObserver(AsWeakPtr(), host); 360 new PortalFrameLoadObserver(AsWeakPtr(), host);
348 } 361 }
OLDNEW
« 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