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

Side by Side Diff: extensions/common/manifest_handlers/oauth2_manifest_handler.cc

Issue 1908953003: Convert //extensions/{common,shell} from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase? 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "extensions/common/manifest_handlers/oauth2_manifest_handler.h" 5 #include "extensions/common/manifest_handlers/oauth2_manifest_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory>
10
9 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
12 #include "base/values.h" 13 #include "base/values.h"
13 #include "extensions/common/error_utils.h" 14 #include "extensions/common/error_utils.h"
14 #include "extensions/common/manifest_constants.h" 15 #include "extensions/common/manifest_constants.h"
15 16
16 namespace { 17 namespace {
17 18
18 // Manifest keys. 19 // Manifest keys.
19 const char kClientId[] = "client_id"; 20 const char kClientId[] = "client_id";
20 const char kScopes[] = "scopes"; 21 const char kScopes[] = "scopes";
(...skipping 20 matching lines...) Expand all
41 } 42 }
42 43
43 OAuth2ManifestHandler::OAuth2ManifestHandler() { 44 OAuth2ManifestHandler::OAuth2ManifestHandler() {
44 } 45 }
45 46
46 OAuth2ManifestHandler::~OAuth2ManifestHandler() { 47 OAuth2ManifestHandler::~OAuth2ManifestHandler() {
47 } 48 }
48 49
49 bool OAuth2ManifestHandler::Parse(Extension* extension, 50 bool OAuth2ManifestHandler::Parse(Extension* extension,
50 base::string16* error) { 51 base::string16* error) {
51 scoped_ptr<OAuth2Info> info(new OAuth2Info); 52 std::unique_ptr<OAuth2Info> info(new OAuth2Info);
52 const base::DictionaryValue* dict = NULL; 53 const base::DictionaryValue* dict = NULL;
53 if (!extension->manifest()->GetDictionary(keys::kOAuth2, &dict)) { 54 if (!extension->manifest()->GetDictionary(keys::kOAuth2, &dict)) {
54 *error = base::ASCIIToUTF16(errors::kInvalidOAuth2ClientId); 55 *error = base::ASCIIToUTF16(errors::kInvalidOAuth2ClientId);
55 return false; 56 return false;
56 } 57 }
57 58
58 // HasPath checks for whether the manifest is allowed to have 59 // HasPath checks for whether the manifest is allowed to have
59 // oauth2.auto_approve based on whitelist, and if it is present. 60 // oauth2.auto_approve based on whitelist, and if it is present.
60 // GetBoolean reads the value of auto_approve directly from dict to prevent 61 // GetBoolean reads the value of auto_approve directly from dict to prevent
61 // duplicate checking. 62 // duplicate checking.
(...skipping 29 matching lines...) Expand all
91 92
92 extension->SetManifestData(keys::kOAuth2, info.release()); 93 extension->SetManifestData(keys::kOAuth2, info.release());
93 return true; 94 return true;
94 } 95 }
95 96
96 const std::vector<std::string> OAuth2ManifestHandler::Keys() const { 97 const std::vector<std::string> OAuth2ManifestHandler::Keys() const {
97 return SingleKey(keys::kOAuth2); 98 return SingleKey(keys::kOAuth2);
98 } 99 }
99 100
100 } // namespace extensions 101 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698