| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "chrome/browser/chromeos/cros/cros_library.h" | 26 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 27 #include "chrome/browser/chromeos/cros/network_library.h" | 27 #include "chrome/browser/chromeos/cros/network_library.h" |
| 28 #include "chrome/browser/prefs/pref_service.h" | 28 #include "chrome/browser/prefs/pref_service.h" |
| 29 #include "chrome/browser/profiles/profile.h" | 29 #include "chrome/browser/profiles/profile.h" |
| 30 #include "chrome/browser/ui/browser_list.h" | 30 #include "chrome/browser/ui/browser_list.h" |
| 31 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 31 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 32 #include "chrome/common/jstemplate_builder.h" | 32 #include "chrome/common/jstemplate_builder.h" |
| 33 #include "chrome/common/pref_names.h" | 33 #include "chrome/common/pref_names.h" |
| 34 #include "chrome/common/render_messages.h" | 34 #include "chrome/common/render_messages.h" |
| 35 #include "chrome/common/url_constants.h" | 35 #include "chrome/common/url_constants.h" |
| 36 #include "content/browser/tab_contents/tab_contents.h" | |
| 37 #include "content/public/browser/browser_thread.h" | 36 #include "content/public/browser/browser_thread.h" |
| 38 #include "content/public/browser/render_view_host_observer.h" | 37 #include "content/public/browser/render_view_host_observer.h" |
| 38 #include "content/public/browser/web_contents.h" |
| 39 #include "googleurl/src/gurl.h" | 39 #include "googleurl/src/gurl.h" |
| 40 #include "grit/browser_resources.h" | 40 #include "grit/browser_resources.h" |
| 41 #include "grit/chromium_strings.h" | 41 #include "grit/chromium_strings.h" |
| 42 #include "grit/generated_resources.h" | 42 #include "grit/generated_resources.h" |
| 43 #include "grit/locale_settings.h" | 43 #include "grit/locale_settings.h" |
| 44 #include "ui/base/l10n/l10n_util.h" | 44 #include "ui/base/l10n/l10n_util.h" |
| 45 #include "ui/base/resource/resource_bundle.h" | 45 #include "ui/base/resource/resource_bundle.h" |
| 46 | 46 |
| 47 using content::BrowserThread; | 47 using content::BrowserThread; |
| 48 using content::WebContents; |
| 48 | 49 |
| 49 namespace { | 50 namespace { |
| 50 | 51 |
| 51 // Host page JS API function names. | 52 // Host page JS API function names. |
| 52 const char kJsApiStartActivation[] = "startActivation"; | 53 const char kJsApiStartActivation[] = "startActivation"; |
| 53 const char kJsApiSetTransactionStatus[] = "setTransactionStatus"; | 54 const char kJsApiSetTransactionStatus[] = "setTransactionStatus"; |
| 54 const char kJsApiPaymentPortalLoad[] = "paymentPortalLoad"; | 55 const char kJsApiPaymentPortalLoad[] = "paymentPortalLoad"; |
| 55 const char kJsApiResultOK[] = "ok"; | 56 const char kJsApiResultOK[] = "ok"; |
| 56 | 57 |
| 57 const char kJsDeviceStatusChangedCallback[] = | 58 const char kJsDeviceStatusChangedCallback[] = |
| (...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1342 | 1343 |
| 1343 StartActivation(); | 1344 StartActivation(); |
| 1344 } | 1345 } |
| 1345 | 1346 |
| 1346 //////////////////////////////////////////////////////////////////////////////// | 1347 //////////////////////////////////////////////////////////////////////////////// |
| 1347 // | 1348 // |
| 1348 // MobileSetupUI | 1349 // MobileSetupUI |
| 1349 // | 1350 // |
| 1350 //////////////////////////////////////////////////////////////////////////////// | 1351 //////////////////////////////////////////////////////////////////////////////// |
| 1351 | 1352 |
| 1352 MobileSetupUI::MobileSetupUI(TabContents* contents) : ChromeWebUI(contents) { | 1353 MobileSetupUI::MobileSetupUI(WebContents* contents) : ChromeWebUI(contents) { |
| 1353 chromeos::CellularNetwork* network = GetCellularNetwork(); | 1354 chromeos::CellularNetwork* network = GetCellularNetwork(); |
| 1354 std::string service_path = network ? network->service_path() : std::string(); | 1355 std::string service_path = network ? network->service_path() : std::string(); |
| 1355 MobileSetupHandler* handler = new MobileSetupHandler(service_path); | 1356 MobileSetupHandler* handler = new MobileSetupHandler(service_path); |
| 1356 AddMessageHandler(handler); | 1357 AddMessageHandler(handler); |
| 1357 MobileSetupUIHTMLSource* html_source = | 1358 MobileSetupUIHTMLSource* html_source = |
| 1358 new MobileSetupUIHTMLSource(service_path); | 1359 new MobileSetupUIHTMLSource(service_path); |
| 1359 | 1360 |
| 1360 // Set up the chrome://mobilesetup/ source. | 1361 // Set up the chrome://mobilesetup/ source. |
| 1361 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); | 1362 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); |
| 1362 profile->GetChromeURLDataManager()->AddDataSource(html_source); | 1363 profile->GetChromeURLDataManager()->AddDataSource(html_source); |
| 1363 } | 1364 } |
| 1364 | 1365 |
| 1365 void MobileSetupUI::RenderViewCreated(RenderViewHost* host) { | 1366 void MobileSetupUI::RenderViewCreated(RenderViewHost* host) { |
| 1366 ChromeWebUI::RenderViewCreated(host); | 1367 ChromeWebUI::RenderViewCreated(host); |
| 1367 // Destroyed by the corresponding RenderViewHost. | 1368 // Destroyed by the corresponding RenderViewHost. |
| 1368 new PortalFrameLoadObserver(host, tab_contents()->GetWebUI()); | 1369 new PortalFrameLoadObserver(host, web_contents()->GetWebUI()); |
| 1369 } | 1370 } |
| OLD | NEW |