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

Side by Side Diff: extensions/common/manifest_handler.cc

Issue 2846553003: Extensions: Clarify ManifestHandler interface expectations. (Closed)
Patch Set: Created 3 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_handler.h" 5 #include "extensions/common/manifest_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/stl_util.h" 12 #include "base/stl_util.h"
13 #include "base/threading/thread_restrictions.h"
13 #include "extensions/common/extension.h" 14 #include "extensions/common/extension.h"
14 #include "extensions/common/permissions/manifest_permission.h" 15 #include "extensions/common/permissions/manifest_permission.h"
15 #include "extensions/common/permissions/manifest_permission_set.h" 16 #include "extensions/common/permissions/manifest_permission_set.h"
16 17
17 namespace extensions { 18 namespace extensions {
18 19
19 namespace { 20 namespace {
20 21
21 static base::LazyInstance<ManifestHandlerRegistry>::DestructorAtExit 22 static base::LazyInstance<ManifestHandlerRegistry>::DestructorAtExit
22 g_registry = LAZY_INSTANCE_INITIALIZER; 23 g_registry = LAZY_INSTANCE_INITIALIZER;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // static 84 // static
84 bool ManifestHandler::ParseExtension(Extension* extension, 85 bool ManifestHandler::ParseExtension(Extension* extension,
85 base::string16* error) { 86 base::string16* error) {
86 return GetRegistry()->ParseExtension(extension, error); 87 return GetRegistry()->ParseExtension(extension, error);
87 } 88 }
88 89
89 // static 90 // static
90 bool ManifestHandler::ValidateExtension(const Extension* extension, 91 bool ManifestHandler::ValidateExtension(const Extension* extension,
91 std::string* error, 92 std::string* error,
92 std::vector<InstallWarning>* warnings) { 93 std::vector<InstallWarning>* warnings) {
94 base::ThreadRestrictions::AssertIOAllowed();
lazyboy 2017/04/26 22:06:53 Can we put the IO comment for this function too in
karandeepb 2017/04/26 22:19:59 Done.
93 return GetRegistry()->ValidateExtension(extension, error, warnings); 95 return GetRegistry()->ValidateExtension(extension, error, warnings);
94 } 96 }
95 97
96 // static 98 // static
97 ManifestPermission* ManifestHandler::CreatePermission(const std::string& name) { 99 ManifestPermission* ManifestHandler::CreatePermission(const std::string& name) {
98 return GetRegistry()->CreatePermission(name); 100 return GetRegistry()->CreatePermission(name);
99 } 101 }
100 102
101 // static 103 // static
102 void ManifestHandler::AddExtensionInitialRequiredPermissions( 104 void ManifestHandler::AddExtensionInitialRequiredPermissions(
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 unsorted_handlers.swap(next_unsorted_handlers); 245 unsorted_handlers.swap(next_unsorted_handlers);
244 } 246 }
245 247
246 // If there are any leftover unsorted handlers, they must have had 248 // If there are any leftover unsorted handlers, they must have had
247 // circular dependencies. 249 // circular dependencies.
248 CHECK_EQ(unsorted_handlers.size(), std::set<ManifestHandler*>::size_type(0)) 250 CHECK_EQ(unsorted_handlers.size(), std::set<ManifestHandler*>::size_type(0))
249 << "Extension manifest handlers have circular dependencies!"; 251 << "Extension manifest handlers have circular dependencies!";
250 } 252 }
251 253
252 } // namespace extensions 254 } // namespace extensions
OLDNEW
« extensions/common/manifest_handler.h ('K') | « extensions/common/manifest_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698