| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/common/component_flash_hint_file_linux.h" | 5 #include "chrome/common/component_flash_hint_file_linux.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <sys/mman.h> | 8 #include <sys/mman.h> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 if (!PathService::Get(chrome::FILE_COMPONENT_FLASH_HINT, &hint_file_path)) | 149 if (!PathService::Get(chrome::FILE_COMPONENT_FLASH_HINT, &hint_file_path)) |
| 150 return false; | 150 return false; |
| 151 | 151 |
| 152 std::string json_string; | 152 std::string json_string; |
| 153 if (!base::ReadFileToString(hint_file_path, &json_string)) | 153 if (!base::ReadFileToString(hint_file_path, &json_string)) |
| 154 return false; | 154 return false; |
| 155 | 155 |
| 156 int error_code; | 156 int error_code; |
| 157 std::string error_message; | 157 std::string error_message; |
| 158 JSONStringValueDeserializer deserializer(json_string); | 158 JSONStringValueDeserializer deserializer(json_string); |
| 159 const scoped_ptr<base::Value> value( | 159 const scoped_ptr<base::Value> value = |
| 160 deserializer.Deserialize(&error_code, &error_message)); | 160 deserializer.Deserialize(&error_code, &error_message); |
| 161 | 161 |
| 162 if (!value) { | 162 if (!value) { |
| 163 LOG(ERROR) | 163 LOG(ERROR) |
| 164 << "Could not deserialize the component updated Flash hint file. Error " | 164 << "Could not deserialize the component updated Flash hint file. Error " |
| 165 << error_code << ": " << error_message; | 165 << error_code << ": " << error_message; |
| 166 return false; | 166 return false; |
| 167 } | 167 } |
| 168 | 168 |
| 169 base::DictionaryValue* dict = nullptr; | 169 base::DictionaryValue* dict = nullptr; |
| 170 if (!value->GetAsDictionary(&dict)) | 170 if (!value->GetAsDictionary(&dict)) |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 "component flash plugin will not be loaded."; | 213 "component flash plugin will not be loaded."; |
| 214 return false; | 214 return false; |
| 215 } | 215 } |
| 216 | 216 |
| 217 *path = plugin_path; | 217 *path = plugin_path; |
| 218 flash_version->assign(plugin_version_str); | 218 flash_version->assign(plugin_version_str); |
| 219 return true; | 219 return true; |
| 220 } | 220 } |
| 221 | 221 |
| 222 } // namespace component_flash_hint_file | 222 } // namespace component_flash_hint_file |
| OLD | NEW |