OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/extensions/extensions_handler.h" | 5 #include "chrome/utility/extensions/extensions_handler.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
12 #include "build/build_config.h" | |
13 #include "chrome/common/chrome_utility_messages.h" | |
14 #include "chrome/common/extensions/chrome_extensions_client.h" | 12 #include "chrome/common/extensions/chrome_extensions_client.h" |
15 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" | 13 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" |
16 #include "chrome/common/extensions/media_parser.mojom.h" | 14 #include "chrome/common/extensions/media_parser.mojom.h" |
17 #include "chrome/common/extensions/removable_storage_writer.mojom.h" | 15 #include "chrome/common/extensions/removable_storage_writer.mojom.h" |
18 #include "chrome/common/media_galleries/metadata_types.h" | 16 #include "chrome/common/media_galleries/metadata_types.h" |
19 #include "chrome/utility/chrome_content_utility_client.h" | |
20 #include "chrome/utility/image_writer/image_writer_handler.h" | 17 #include "chrome/utility/image_writer/image_writer_handler.h" |
21 #include "chrome/utility/media_galleries/ipc_data_source.h" | 18 #include "chrome/utility/media_galleries/ipc_data_source.h" |
22 #include "chrome/utility/media_galleries/media_metadata_parser.h" | 19 #include "chrome/utility/media_galleries/media_metadata_parser.h" |
23 #include "content/public/common/content_paths.h" | |
24 #include "content/public/utility/utility_thread.h" | 20 #include "content/public/utility/utility_thread.h" |
25 #include "extensions/common/extension.h" | |
26 #include "extensions/common/extension_utility_messages.h" | |
27 #include "extensions/utility/unpacker.h" | |
28 #include "media/base/media.h" | 21 #include "media/base/media.h" |
29 #include "mojo/public/cpp/bindings/strong_binding.h" | 22 #include "mojo/public/cpp/bindings/strong_binding.h" |
30 #include "services/service_manager/public/cpp/interface_registry.h" | 23 #include "services/service_manager/public/cpp/interface_registry.h" |
31 #include "ui/base/ui_base_switches.h" | 24 #include "ui/base/ui_base_switches.h" |
32 | 25 |
33 #if !defined(MEDIA_DISABLE_FFMPEG) | 26 #if !defined(MEDIA_DISABLE_FFMPEG) |
34 #include "media/base/media_file_checker.h" | 27 #include "media/base/media_file_checker.h" |
35 #endif | 28 #endif |
36 | 29 |
37 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 namespace extensions { | 166 namespace extensions { |
174 | 167 |
175 ExtensionsHandler::ExtensionsHandler() { | 168 ExtensionsHandler::ExtensionsHandler() { |
176 ExtensionsClient::Set(ChromeExtensionsClient::GetInstance()); | 169 ExtensionsClient::Set(ChromeExtensionsClient::GetInstance()); |
177 } | 170 } |
178 | 171 |
179 ExtensionsHandler::~ExtensionsHandler() = default; | 172 ExtensionsHandler::~ExtensionsHandler() = default; |
180 | 173 |
181 // static | 174 // static |
182 void ExtensionsHandler::PreSandboxStartup() { | 175 void ExtensionsHandler::PreSandboxStartup() { |
183 // Initialize media libraries for media file validation. | 176 media::InitializeMediaLibrary(); // Used for media file validation. |
184 media::InitializeMediaLibrary(); | |
185 } | 177 } |
186 | 178 |
187 // static | 179 // static |
188 void ExtensionsHandler::ExposeInterfacesToBrowser( | 180 void ExtensionsHandler::ExposeInterfacesToBrowser( |
189 service_manager::InterfaceRegistry* registry, | 181 service_manager::InterfaceRegistry* registry, |
190 bool running_elevated) { | 182 bool running_elevated) { |
191 // If our process runs with elevated privileges, only add elevated Mojo | 183 // If our process runs with elevated privileges, only add elevated Mojo |
192 // interfaces to the interface registry. | 184 // interfaces to the interface registry. |
193 if (running_elevated) { | 185 if (running_elevated) { |
194 #if defined(OS_WIN) | 186 #if defined(OS_WIN) |
(...skipping 22 matching lines...) Expand all Loading... |
217 OnParseITunesLibraryXmlFile) | 209 OnParseITunesLibraryXmlFile) |
218 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParsePicasaPMPDatabase, | 210 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParsePicasaPMPDatabase, |
219 OnParsePicasaPMPDatabase) | 211 OnParsePicasaPMPDatabase) |
220 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_IndexPicasaAlbumsContents, | 212 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_IndexPicasaAlbumsContents, |
221 OnIndexPicasaAlbumsContents) | 213 OnIndexPicasaAlbumsContents) |
222 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 214 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
223 | 215 |
224 IPC_MESSAGE_UNHANDLED(handled = false) | 216 IPC_MESSAGE_UNHANDLED(handled = false) |
225 IPC_END_MESSAGE_MAP() | 217 IPC_END_MESSAGE_MAP() |
226 | 218 |
227 return handled || utility_handler_.OnMessageReceived(message); | 219 return handled; |
228 } | 220 } |
229 | 221 |
230 #if defined(OS_WIN) | 222 #if defined(OS_WIN) |
231 void ExtensionsHandler::OnParseITunesPrefXml( | 223 void ExtensionsHandler::OnParseITunesPrefXml( |
232 const std::string& itunes_xml_data) { | 224 const std::string& itunes_xml_data) { |
233 base::FilePath library_path( | 225 base::FilePath library_path( |
234 itunes::FindLibraryLocationInPrefXml(itunes_xml_data)); | 226 itunes::FindLibraryLocationInPrefXml(itunes_xml_data)); |
235 content::UtilityThread::Get()->Send( | 227 content::UtilityThread::Get()->Send( |
236 new ChromeUtilityHostMsg_GotITunesDirectory(library_path)); | 228 new ChromeUtilityHostMsg_GotITunesDirectory(library_path)); |
237 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); | 229 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 picasa::PicasaAlbumsIndexer indexer(album_uids); | 273 picasa::PicasaAlbumsIndexer indexer(album_uids); |
282 indexer.ParseFolderINI(folders_inis); | 274 indexer.ParseFolderINI(folders_inis); |
283 content::UtilityThread::Get()->Send( | 275 content::UtilityThread::Get()->Send( |
284 new ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished( | 276 new ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished( |
285 indexer.albums_images())); | 277 indexer.albums_images())); |
286 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); | 278 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); |
287 } | 279 } |
288 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 280 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
289 | 281 |
290 } // namespace extensions | 282 } // namespace extensions |
OLD | NEW |