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

Side by Side Diff: chrome/common/extensions/chrome_extensions_client.cc

Issue 101203008: Allow app_shell to run past extension manifest parsing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup register_manifest Created 6 years, 11 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 "chrome/common/extensions/chrome_extensions_client.h" 5 #include "chrome/common/extensions/chrome_extensions_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/common/extensions/chrome_manifest_handlers.h" 8 #include "chrome/common/extensions/chrome_manifest_handlers.h"
9 #include "chrome/common/extensions/extension_constants.h" 9 #include "chrome/common/extensions/extension_constants.h"
10 #include "chrome/common/extensions/features/base_feature_provider.h" 10 #include "chrome/common/extensions/features/base_feature_provider.h"
11 #include "chrome/common/url_constants.h" 11 #include "chrome/common/url_constants.h"
12 #include "content/public/common/url_constants.h" 12 #include "content/public/common/url_constants.h"
13 #include "extensions/common/common_manifest_handlers.h"
13 #include "extensions/common/extension.h" 14 #include "extensions/common/extension.h"
14 #include "extensions/common/manifest_constants.h" 15 #include "extensions/common/manifest_constants.h"
16 #include "extensions/common/manifest_handler.h"
15 #include "extensions/common/permissions/api_permission_set.h" 17 #include "extensions/common/permissions/api_permission_set.h"
16 #include "extensions/common/permissions/permission_message.h" 18 #include "extensions/common/permissions/permission_message.h"
17 #include "extensions/common/switches.h" 19 #include "extensions/common/switches.h"
18 #include "extensions/common/url_pattern.h" 20 #include "extensions/common/url_pattern.h"
19 #include "extensions/common/url_pattern_set.h" 21 #include "extensions/common/url_pattern_set.h"
20 #include "grit/generated_resources.h" 22 #include "grit/generated_resources.h"
21 #include "ui/base/l10n/l10n_util.h" 23 #include "ui/base/l10n/l10n_util.h"
22 #include "url/gurl.h" 24 #include "url/gurl.h"
23 25
24 namespace { 26 namespace {
25 const char kThumbsWhiteListedExtension[] = "khopmbdjffemhegeeobelklnbglcdgfh"; 27 const char kThumbsWhiteListedExtension[] = "khopmbdjffemhegeeobelklnbglcdgfh";
26 } // namespace 28 } // namespace
27 29
28 namespace extensions { 30 namespace extensions {
29 31
30 static base::LazyInstance<ChromeExtensionsClient> g_client = 32 static base::LazyInstance<ChromeExtensionsClient> g_client =
31 LAZY_INSTANCE_INITIALIZER; 33 LAZY_INSTANCE_INITIALIZER;
32 34
33 ChromeExtensionsClient::ChromeExtensionsClient() 35 ChromeExtensionsClient::ChromeExtensionsClient()
34 : chrome_api_permissions_(ChromeAPIPermissions()) { 36 : chrome_api_permissions_(ChromeAPIPermissions()) {
35 } 37 }
36 38
37 ChromeExtensionsClient::~ChromeExtensionsClient() { 39 ChromeExtensionsClient::~ChromeExtensionsClient() {
38 } 40 }
39 41
40 void ChromeExtensionsClient::Initialize() { 42 void ChromeExtensionsClient::Initialize() {
41 RegisterChromeManifestHandlers(); 43 // Registration could already be finalized in unit tests, where the utility
44 // thread runs in-process.
45 if (!ManifestHandler::IsRegistrationFinalized()) {
46 RegisterCommonManifestHandlers();
47 RegisterChromeManifestHandlers();
48 ManifestHandler::FinalizeRegistration();
49 }
42 50
43 // Set up the scripting whitelist. 51 // Set up the scripting whitelist.
44 // Whitelist ChromeVox, an accessibility extension from Google that needs 52 // Whitelist ChromeVox, an accessibility extension from Google that needs
45 // the ability to script webui pages. This is temporary and is not 53 // the ability to script webui pages. This is temporary and is not
46 // meant to be a general solution. 54 // meant to be a general solution.
47 // TODO(dmazzoni): remove this once we have an extension API that 55 // TODO(dmazzoni): remove this once we have an extension API that
48 // allows any extension to request read-only access to webui pages. 56 // allows any extension to request read-only access to webui pages.
49 scripting_whitelist_.push_back(extension_misc::kChromeVoxExtensionId); 57 scripting_whitelist_.push_back(extension_misc::kChromeVoxExtensionId);
50 58
51 // Whitelist "Discover DevTools Companion" extension from Google that 59 // Whitelist "Discover DevTools Companion" extension from Google that
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 } 153 }
146 return true; 154 return true;
147 } 155 }
148 156
149 // static 157 // static
150 ChromeExtensionsClient* ChromeExtensionsClient::GetInstance() { 158 ChromeExtensionsClient* ChromeExtensionsClient::GetInstance() {
151 return g_client.Pointer(); 159 return g_client.Pointer();
152 } 160 }
153 161
154 } // namespace extensions 162 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_web_contents_observer.cc ('k') | chrome/common/extensions/chrome_manifest_handlers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698