OLD | NEW |
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/api/extension_action/browser_action_handler.h
" |
21 #include "chrome/common/extensions/api/extension_action/page_action_handler.h" | 21 #include "chrome/common/extensions/api/extension_action/page_action_handler.h" |
22 #include "chrome/common/extensions/api/i18n/default_locale_handler.h" | 22 #include "chrome/common/extensions/api/i18n/default_locale_handler.h" |
23 #include "chrome/common/extensions/api/icons/icons_handler.h" | 23 #include "chrome/common/extensions/api/icons/icons_handler.h" |
24 #include "chrome/common/extensions/api/themes/theme_handler.h" | 24 #include "chrome/common/extensions/api/themes/theme_handler.h" |
| 25 #include "chrome/common/extensions/background_info.h" |
25 #include "chrome/common/extensions/extension.h" | 26 #include "chrome/common/extensions/extension.h" |
26 #include "chrome/common/extensions/extension_l10n_util.h" | 27 #include "chrome/common/extensions/extension_l10n_util.h" |
27 #include "chrome/common/extensions/extension_manifest_constants.h" | |
28 #include "chrome/common/extensions/manifest.h" | 28 #include "chrome/common/extensions/manifest.h" |
29 #include "chrome/common/extensions/manifest_handler.h" | |
30 #include "chrome/common/extensions/unpacker.h" | 29 #include "chrome/common/extensions/unpacker.h" |
31 #include "chrome/common/extensions/update_manifest.h" | 30 #include "chrome/common/extensions/update_manifest.h" |
32 #include "chrome/common/safe_browsing/zip_analyzer.h" | 31 #include "chrome/common/safe_browsing/zip_analyzer.h" |
33 #include "chrome/common/web_resource/web_resource_unpacker.h" | 32 #include "chrome/common/web_resource/web_resource_unpacker.h" |
34 #include "chrome/common/zip.h" | 33 #include "chrome/common/zip.h" |
35 #include "chrome/utility/profile_import_handler.h" | 34 #include "chrome/utility/profile_import_handler.h" |
36 #include "content/public/utility/utility_thread.h" | 35 #include "content/public/utility/utility_thread.h" |
37 #include "printing/backend/print_backend.h" | 36 #include "printing/backend/print_backend.h" |
38 #include "printing/page_range.h" | 37 #include "printing/page_range.h" |
39 #include "third_party/skia/include/core/SkBitmap.h" | 38 #include "third_party/skia/include/core/SkBitmap.h" |
40 #include "ui/base/ui_base_switches.h" | 39 #include "ui/base/ui_base_switches.h" |
41 #include "ui/gfx/codec/jpeg_codec.h" | 40 #include "ui/gfx/codec/jpeg_codec.h" |
42 #include "ui/gfx/rect.h" | 41 #include "ui/gfx/rect.h" |
43 #include "webkit/glue/image_decoder.h" | 42 #include "webkit/glue/image_decoder.h" |
44 | 43 |
45 #if defined(OS_WIN) | 44 #if defined(OS_WIN) |
46 #include "base/path_service.h" | 45 #include "base/path_service.h" |
47 #include "base/win/iat_patch_function.h" | 46 #include "base/win/iat_patch_function.h" |
48 #include "base/win/scoped_handle.h" | 47 #include "base/win/scoped_handle.h" |
49 #include "content/public/common/content_switches.h" | 48 #include "content/public/common/content_switches.h" |
50 #include "printing/emf_win.h" | 49 #include "printing/emf_win.h" |
51 #include "ui/gfx/gdi_util.h" | 50 #include "ui/gfx/gdi_util.h" |
52 #endif // defined(OS_WIN) | 51 #endif // defined(OS_WIN) |
53 | 52 |
54 namespace { | 53 namespace { |
55 | 54 |
56 // Explicitly register all ManifestHandlers needed in the utility process. | 55 // Explicitly register all ManifestHandlers needed in the utility process. |
57 void RegisterExtensionManifestHandlers() { | 56 void RegisterExtensionManifestHandlers() { |
58 extensions::ManifestHandler::Register( | 57 (new extensions::BackgroundManifestHandler)->Register(); |
59 extension_manifest_keys::kBrowserAction, | 58 (new extensions::BrowserActionHandler)->Register(); |
60 make_linked_ptr(new extensions::BrowserActionHandler)); | 59 (new extensions::DefaultLocaleHandler)->Register(); |
61 extensions::ManifestHandler::Register( | 60 (new extensions::IconsHandler)->Register(); |
62 extension_manifest_keys::kDefaultLocale, | 61 (new extensions::PageActionHandler)->Register(); |
63 make_linked_ptr(new extensions::DefaultLocaleHandler)); | 62 (new extensions::ThemeHandler)->Register(); |
64 extensions::ManifestHandler::Register( | |
65 extension_manifest_keys::kIcons, | |
66 make_linked_ptr(new extensions::IconsHandler)); | |
67 linked_ptr<extensions::PageActionHandler> page_action_handler( | |
68 new extensions::PageActionHandler); | |
69 extensions::ManifestHandler::Register( | |
70 extension_manifest_keys::kPageAction, page_action_handler); | |
71 extensions::ManifestHandler::Register( | |
72 extension_manifest_keys::kPageActions, page_action_handler); | |
73 extensions::ManifestHandler::Register( | |
74 extension_manifest_keys::kTheme, | |
75 make_linked_ptr(new extensions::ThemeHandler)); | |
76 } | 63 } |
77 | 64 |
78 } // namespace | 65 } // namespace |
79 | 66 |
80 namespace chrome { | 67 namespace chrome { |
81 | 68 |
82 ChromeContentUtilityClient::ChromeContentUtilityClient() { | 69 ChromeContentUtilityClient::ChromeContentUtilityClient() { |
83 #if !defined(OS_ANDROID) | 70 #if !defined(OS_ANDROID) |
84 import_handler_.reset(new ProfileImportHandler()); | 71 import_handler_.reset(new ProfileImportHandler()); |
85 #endif | 72 #endif |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 IPC::PlatformFileForTransit zip_file) { | 483 IPC::PlatformFileForTransit zip_file) { |
497 safe_browsing::zip_analyzer::Results results; | 484 safe_browsing::zip_analyzer::Results results; |
498 safe_browsing::zip_analyzer::AnalyzeZipFile( | 485 safe_browsing::zip_analyzer::AnalyzeZipFile( |
499 IPC::PlatformFileForTransitToPlatformFile(zip_file), &results); | 486 IPC::PlatformFileForTransitToPlatformFile(zip_file), &results); |
500 Send(new ChromeUtilityHostMsg_AnalyzeZipFileForDownloadProtection_Finished( | 487 Send(new ChromeUtilityHostMsg_AnalyzeZipFileForDownloadProtection_Finished( |
501 results)); | 488 results)); |
502 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); | 489 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); |
503 } | 490 } |
504 | 491 |
505 } // namespace chrome | 492 } // namespace chrome |
OLD | NEW |