| OLD | NEW |
| 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_reader.h" | 14 #include "base/json/json_reader.h" |
| 15 #include "base/json/json_writer.h" | 15 #include "base/json/json_writer.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.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/timer.h" | 21 #include "base/timer.h" |
| 22 #include "base/utf_string_conversions.h" | 22 #include "base/utf_string_conversions.h" |
| 23 #include "base/values.h" | 23 #include "base/values.h" |
| 24 #include "chrome/browser/browser_process.h" | 24 #include "chrome/browser/browser_process.h" |
| 25 #include "chrome/browser/chromeos/cros/cros_library.h" | 25 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 26 #include "chrome/browser/chromeos/cros/network_library.h" | 26 #include "chrome/browser/chromeos/cros/network_library.h" |
| 27 #include "chrome/browser/prefs/pref_service.h" | 27 #include "chrome/browser/prefs/pref_service.h" |
| 28 #include "chrome/browser/profiles/profile.h" | 28 #include "chrome/browser/profiles/profile.h" |
| 29 #include "chrome/browser/ui/browser_list.h" | 29 #include "chrome/browser/ui/browser_list.h" |
| 30 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 30 #include "chrome/browser/ui/webui/chrome_url_data_manager_factory.h" |
| 31 #include "chrome/common/jstemplate_builder.h" | 31 #include "chrome/common/jstemplate_builder.h" |
| 32 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
| 33 #include "chrome/common/render_messages.h" | 33 #include "chrome/common/render_messages.h" |
| 34 #include "chrome/common/url_constants.h" | 34 #include "chrome/common/url_constants.h" |
| 35 #include "content/public/browser/browser_thread.h" | 35 #include "content/public/browser/browser_thread.h" |
| 36 #include "content/public/browser/render_view_host_observer.h" | 36 #include "content/public/browser/render_view_host_observer.h" |
| 37 #include "content/public/browser/web_contents.h" | 37 #include "content/public/browser/web_contents.h" |
| 38 #include "content/public/browser/web_ui.h" | 38 #include "content/public/browser/web_ui.h" |
| 39 #include "content/public/browser/web_ui_message_handler.h" | 39 #include "content/public/browser/web_ui_message_handler.h" |
| 40 #include "googleurl/src/gurl.h" | 40 #include "googleurl/src/gurl.h" |
| (...skipping 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1395 MobileSetupUI::MobileSetupUI(content::WebUI* web_ui) | 1395 MobileSetupUI::MobileSetupUI(content::WebUI* web_ui) |
| 1396 : WebUIController(web_ui) { | 1396 : WebUIController(web_ui) { |
| 1397 chromeos::CellularNetwork* network = GetCellularNetwork(); | 1397 chromeos::CellularNetwork* network = GetCellularNetwork(); |
| 1398 std::string service_path = network ? network->service_path() : std::string(); | 1398 std::string service_path = network ? network->service_path() : std::string(); |
| 1399 web_ui->AddMessageHandler(new MobileSetupHandler(service_path)); | 1399 web_ui->AddMessageHandler(new MobileSetupHandler(service_path)); |
| 1400 MobileSetupUIHTMLSource* html_source = | 1400 MobileSetupUIHTMLSource* html_source = |
| 1401 new MobileSetupUIHTMLSource(service_path); | 1401 new MobileSetupUIHTMLSource(service_path); |
| 1402 | 1402 |
| 1403 // Set up the chrome://mobilesetup/ source. | 1403 // Set up the chrome://mobilesetup/ source. |
| 1404 Profile* profile = Profile::FromWebUI(web_ui); | 1404 Profile* profile = Profile::FromWebUI(web_ui); |
| 1405 profile->GetChromeURLDataManager()->AddDataSource(html_source); | 1405 ChromeURLDataManagerFactory::GetForProfile(profile)-> |
| 1406 AddDataSource(html_source); |
| 1406 } | 1407 } |
| 1407 | 1408 |
| 1408 void MobileSetupUI::RenderViewCreated(RenderViewHost* host) { | 1409 void MobileSetupUI::RenderViewCreated(RenderViewHost* host) { |
| 1409 // Destroyed by the corresponding RenderViewHost | 1410 // Destroyed by the corresponding RenderViewHost |
| 1410 new PortalFrameLoadObserver(AsWeakPtr(), host); | 1411 new PortalFrameLoadObserver(AsWeakPtr(), host); |
| 1411 } | 1412 } |
| OLD | NEW |