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

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

Issue 151893002: Reorganize apps/shell into app, browser and common directories (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase (subdirs) Created 6 years, 10 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
« no previous file with comments | « apps/shell/shell_extensions_client.h ('k') | apps/shell/shell_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "apps/shell/shell_extensions_client.h"
6
7 #include "base/logging.h"
8 #include "chrome/common/extensions/features/base_feature_provider.h"
9 #include "chrome/common/extensions/permissions/chrome_api_permissions.h"
10 #include "extensions/common/common_manifest_handlers.h"
11 #include "extensions/common/manifest_handler.h"
12 #include "extensions/common/permissions/permission_message_provider.h"
13 #include "extensions/common/permissions/permissions_provider.h"
14 #include "extensions/common/url_pattern_set.h"
15
16 using extensions::APIPermissionInfo;
17 using extensions::APIPermissionSet;
18 using extensions::Extension;
19 using extensions::Manifest;
20 using extensions::PermissionMessage;
21 using extensions::PermissionMessages;
22 using extensions::PermissionSet;
23 using extensions::URLPatternSet;
24
25 namespace apps {
26
27 namespace {
28
29 // TODO(jamescook): Refactor ChromePermissionsMessageProvider so we can share
30 // code.
31 class ShellPermissionMessageProvider
32 : public extensions::PermissionMessageProvider {
33 public:
34 ShellPermissionMessageProvider() {}
35 virtual ~ShellPermissionMessageProvider() {}
36
37 // PermissionMessageProvider implementation.
38 virtual PermissionMessages GetPermissionMessages(
39 const PermissionSet* permissions,
40 Manifest::Type extension_type) const OVERRIDE {
41 return PermissionMessages();
42 }
43
44 virtual std::vector<base::string16> GetWarningMessages(
45 const PermissionSet* permissions,
46 Manifest::Type extension_type) const OVERRIDE {
47 return std::vector<base::string16>();
48 }
49
50 virtual std::vector<base::string16> GetWarningMessagesDetails(
51 const PermissionSet* permissions,
52 Manifest::Type extension_type) const OVERRIDE {
53 return std::vector<base::string16>();
54 }
55
56 virtual bool IsPrivilegeIncrease(
57 const PermissionSet* old_permissions,
58 const PermissionSet* new_permissions,
59 Manifest::Type extension_type) const OVERRIDE {
60 // Ensure we implement this before shipping.
61 CHECK(false);
62 return false;
63 }
64
65 private:
66 DISALLOW_COPY_AND_ASSIGN(ShellPermissionMessageProvider);
67 };
68
69 } // namespace
70
71 ShellExtensionsClient::ShellExtensionsClient() {
72 }
73
74 ShellExtensionsClient::~ShellExtensionsClient() {
75 }
76
77 void ShellExtensionsClient::Initialize() {
78 extensions::RegisterCommonManifestHandlers();
79 extensions::ManifestHandler::FinalizeRegistration();
80
81 // TODO(jamescook): Do we need to whitelist any extensions?
82 }
83
84 const extensions::PermissionsProvider&
85 ShellExtensionsClient::GetPermissionsProvider() const {
86 // TODO(jamescook): app_shell needs a way to use a subset of the Chrome
87 // extension Features and Permissions. In particular, the lists of Features
88 // (including API features, manifest features and permission features) are
89 // listed in JSON files from c/c/e/api that are included into Chrome's
90 // resources.pak (_api_features.json and _permission_features.json). The
91 // PermissionsProvider must match the set of permissions used by the features
92 // in those files. We either need to make app_shell (and hence the extensions
93 // module) know about all possible permissions, or create a mechanism whereby
94 // we can build our own JSON files with only a subset of the data. For now,
95 // just provide all permissions Chrome knows about. Fixing this issue is
96 // http://crbug.com/339301
97 static extensions::ChromeAPIPermissions provider;
98 return provider;
99 }
100
101 const extensions::PermissionMessageProvider&
102 ShellExtensionsClient::GetPermissionMessageProvider() const {
103 NOTIMPLEMENTED();
104 static ShellPermissionMessageProvider provider;
105 return provider;
106 }
107
108 extensions::FeatureProvider* ShellExtensionsClient::GetFeatureProviderByName(
109 const std::string& name) const {
110 // TODO(jamescook): Factor out an extensions module feature provider.
111 return extensions::BaseFeatureProvider::GetByName(name);
112 }
113
114 void ShellExtensionsClient::FilterHostPermissions(
115 const URLPatternSet& hosts,
116 URLPatternSet* new_hosts,
117 std::set<PermissionMessage>* messages) const {
118 NOTIMPLEMENTED();
119 }
120
121 void ShellExtensionsClient::SetScriptingWhitelist(
122 const ScriptingWhitelist& whitelist) {
123 scripting_whitelist_ = whitelist;
124 }
125
126 const extensions::ExtensionsClient::ScriptingWhitelist&
127 ShellExtensionsClient::GetScriptingWhitelist() const {
128 // TODO(jamescook): Real whitelist.
129 return scripting_whitelist_;
130 }
131
132 URLPatternSet ShellExtensionsClient::GetPermittedChromeSchemeHosts(
133 const Extension* extension,
134 const APIPermissionSet& api_permissions) const {
135 NOTIMPLEMENTED();
136 return URLPatternSet();
137 }
138
139 bool ShellExtensionsClient::IsScriptableURL(const GURL& url,
140 std::string* error) const {
141 NOTIMPLEMENTED();
142 return true;
143 }
144
145 } // namespace apps
OLDNEW
« no previous file with comments | « apps/shell/shell_extensions_client.h ('k') | apps/shell/shell_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698