Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(640)

Side by Side Diff: chrome/common/extensions/manifest_handlers/copresence_manifest.cc

Issue 1880143002: Convert chrome/common to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <memory>
7 #include <string> 8 #include <string>
8 #include <vector> 9 #include <vector>
9 10
10 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
11 #include "base/values.h" 12 #include "base/values.h"
12 #include "extensions/common/manifest_constants.h" 13 #include "extensions/common/manifest_constants.h"
13 14
14 namespace extensions { 15 namespace extensions {
15 16
16 CopresenceManifestHandler::CopresenceManifestHandler() { 17 CopresenceManifestHandler::CopresenceManifestHandler() {
17 } 18 }
18 19
19 CopresenceManifestHandler::~CopresenceManifestHandler() { 20 CopresenceManifestHandler::~CopresenceManifestHandler() {
20 } 21 }
21 22
22 bool CopresenceManifestHandler::Parse(Extension* extension, 23 bool CopresenceManifestHandler::Parse(Extension* extension,
23 base::string16* error) { 24 base::string16* error) {
24 const base::DictionaryValue* copresence_config = nullptr; 25 const base::DictionaryValue* copresence_config = nullptr;
25 26
26 if (!extension->manifest()->GetDictionary(manifest_keys::kCopresence, 27 if (!extension->manifest()->GetDictionary(manifest_keys::kCopresence,
27 &copresence_config)) { 28 &copresence_config)) {
28 *error = base::ASCIIToUTF16(manifest_errors::kInvalidCopresenceConfig); 29 *error = base::ASCIIToUTF16(manifest_errors::kInvalidCopresenceConfig);
29 return false; 30 return false;
30 } 31 }
31 32
32 scoped_ptr<CopresenceManifestData> manifest_data(new CopresenceManifestData); 33 std::unique_ptr<CopresenceManifestData> manifest_data(
34 new CopresenceManifestData);
33 if (!copresence_config->GetString(manifest_values::kApiKey, 35 if (!copresence_config->GetString(manifest_values::kApiKey,
34 &manifest_data->api_key) || 36 &manifest_data->api_key) ||
35 manifest_data->api_key.empty()) { 37 manifest_data->api_key.empty()) {
36 *error = base::ASCIIToUTF16(manifest_errors::kInvalidCopresenceApiKey); 38 *error = base::ASCIIToUTF16(manifest_errors::kInvalidCopresenceApiKey);
37 return false; 39 return false;
38 } 40 }
39 41
40 extension->SetManifestData(manifest_keys::kCopresence, 42 extension->SetManifestData(manifest_keys::kCopresence,
41 manifest_data.release()); 43 manifest_data.release());
42 return true; 44 return true;
43 } 45 }
44 46
45 const std::vector<std::string> CopresenceManifestHandler::Keys() const { 47 const std::vector<std::string> CopresenceManifestHandler::Keys() const {
46 return SingleKey(manifest_keys::kCopresence); 48 return SingleKey(manifest_keys::kCopresence);
47 } 49 }
48 50
49 CopresenceManifestData::CopresenceManifestData() { 51 CopresenceManifestData::CopresenceManifestData() {
50 } 52 }
51 53
52 CopresenceManifestData::~CopresenceManifestData() { 54 CopresenceManifestData::~CopresenceManifestData() {
53 } 55 }
54 56
55 } // namespace extensions 57 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698