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

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

Issue 404883002: Allow extension APIs to be called from WebUI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: android compile Created 6 years, 5 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 | Annotate | Revision Log
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 "extensions/common/features/simple_feature.h" 5 #include "extensions/common/features/simple_feature.h"
6 6
7 #include <map> 7 #include <map>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 extension_types["legacy_packaged_app"] = Manifest::TYPE_LEGACY_PACKAGED_APP; 49 extension_types["legacy_packaged_app"] = Manifest::TYPE_LEGACY_PACKAGED_APP;
50 extension_types["hosted_app"] = Manifest::TYPE_HOSTED_APP; 50 extension_types["hosted_app"] = Manifest::TYPE_HOSTED_APP;
51 extension_types["platform_app"] = Manifest::TYPE_PLATFORM_APP; 51 extension_types["platform_app"] = Manifest::TYPE_PLATFORM_APP;
52 extension_types["shared_module"] = Manifest::TYPE_SHARED_MODULE; 52 extension_types["shared_module"] = Manifest::TYPE_SHARED_MODULE;
53 53
54 contexts["blessed_extension"] = Feature::BLESSED_EXTENSION_CONTEXT; 54 contexts["blessed_extension"] = Feature::BLESSED_EXTENSION_CONTEXT;
55 contexts["unblessed_extension"] = Feature::UNBLESSED_EXTENSION_CONTEXT; 55 contexts["unblessed_extension"] = Feature::UNBLESSED_EXTENSION_CONTEXT;
56 contexts["content_script"] = Feature::CONTENT_SCRIPT_CONTEXT; 56 contexts["content_script"] = Feature::CONTENT_SCRIPT_CONTEXT;
57 contexts["web_page"] = Feature::WEB_PAGE_CONTEXT; 57 contexts["web_page"] = Feature::WEB_PAGE_CONTEXT;
58 contexts["blessed_web_page"] = Feature::BLESSED_WEB_PAGE_CONTEXT; 58 contexts["blessed_web_page"] = Feature::BLESSED_WEB_PAGE_CONTEXT;
59 contexts["webui"] = Feature::WEBUI_CONTEXT;
59 60
60 locations["component"] = SimpleFeature::COMPONENT_LOCATION; 61 locations["component"] = SimpleFeature::COMPONENT_LOCATION;
61 locations["policy"] = SimpleFeature::POLICY_LOCATION; 62 locations["policy"] = SimpleFeature::POLICY_LOCATION;
62 63
63 platforms["chromeos"] = Feature::CHROMEOS_PLATFORM; 64 platforms["chromeos"] = Feature::CHROMEOS_PLATFORM;
64 platforms["linux"] = Feature::LINUX_PLATFORM; 65 platforms["linux"] = Feature::LINUX_PLATFORM;
65 platforms["mac"] = Feature::MACOSX_PLATFORM; 66 platforms["mac"] = Feature::MACOSX_PLATFORM;
66 platforms["win"] = Feature::WIN_PLATFORM; 67 platforms["win"] = Feature::WIN_PLATFORM;
67 } 68 }
68 69
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 case Feature::UNBLESSED_EXTENSION_CONTEXT: 206 case Feature::UNBLESSED_EXTENSION_CONTEXT:
206 // "iframe" is a bit of a lie/oversimplification, but that's the most 207 // "iframe" is a bit of a lie/oversimplification, but that's the most
207 // common unblessed context. 208 // common unblessed context.
208 return "extension iframe"; 209 return "extension iframe";
209 case Feature::CONTENT_SCRIPT_CONTEXT: 210 case Feature::CONTENT_SCRIPT_CONTEXT:
210 return "content script"; 211 return "content script";
211 case Feature::WEB_PAGE_CONTEXT: 212 case Feature::WEB_PAGE_CONTEXT:
212 return "web page"; 213 return "web page";
213 case Feature::BLESSED_WEB_PAGE_CONTEXT: 214 case Feature::BLESSED_WEB_PAGE_CONTEXT:
214 return "hosted app"; 215 return "hosted app";
216 case Feature::WEBUI_CONTEXT:
217 return "webui";
215 } 218 }
216 NOTREACHED(); 219 NOTREACHED();
217 return ""; 220 return "";
218 } 221 }
219 222
220 // Gets a human-readable list of the display names (pluralized, comma separated 223 // Gets a human-readable list of the display names (pluralized, comma separated
221 // with the "and" in the correct place) for each of |enum_types|. 224 // with the "and" in the correct place) for each of |enum_types|.
222 template <typename EnumType> 225 template <typename EnumType>
223 std::string ListDisplayNames(const std::vector<EnumType> enum_types) { 226 std::string ListDisplayNames(const std::vector<EnumType> enum_types) {
224 std::string display_name_list; 227 std::string display_name_list;
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 if (!dependency) 567 if (!dependency)
565 return CreateAvailability(NOT_PRESENT); 568 return CreateAvailability(NOT_PRESENT);
566 Availability dependency_availability = checker.Run(dependency); 569 Availability dependency_availability = checker.Run(dependency);
567 if (!dependency_availability.is_available()) 570 if (!dependency_availability.is_available())
568 return dependency_availability; 571 return dependency_availability;
569 } 572 }
570 return CreateAvailability(IS_AVAILABLE); 573 return CreateAvailability(IS_AVAILABLE);
571 } 574 }
572 575
573 } // namespace extensions 576 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/features/feature.h ('k') | extensions/common/features/simple_feature_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698