| 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 |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 LOG(ERROR) << "Error loading cellular config file: " << | 387 LOG(ERROR) << "Error loading cellular config file: " << |
| 388 kCellularConfigPath; | 388 kCellularConfigPath; |
| 389 } | 389 } |
| 390 } | 390 } |
| 391 | 391 |
| 392 bool CellularConfigDocument::LoadFromFile(const FilePath& config_path) { | 392 bool CellularConfigDocument::LoadFromFile(const FilePath& config_path) { |
| 393 std::string config; | 393 std::string config; |
| 394 if (!file_util::ReadFileToString(config_path, &config)) | 394 if (!file_util::ReadFileToString(config_path, &config)) |
| 395 return false; | 395 return false; |
| 396 | 396 |
| 397 scoped_ptr<Value> root(base::JSONReader::Read(config, true)); | 397 scoped_ptr<Value> root( |
| 398 base::JSONReader::Read(config, base::JSON_ALLOW_TRAILING_COMMAS)); |
| 398 DCHECK(root.get() != NULL); | 399 DCHECK(root.get() != NULL); |
| 399 if (!root.get() || root->GetType() != Value::TYPE_DICTIONARY) { | 400 if (!root.get() || root->GetType() != Value::TYPE_DICTIONARY) { |
| 400 LOG(WARNING) << "Bad cellular config file"; | 401 LOG(WARNING) << "Bad cellular config file"; |
| 401 return false; | 402 return false; |
| 402 } | 403 } |
| 403 | 404 |
| 404 DictionaryValue* root_dict = static_cast<DictionaryValue*>(root.get()); | 405 DictionaryValue* root_dict = static_cast<DictionaryValue*>(root.get()); |
| 405 if (!root_dict->GetString(kVersionField, &version_)) { | 406 if (!root_dict->GetString(kVersionField, &version_)) { |
| 406 LOG(WARNING) << "Cellular config file missing version"; | 407 LOG(WARNING) << "Cellular config file missing version"; |
| 407 return false; | 408 return false; |
| (...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1401 | 1402 |
| 1402 // Set up the chrome://mobilesetup/ source. | 1403 // Set up the chrome://mobilesetup/ source. |
| 1403 Profile* profile = Profile::FromWebUI(web_ui); | 1404 Profile* profile = Profile::FromWebUI(web_ui); |
| 1404 profile->GetChromeURLDataManager()->AddDataSource(html_source); | 1405 profile->GetChromeURLDataManager()->AddDataSource(html_source); |
| 1405 } | 1406 } |
| 1406 | 1407 |
| 1407 void MobileSetupUI::RenderViewCreated(RenderViewHost* host) { | 1408 void MobileSetupUI::RenderViewCreated(RenderViewHost* host) { |
| 1408 // Destroyed by the corresponding RenderViewHost | 1409 // Destroyed by the corresponding RenderViewHost |
| 1409 new PortalFrameLoadObserver(AsWeakPtr(), host); | 1410 new PortalFrameLoadObserver(AsWeakPtr(), host); |
| 1410 } | 1411 } |
| OLD | NEW |