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

Side by Side Diff: chrome/common/extensions/features/simple_feature.cc

Issue 13971005: Basic multi-module support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix copyright for presubmit Created 7 years, 7 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/features/simple_feature.h" 5 #include "chrome/common/extensions/features/simple_feature.h"
6 6
7 #include <map> 7 #include <map>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 10 matching lines...) Expand all
21 21
22 namespace { 22 namespace {
23 23
24 struct Mappings { 24 struct Mappings {
25 Mappings() { 25 Mappings() {
26 extension_types["extension"] = Manifest::TYPE_EXTENSION; 26 extension_types["extension"] = Manifest::TYPE_EXTENSION;
27 extension_types["theme"] = Manifest::TYPE_THEME; 27 extension_types["theme"] = Manifest::TYPE_THEME;
28 extension_types["packaged_app"] = Manifest::TYPE_LEGACY_PACKAGED_APP; 28 extension_types["packaged_app"] = Manifest::TYPE_LEGACY_PACKAGED_APP;
29 extension_types["hosted_app"] = Manifest::TYPE_HOSTED_APP; 29 extension_types["hosted_app"] = Manifest::TYPE_HOSTED_APP;
30 extension_types["platform_app"] = Manifest::TYPE_PLATFORM_APP; 30 extension_types["platform_app"] = Manifest::TYPE_PLATFORM_APP;
31 extension_types["shared_module"] = Manifest::TYPE_SHARED_MODULE;
31 32
32 contexts["blessed_extension"] = Feature::BLESSED_EXTENSION_CONTEXT; 33 contexts["blessed_extension"] = Feature::BLESSED_EXTENSION_CONTEXT;
33 contexts["unblessed_extension"] = Feature::UNBLESSED_EXTENSION_CONTEXT; 34 contexts["unblessed_extension"] = Feature::UNBLESSED_EXTENSION_CONTEXT;
34 contexts["content_script"] = Feature::CONTENT_SCRIPT_CONTEXT; 35 contexts["content_script"] = Feature::CONTENT_SCRIPT_CONTEXT;
35 contexts["web_page"] = Feature::WEB_PAGE_CONTEXT; 36 contexts["web_page"] = Feature::WEB_PAGE_CONTEXT;
36 37
37 locations["component"] = Feature::COMPONENT_LOCATION; 38 locations["component"] = Feature::COMPONENT_LOCATION;
38 39
39 platforms["chromeos"] = Feature::CHROMEOS_PLATFORM; 40 platforms["chromeos"] = Feature::CHROMEOS_PLATFORM;
40 41
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 case Manifest::TYPE_HOSTED_APP: 159 case Manifest::TYPE_HOSTED_APP:
159 return "hosted app"; 160 return "hosted app";
160 case Manifest::TYPE_LEGACY_PACKAGED_APP: 161 case Manifest::TYPE_LEGACY_PACKAGED_APP:
161 return "legacy packaged app"; 162 return "legacy packaged app";
162 case Manifest::TYPE_PLATFORM_APP: 163 case Manifest::TYPE_PLATFORM_APP:
163 return "packaged app"; 164 return "packaged app";
164 case Manifest::TYPE_THEME: 165 case Manifest::TYPE_THEME:
165 return "theme"; 166 return "theme";
166 case Manifest::TYPE_USER_SCRIPT: 167 case Manifest::TYPE_USER_SCRIPT:
167 return "user script"; 168 return "user script";
169 case Manifest::TYPE_SHARED_MODULE:
170 return "shared module";
168 } 171 }
169 172
170 NOTREACHED(); 173 NOTREACHED();
171 return std::string(); 174 return std::string();
172 } 175 }
173 176
174 std::string HashExtensionId(const std::string& extension_id) { 177 std::string HashExtensionId(const std::string& extension_id) {
175 const std::string id_hash = base::SHA1HashString(extension_id); 178 const std::string id_hash = base::SHA1HashString(extension_id);
176 DCHECK(id_hash.length() == base::kSHA1Length); 179 DCHECK(id_hash.length() == base::kSHA1Length);
177 return base::HexEncode(id_hash.c_str(), id_hash.length()); 180 return base::HexEncode(id_hash.c_str(), id_hash.length());
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 return false; 429 return false;
427 430
428 if (whitelist_.find(extension_id) != whitelist_.end() || 431 if (whitelist_.find(extension_id) != whitelist_.end() ||
429 whitelist_.find(HashExtensionId(extension_id)) != whitelist_.end()) 432 whitelist_.find(HashExtensionId(extension_id)) != whitelist_.end())
430 return true; 433 return true;
431 434
432 return false; 435 return false;
433 } 436 }
434 437
435 } // namespace extensions 438 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698