| 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/chromeos/customization_document.h" | 5 #include "chrome/browser/chromeos/customization_document.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 if (!file_util::ReadFileToString(manifest_path, &manifest)) | 85 if (!file_util::ReadFileToString(manifest_path, &manifest)) |
| 86 return false; | 86 return false; |
| 87 return LoadManifestFromString(manifest); | 87 return LoadManifestFromString(manifest); |
| 88 } | 88 } |
| 89 | 89 |
| 90 bool CustomizationDocument::LoadManifestFromString( | 90 bool CustomizationDocument::LoadManifestFromString( |
| 91 const std::string& manifest) { | 91 const std::string& manifest) { |
| 92 int error_code = 0; | 92 int error_code = 0; |
| 93 std::string error; | 93 std::string error; |
| 94 scoped_ptr<Value> root(base::JSONReader::ReadAndReturnError(manifest, | 94 scoped_ptr<Value> root(base::JSONReader::ReadAndReturnError(manifest, |
| 95 true, | 95 base::JSON_ALLOW_TRAILING_COMMAS, &error_code, &error)); |
| 96 &error_code, | |
| 97 &error)); | |
| 98 if (error_code != base::JSONReader::JSON_NO_ERROR) | 96 if (error_code != base::JSONReader::JSON_NO_ERROR) |
| 99 LOG(ERROR) << error; | 97 LOG(ERROR) << error; |
| 100 DCHECK(root.get() != NULL); | 98 DCHECK(root.get() != NULL); |
| 101 if (root.get() == NULL) | 99 if (root.get() == NULL) |
| 102 return false; | 100 return false; |
| 103 DCHECK(root->GetType() == Value::TYPE_DICTIONARY); | 101 DCHECK(root->GetType() == Value::TYPE_DICTIONARY); |
| 104 if (root->GetType() == Value::TYPE_DICTIONARY) { | 102 if (root->GetType() == Value::TYPE_DICTIONARY) { |
| 105 root_.reset(static_cast<DictionaryValue*>(root.release())); | 103 root_.reset(static_cast<DictionaryValue*>(root.release())); |
| 106 std::string result; | 104 std::string result; |
| 107 if (root_->GetString(kVersionAttr, &result) && | 105 if (root_->GetString(kVersionAttr, &result) && |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 locale, kAppContentAttr, kInitialStartPageAttr); | 335 locale, kAppContentAttr, kInitialStartPageAttr); |
| 338 } | 336 } |
| 339 | 337 |
| 340 std::string ServicesCustomizationDocument::GetSupportPage( | 338 std::string ServicesCustomizationDocument::GetSupportPage( |
| 341 const std::string& locale) const { | 339 const std::string& locale) const { |
| 342 return GetLocaleSpecificString( | 340 return GetLocaleSpecificString( |
| 343 locale, kAppContentAttr, kSupportPageAttr); | 341 locale, kAppContentAttr, kSupportPageAttr); |
| 344 } | 342 } |
| 345 | 343 |
| 346 } // namespace chromeos | 344 } // namespace chromeos |
| OLD | NEW |