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

Side by Side Diff: chrome/utility/chrome_content_utility_client.cc

Issue 14694010: Consolidate manifest handler registration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « chrome/test/base/chrome_test_suite.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/utility/chrome_content_utility_client.h" 5 #include "chrome/utility/chrome_content_utility_client.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/json/json_reader.h" 11 #include "base/json/json_reader.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/message_loop_proxy.h" 13 #include "base/message_loop_proxy.h"
14 #include "base/threading/thread.h" 14 #include "base/threading/thread.h"
15 #include "chrome/browser/importer/importer.h" 15 #include "chrome/browser/importer/importer.h"
16 #include "chrome/browser/importer/profile_import_process_messages.h" 16 #include "chrome/browser/importer/profile_import_process_messages.h"
17 #include "chrome/common/child_process_logging.h" 17 #include "chrome/common/child_process_logging.h"
18 #include "chrome/common/chrome_paths.h" 18 #include "chrome/common/chrome_paths.h"
19 #include "chrome/common/chrome_utility_messages.h" 19 #include "chrome/common/chrome_utility_messages.h"
20 #include "chrome/common/extensions/api/extension_action/browser_action_handler.h " 20 #include "chrome/common/extensions/chrome_manifest_handlers.h"
21 #include "chrome/common/extensions/api/extension_action/page_action_handler.h"
22 #include "chrome/common/extensions/api/i18n/default_locale_handler.h"
23 #include "chrome/common/extensions/api/plugins/plugins_handler.h"
24 #include "chrome/common/extensions/background_info.h"
25 #include "chrome/common/extensions/extension.h" 21 #include "chrome/common/extensions/extension.h"
26 #include "chrome/common/extensions/extension_l10n_util.h" 22 #include "chrome/common/extensions/extension_l10n_util.h"
27 #include "chrome/common/extensions/incognito_handler.h"
28 #include "chrome/common/extensions/manifest.h" 23 #include "chrome/common/extensions/manifest.h"
29 #include "chrome/common/extensions/manifest_handlers/icons_handler.h"
30 #include "chrome/common/extensions/manifest_handlers/theme_handler.h"
31 #include "chrome/common/extensions/permissions/chrome_api_permissions.h" 24 #include "chrome/common/extensions/permissions/chrome_api_permissions.h"
32 #include "chrome/common/extensions/unpacker.h" 25 #include "chrome/common/extensions/unpacker.h"
33 #include "chrome/common/extensions/update_manifest.h" 26 #include "chrome/common/extensions/update_manifest.h"
34 #include "chrome/common/safe_browsing/zip_analyzer.h" 27 #include "chrome/common/safe_browsing/zip_analyzer.h"
35 #include "chrome/common/web_resource/web_resource_unpacker.h" 28 #include "chrome/common/web_resource/web_resource_unpacker.h"
36 #include "chrome/utility/profile_import_handler.h" 29 #include "chrome/utility/profile_import_handler.h"
37 #include "components/zip/zip.h" 30 #include "components/zip/zip.h"
38 #include "content/public/utility/utility_thread.h" 31 #include "content/public/utility/utility_thread.h"
39 #include "printing/backend/print_backend.h" 32 #include "printing/backend/print_backend.h"
40 #include "printing/page_range.h" 33 #include "printing/page_range.h"
41 #include "third_party/skia/include/core/SkBitmap.h" 34 #include "third_party/skia/include/core/SkBitmap.h"
42 #include "ui/base/ui_base_switches.h" 35 #include "ui/base/ui_base_switches.h"
43 #include "ui/gfx/codec/jpeg_codec.h" 36 #include "ui/gfx/codec/jpeg_codec.h"
44 #include "ui/gfx/rect.h" 37 #include "ui/gfx/rect.h"
45 #include "webkit/glue/image_decoder.h" 38 #include "webkit/glue/image_decoder.h"
46 39
47 #if defined(OS_WIN) 40 #if defined(OS_WIN)
48 #include "base/path_service.h" 41 #include "base/path_service.h"
49 #include "base/win/iat_patch_function.h" 42 #include "base/win/iat_patch_function.h"
50 #include "base/win/scoped_handle.h" 43 #include "base/win/scoped_handle.h"
51 #include "content/public/common/content_switches.h" 44 #include "content/public/common/content_switches.h"
52 #include "printing/emf_win.h" 45 #include "printing/emf_win.h"
53 #include "ui/gfx/gdi_util.h" 46 #include "ui/gfx/gdi_util.h"
54 #endif // defined(OS_WIN) 47 #endif // defined(OS_WIN)
55 48
56 namespace {
57
58 // Explicitly register all ManifestHandlers needed in the utility process.
59 void RegisterExtensionManifestHandlers() {
60 (new extensions::BackgroundManifestHandler)->Register();
61 (new extensions::BrowserActionHandler)->Register();
62 (new extensions::DefaultLocaleHandler)->Register();
63 (new extensions::IconsHandler)->Register();
64 (new extensions::IncognitoHandler)->Register();
65 (new extensions::PageActionHandler)->Register();
66 (new extensions::PluginsHandler)->Register();
67 (new extensions::ThemeHandler)->Register();
68 }
69
70 } // namespace
71
72 namespace chrome { 49 namespace chrome {
73 50
74 ChromeContentUtilityClient::ChromeContentUtilityClient() { 51 ChromeContentUtilityClient::ChromeContentUtilityClient() {
75 #if !defined(OS_ANDROID) 52 #if !defined(OS_ANDROID)
76 import_handler_.reset(new ProfileImportHandler()); 53 import_handler_.reset(new ProfileImportHandler());
77 #endif 54 #endif
78 } 55 }
79 56
80 ChromeContentUtilityClient::~ChromeContentUtilityClient() { 57 ChromeContentUtilityClient::~ChromeContentUtilityClient() {
81 } 58 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 return content::UtilityThread::Get()->Send(message); 116 return content::UtilityThread::Get()->Send(message);
140 } 117 }
141 118
142 void ChromeContentUtilityClient::OnUnpackExtension( 119 void ChromeContentUtilityClient::OnUnpackExtension(
143 const base::FilePath& extension_path, 120 const base::FilePath& extension_path,
144 const std::string& extension_id, 121 const std::string& extension_id,
145 int location, 122 int location,
146 int creation_flags) { 123 int creation_flags) {
147 CHECK(location > extensions::Manifest::INVALID_LOCATION); 124 CHECK(location > extensions::Manifest::INVALID_LOCATION);
148 CHECK(location < extensions::Manifest::NUM_LOCATIONS); 125 CHECK(location < extensions::Manifest::NUM_LOCATIONS);
149 extensions::ChromeAPIPermissions permissions;
150 extensions::PermissionsInfo::GetInstance()->InitializeWithDelegate( 126 extensions::PermissionsInfo::GetInstance()->InitializeWithDelegate(
151 permissions); 127 extensions::ChromeAPIPermissions());
152 RegisterExtensionManifestHandlers(); 128 extensions::RegisterChromeManifestHandlers();
153 extensions::Unpacker unpacker( 129 extensions::Unpacker unpacker(
154 extension_path, 130 extension_path,
155 extension_id, 131 extension_id,
156 static_cast<extensions::Manifest::Location>(location), 132 static_cast<extensions::Manifest::Location>(location),
157 creation_flags); 133 creation_flags);
158 if (unpacker.Run() && unpacker.DumpImagesToFile() && 134 if (unpacker.Run() && unpacker.DumpImagesToFile() &&
159 unpacker.DumpMessageCatalogsToFile()) { 135 unpacker.DumpMessageCatalogsToFile()) {
160 Send(new ChromeUtilityHostMsg_UnpackExtension_Succeeded( 136 Send(new ChromeUtilityHostMsg_UnpackExtension_Succeeded(
161 *unpacker.parsed_manifest())); 137 *unpacker.parsed_manifest()));
162 } else { 138 } else {
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 IPC::PlatformFileForTransit zip_file) { 467 IPC::PlatformFileForTransit zip_file) {
492 safe_browsing::zip_analyzer::Results results; 468 safe_browsing::zip_analyzer::Results results;
493 safe_browsing::zip_analyzer::AnalyzeZipFile( 469 safe_browsing::zip_analyzer::AnalyzeZipFile(
494 IPC::PlatformFileForTransitToPlatformFile(zip_file), &results); 470 IPC::PlatformFileForTransitToPlatformFile(zip_file), &results);
495 Send(new ChromeUtilityHostMsg_AnalyzeZipFileForDownloadProtection_Finished( 471 Send(new ChromeUtilityHostMsg_AnalyzeZipFileForDownloadProtection_Finished(
496 results)); 472 results));
497 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); 473 content::UtilityThread::Get()->ReleaseProcessIfNeeded();
498 } 474 }
499 475
500 } // namespace chrome 476 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/test/base/chrome_test_suite.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698