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

Side by Side Diff: apps/shell/common/shell_extensions_client.cc

Issue 293943002: Clean up TestFeaturesNativeHandler to use the ExtensionsClient's JSON feature sources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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 "apps/shell/common/shell_extensions_client.h" 5 #include "apps/shell/common/shell_extensions_client.h"
6 6
7 #include "apps/shell/common/api/generated_schemas.h" 7 #include "apps/shell/common/api/generated_schemas.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "extensions/common/api/generated_schemas.h" 10 #include "extensions/common/api/generated_schemas.h"
(...skipping 11 matching lines...) Expand all
22 #include "extensions/common/permissions/permissions_provider.h" 22 #include "extensions/common/permissions/permissions_provider.h"
23 #include "extensions/common/url_pattern_set.h" 23 #include "extensions/common/url_pattern_set.h"
24 #include "grit/app_shell_resources.h" 24 #include "grit/app_shell_resources.h"
25 #include "grit/extensions_resources.h" 25 #include "grit/extensions_resources.h"
26 26
27 using extensions::APIPermissionInfo; 27 using extensions::APIPermissionInfo;
28 using extensions::APIPermissionSet; 28 using extensions::APIPermissionSet;
29 using extensions::BaseFeatureProvider; 29 using extensions::BaseFeatureProvider;
30 using extensions::Extension; 30 using extensions::Extension;
31 using extensions::FeatureProvider; 31 using extensions::FeatureProvider;
32 using extensions::JSONFeatureProviderSource;
32 using extensions::Manifest; 33 using extensions::Manifest;
33 using extensions::PermissionMessage; 34 using extensions::PermissionMessage;
34 using extensions::PermissionMessages; 35 using extensions::PermissionMessages;
35 using extensions::PermissionSet; 36 using extensions::PermissionSet;
36 using extensions::URLPatternSet; 37 using extensions::URLPatternSet;
37 38
38 namespace apps { 39 namespace apps {
39 40
40 namespace { 41 namespace {
41 42
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } 113 }
113 114
114 const extensions::PermissionMessageProvider& 115 const extensions::PermissionMessageProvider&
115 ShellExtensionsClient::GetPermissionMessageProvider() const { 116 ShellExtensionsClient::GetPermissionMessageProvider() const {
116 NOTIMPLEMENTED(); 117 NOTIMPLEMENTED();
117 return g_permission_message_provider.Get(); 118 return g_permission_message_provider.Get();
118 } 119 }
119 120
120 scoped_ptr<FeatureProvider> ShellExtensionsClient::CreateFeatureProvider( 121 scoped_ptr<FeatureProvider> ShellExtensionsClient::CreateFeatureProvider(
121 const std::string& name) const { 122 const std::string& name) const {
122 extensions::JSONFeatureProviderSource source(name); 123 scoped_ptr<FeatureProvider> provider;
124 scoped_ptr<JSONFeatureProviderSource> source(
125 CreateFeatureProviderSource(name));
123 if (name == "api") { 126 if (name == "api") {
124 source.LoadJSON(IDR_EXTENSION_API_FEATURES); 127 provider.reset(new BaseFeatureProvider(
125 source.LoadJSON(IDR_SHELL_EXTENSION_API_FEATURES); 128 source->dictionary(), CreateFeature<extensions::APIFeature>));
126 return scoped_ptr<FeatureProvider>(new BaseFeatureProvider(
127 source.dictionary(), CreateFeature<extensions::APIFeature>));
128 } else if (name == "manifest") { 129 } else if (name == "manifest") {
129 source.LoadJSON(IDR_EXTENSION_MANIFEST_FEATURES); 130 provider.reset(new BaseFeatureProvider(
130 return scoped_ptr<FeatureProvider>(new BaseFeatureProvider( 131 source->dictionary(), CreateFeature<extensions::ManifestFeature>));
131 source.dictionary(), CreateFeature<extensions::ManifestFeature>));
132 } else if (name == "permission") { 132 } else if (name == "permission") {
133 source.LoadJSON(IDR_EXTENSION_PERMISSION_FEATURES); 133 provider.reset(new BaseFeatureProvider(
134 return scoped_ptr<FeatureProvider>(new BaseFeatureProvider( 134 source->dictionary(), CreateFeature<extensions::PermissionFeature>));
135 source.dictionary(), CreateFeature<extensions::PermissionFeature>));
136 } else { 135 } else {
137 NOTREACHED(); 136 NOTREACHED();
138 } 137 }
139 return scoped_ptr<FeatureProvider>(); 138 return provider.Pass();
139 }
140
141 scoped_ptr<JSONFeatureProviderSource>
142 ShellExtensionsClient::CreateFeatureProviderSource(
143 const std::string& name) const {
144 scoped_ptr<JSONFeatureProviderSource> source(
145 new JSONFeatureProviderSource(name));
146 if (name == "api") {
147 source->LoadJSON(IDR_EXTENSION_API_FEATURES);
148 source->LoadJSON(IDR_SHELL_EXTENSION_API_FEATURES);
149 } else if (name == "manifest") {
150 source->LoadJSON(IDR_EXTENSION_MANIFEST_FEATURES);
151 } else if (name == "permission") {
152 source->LoadJSON(IDR_EXTENSION_PERMISSION_FEATURES);
153 } else {
154 NOTREACHED();
155 source.reset();
156 }
157 return source.Pass();
140 } 158 }
141 159
142 void ShellExtensionsClient::FilterHostPermissions( 160 void ShellExtensionsClient::FilterHostPermissions(
143 const URLPatternSet& hosts, 161 const URLPatternSet& hosts,
144 URLPatternSet* new_hosts, 162 URLPatternSet* new_hosts,
145 std::set<PermissionMessage>* messages) const { 163 std::set<PermissionMessage>* messages) const {
146 NOTIMPLEMENTED(); 164 NOTIMPLEMENTED();
147 } 165 }
148 166
149 void ShellExtensionsClient::SetScriptingWhitelist( 167 void ShellExtensionsClient::SetScriptingWhitelist(
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 // Schema for chrome.shell APIs. 203 // Schema for chrome.shell APIs.
186 if (apps::shell_api::GeneratedSchemas::IsGenerated(name)) 204 if (apps::shell_api::GeneratedSchemas::IsGenerated(name))
187 return apps::shell_api::GeneratedSchemas::Get(name); 205 return apps::shell_api::GeneratedSchemas::Get(name);
188 206
189 return extensions::core_api::GeneratedSchemas::Get(name); 207 return extensions::core_api::GeneratedSchemas::Get(name);
190 } 208 }
191 209
192 bool ShellExtensionsClient::ShouldSuppressFatalErrors() const { return true; } 210 bool ShellExtensionsClient::ShouldSuppressFatalErrors() const { return true; }
193 211
194 } // namespace apps 212 } // namespace apps
OLDNEW
« no previous file with comments | « apps/shell/common/shell_extensions_client.h ('k') | chrome/browser/bookmarks/enhanced_bookmarks_features.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698