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

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

Issue 11644057: Move BrowserAction out of Extension (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_ungoop_extension_action
Patch Set: Latest master for CQ Created 7 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
« no previous file with comments | « chrome/renderer/extensions/page_actions_custom_bindings.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/extension.h" 21 #include "chrome/common/extensions/extension.h"
21 #include "chrome/common/extensions/extension_l10n_util.h" 22 #include "chrome/common/extensions/extension_l10n_util.h"
23 #include "chrome/common/extensions/extension_manifest_constants.h"
24 #include "chrome/common/extensions/manifest_handler.h"
22 #include "chrome/common/extensions/unpacker.h" 25 #include "chrome/common/extensions/unpacker.h"
23 #include "chrome/common/extensions/update_manifest.h" 26 #include "chrome/common/extensions/update_manifest.h"
24 #include "chrome/common/web_resource/web_resource_unpacker.h" 27 #include "chrome/common/web_resource/web_resource_unpacker.h"
25 #include "chrome/common/zip.h" 28 #include "chrome/common/zip.h"
26 #include "chrome/utility/profile_import_handler.h" 29 #include "chrome/utility/profile_import_handler.h"
27 #include "content/public/utility/utility_thread.h" 30 #include "content/public/utility/utility_thread.h"
28 #include "printing/backend/print_backend.h" 31 #include "printing/backend/print_backend.h"
29 #include "printing/page_range.h" 32 #include "printing/page_range.h"
30 #include "third_party/skia/include/core/SkBitmap.h" 33 #include "third_party/skia/include/core/SkBitmap.h"
31 #include "ui/base/ui_base_switches.h" 34 #include "ui/base/ui_base_switches.h"
32 #include "ui/gfx/codec/jpeg_codec.h" 35 #include "ui/gfx/codec/jpeg_codec.h"
33 #include "ui/gfx/rect.h" 36 #include "ui/gfx/rect.h"
34 #include "webkit/glue/image_decoder.h" 37 #include "webkit/glue/image_decoder.h"
35 38
36 #if defined(OS_WIN) 39 #if defined(OS_WIN)
37 #include "base/path_service.h" 40 #include "base/path_service.h"
38 #include "base/win/iat_patch_function.h" 41 #include "base/win/iat_patch_function.h"
39 #include "base/win/scoped_handle.h" 42 #include "base/win/scoped_handle.h"
40 #include "content/public/common/content_switches.h" 43 #include "content/public/common/content_switches.h"
41 #include "printing/emf_win.h" 44 #include "printing/emf_win.h"
42 #include "ui/gfx/gdi_util.h" 45 #include "ui/gfx/gdi_util.h"
43 #endif // defined(OS_WIN) 46 #endif // defined(OS_WIN)
44 47
48 namespace {
49
50 // Explicitly register all ManifestHandlers needed in the utility process.
51 void RegisterExtensionManifestHandlers() {
52 extensions::ManifestHandler::Register(
53 extension_manifest_keys::kBrowserAction,
54 new extensions::BrowserActionHandler);
55 }
56
57 } // namespace
58
45 namespace chrome { 59 namespace chrome {
46 60
47 ChromeContentUtilityClient::ChromeContentUtilityClient() { 61 ChromeContentUtilityClient::ChromeContentUtilityClient() {
48 #if !defined(OS_ANDROID) 62 #if !defined(OS_ANDROID)
49 import_handler_.reset(new ProfileImportHandler()); 63 import_handler_.reset(new ProfileImportHandler());
50 #endif 64 #endif
51 } 65 }
52 66
53 ChromeContentUtilityClient::~ChromeContentUtilityClient() { 67 ChromeContentUtilityClient::~ChromeContentUtilityClient() {
54 } 68 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 return content::UtilityThread::Get()->Send(message); 123 return content::UtilityThread::Get()->Send(message);
110 } 124 }
111 125
112 void ChromeContentUtilityClient::OnUnpackExtension( 126 void ChromeContentUtilityClient::OnUnpackExtension(
113 const FilePath& extension_path, 127 const FilePath& extension_path,
114 const std::string& extension_id, 128 const std::string& extension_id,
115 int location, 129 int location,
116 int creation_flags) { 130 int creation_flags) {
117 CHECK(location > extensions::Extension::INVALID); 131 CHECK(location > extensions::Extension::INVALID);
118 CHECK(location < extensions::Extension::NUM_LOCATIONS); 132 CHECK(location < extensions::Extension::NUM_LOCATIONS);
133 RegisterExtensionManifestHandlers();
119 extensions::Unpacker unpacker( 134 extensions::Unpacker unpacker(
120 extension_path, 135 extension_path,
121 extension_id, 136 extension_id,
122 static_cast<extensions::Extension::Location>(location), 137 static_cast<extensions::Extension::Location>(location),
123 creation_flags); 138 creation_flags);
124 if (unpacker.Run() && unpacker.DumpImagesToFile() && 139 if (unpacker.Run() && unpacker.DumpImagesToFile() &&
125 unpacker.DumpMessageCatalogsToFile()) { 140 unpacker.DumpMessageCatalogsToFile()) {
126 Send(new ChromeUtilityHostMsg_UnpackExtension_Succeeded( 141 Send(new ChromeUtilityHostMsg_UnpackExtension_Succeeded(
127 *unpacker.parsed_manifest())); 142 *unpacker.parsed_manifest()));
128 } else { 143 } else {
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 } else 456 } else
442 #endif 457 #endif
443 { 458 {
444 Send(new ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed( 459 Send(new ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed(
445 printer_name)); 460 printer_name));
446 } 461 }
447 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); 462 content::UtilityThread::Get()->ReleaseProcessIfNeeded();
448 } 463 }
449 464
450 } // namespace chrome 465 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/page_actions_custom_bindings.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698