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

Side by Side Diff: chrome/common/extensions/api/sockets/sockets_manifest_handler.cc

Issue 51433002: Enable permission warnings from ManifestHandlers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address code review feedback. Created 7 years, 1 month 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
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/common/extensions/api/sockets/sockets_manifest_handler.h"
6
7 #include "chrome/common/extensions/api/sockets/sockets_manifest_data.h"
8 #include "chrome/common/extensions/api/sockets/sockets_manifest_permission.h"
9 #include "chrome/common/extensions/extension.h"
10 #include "extensions/common/manifest_constants.h"
11
12 namespace extensions {
13
14 SocketsManifestHandler::SocketsManifestHandler() {}
15
16 SocketsManifestHandler::~SocketsManifestHandler() {}
17
18 bool SocketsManifestHandler::Parse(Extension* extension, string16* error) {
19 const base::Value* sockets = NULL;
20 CHECK(extension->manifest()->Get(manifest_keys::kSockets, &sockets));
21 std::vector<InstallWarning> install_warnings;
22 scoped_ptr<SocketsManifestData> data =
23 SocketsManifestData::FromValue(*sockets,
24 &install_warnings,
25 error);
26 if (!data)
27 return false;
28
29 extension->AddInstallWarnings(install_warnings);
30 extension->SetManifestData(manifest_keys::kSockets, data.release());
31 return true;
32 }
33
34 ManifestPermission* SocketsManifestHandler::CreatePermission() {
35 return new SocketsManifestPermission();
36 }
37
38 ManifestPermission* SocketsManifestHandler::CreateInitialRequiredPermission(
39 const Extension* extension) {
40 SocketsManifestData* data = SocketsManifestData::Get(extension);
41 if (data) {
Yoyo Zhou 2013/11/14 00:26:55 nit: don't need braces here
42 return data->permission()->Clone();
43 }
44 return new SocketsManifestPermission();
45 }
46
47 const std::vector<std::string> SocketsManifestHandler::Keys() const {
48 return SingleKey(manifest_keys::kSockets);
49 }
50
51 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698