| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/extensions/manifest_handlers/copresence_manifest.h" | 5 #include "chrome/common/extensions/manifest_handlers/copresence_manifest.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 base::string16* error) { | 23 base::string16* error) { |
| 24 const base::DictionaryValue* copresence_config = nullptr; | 24 const base::DictionaryValue* copresence_config = nullptr; |
| 25 | 25 |
| 26 if (!extension->manifest()->GetDictionary(manifest_keys::kCopresence, | 26 if (!extension->manifest()->GetDictionary(manifest_keys::kCopresence, |
| 27 &copresence_config)) { | 27 &copresence_config)) { |
| 28 *error = base::ASCIIToUTF16(manifest_errors::kInvalidCopresenceConfig); | 28 *error = base::ASCIIToUTF16(manifest_errors::kInvalidCopresenceConfig); |
| 29 return false; | 29 return false; |
| 30 } | 30 } |
| 31 | 31 |
| 32 scoped_ptr<CopresenceManifestData> manifest_data(new CopresenceManifestData); | 32 scoped_ptr<CopresenceManifestData> manifest_data(new CopresenceManifestData); |
| 33 if (!copresence_config->GetString(manifest_values::kProjectId, | 33 if (!copresence_config->GetString(manifest_values::kApiKey, |
| 34 &manifest_data->project_id) || | 34 &manifest_data->api_key) || |
| 35 manifest_data->project_id.empty()) { | 35 manifest_data->api_key.empty()) { |
| 36 *error = base::ASCIIToUTF16(manifest_errors::kInvalidCopresenceProjectId); | 36 *error = base::ASCIIToUTF16(manifest_errors::kInvalidCopresenceApiKey); |
| 37 return false; | 37 return false; |
| 38 } | 38 } |
| 39 | 39 |
| 40 extension->SetManifestData(manifest_keys::kCopresence, | 40 extension->SetManifestData(manifest_keys::kCopresence, |
| 41 manifest_data.release()); | 41 manifest_data.release()); |
| 42 return true; | 42 return true; |
| 43 } | 43 } |
| 44 | 44 |
| 45 const std::vector<std::string> CopresenceManifestHandler::Keys() const { | 45 const std::vector<std::string> CopresenceManifestHandler::Keys() const { |
| 46 return SingleKey(manifest_keys::kCopresence); | 46 return SingleKey(manifest_keys::kCopresence); |
| 47 } | 47 } |
| 48 | 48 |
| 49 CopresenceManifestData::CopresenceManifestData() { | 49 CopresenceManifestData::CopresenceManifestData() { |
| 50 } | 50 } |
| 51 | 51 |
| 52 CopresenceManifestData::~CopresenceManifestData() { | 52 CopresenceManifestData::~CopresenceManifestData() { |
| 53 } | 53 } |
| 54 | 54 |
| 55 } // namespace extensions | 55 } // namespace extensions |
| OLD | NEW |