| 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" | 21 #include "extensions/utility/unpacker.h" |
| 28 #include "media/base/media.h" | 22 #include "media/base/media.h" |
| 29 #include "mojo/public/cpp/bindings/strong_binding.h" | 23 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 30 #include "services/service_manager/public/cpp/interface_registry.h" | 24 #include "services/service_manager/public/cpp/interface_registry.h" |
| 31 #include "ui/base/ui_base_switches.h" | 25 #include "ui/base/ui_base_switches.h" |
| 32 | 26 |
| 33 #if !defined(MEDIA_DISABLE_FFMPEG) | 27 #if !defined(MEDIA_DISABLE_FFMPEG) |
| 34 #include "media/base/media_file_checker.h" | 28 #include "media/base/media_file_checker.h" |
| 35 #endif | 29 #endif |
| 36 | 30 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 namespace extensions { | 167 namespace extensions { |
| 174 | 168 |
| 175 ExtensionsHandler::ExtensionsHandler() { | 169 ExtensionsHandler::ExtensionsHandler() { |
| 176 ExtensionsClient::Set(ChromeExtensionsClient::GetInstance()); | 170 ExtensionsClient::Set(ChromeExtensionsClient::GetInstance()); |
| 177 } | 171 } |
| 178 | 172 |
| 179 ExtensionsHandler::~ExtensionsHandler() = default; | 173 ExtensionsHandler::~ExtensionsHandler() = default; |
| 180 | 174 |
| 181 // static | 175 // static |
| 182 void ExtensionsHandler::PreSandboxStartup() { | 176 void ExtensionsHandler::PreSandboxStartup() { |
| 183 // Initialize media libraries for media file validation. | 177 media::InitializeMediaLibrary(); // Used for media file validation. |
| 184 media::InitializeMediaLibrary(); | |
| 185 } | 178 } |
| 186 | 179 |
| 187 // static | 180 // static |
| 188 void ExtensionsHandler::ExposeInterfacesToBrowser( | 181 void ExtensionsHandler::ExposeInterfacesToBrowser( |
| 189 service_manager::InterfaceRegistry* registry, | 182 service_manager::InterfaceRegistry* registry, |
| 190 bool running_elevated) { | 183 bool running_elevated) { |
| 191 // If our process runs with elevated privileges, only add elevated Mojo | 184 // If our process runs with elevated privileges, only add elevated Mojo |
| 192 // services to the interface registry. | 185 // services to the interface registry. |
| 193 if (running_elevated) { | 186 if (running_elevated) { |
| 194 #if defined(OS_WIN) | 187 #if defined(OS_WIN) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 217 OnParseITunesLibraryXmlFile) | 210 OnParseITunesLibraryXmlFile) |
| 218 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParsePicasaPMPDatabase, | 211 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParsePicasaPMPDatabase, |
| 219 OnParsePicasaPMPDatabase) | 212 OnParsePicasaPMPDatabase) |
| 220 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_IndexPicasaAlbumsContents, | 213 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_IndexPicasaAlbumsContents, |
| 221 OnIndexPicasaAlbumsContents) | 214 OnIndexPicasaAlbumsContents) |
| 222 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 215 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
| 223 | 216 |
| 224 IPC_MESSAGE_UNHANDLED(handled = false) | 217 IPC_MESSAGE_UNHANDLED(handled = false) |
| 225 IPC_END_MESSAGE_MAP() | 218 IPC_END_MESSAGE_MAP() |
| 226 | 219 |
| 227 return handled || utility_handler_.OnMessageReceived(message); | 220 return handled; |
| 228 } | 221 } |
| 229 | 222 |
| 230 #if defined(OS_WIN) | 223 #if defined(OS_WIN) |
| 231 void ExtensionsHandler::OnParseITunesPrefXml( | 224 void ExtensionsHandler::OnParseITunesPrefXml( |
| 232 const std::string& itunes_xml_data) { | 225 const std::string& itunes_xml_data) { |
| 233 base::FilePath library_path( | 226 base::FilePath library_path( |
| 234 itunes::FindLibraryLocationInPrefXml(itunes_xml_data)); | 227 itunes::FindLibraryLocationInPrefXml(itunes_xml_data)); |
| 235 content::UtilityThread::Get()->Send( | 228 content::UtilityThread::Get()->Send( |
| 236 new ChromeUtilityHostMsg_GotITunesDirectory(library_path)); | 229 new ChromeUtilityHostMsg_GotITunesDirectory(library_path)); |
| 237 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); | 230 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 picasa::PicasaAlbumsIndexer indexer(album_uids); | 274 picasa::PicasaAlbumsIndexer indexer(album_uids); |
| 282 indexer.ParseFolderINI(folders_inis); | 275 indexer.ParseFolderINI(folders_inis); |
| 283 content::UtilityThread::Get()->Send( | 276 content::UtilityThread::Get()->Send( |
| 284 new ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished( | 277 new ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished( |
| 285 indexer.albums_images())); | 278 indexer.albums_images())); |
| 286 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); | 279 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); |
| 287 } | 280 } |
| 288 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 281 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
| 289 | 282 |
| 290 } // namespace extensions | 283 } // namespace extensions |
| OLD | NEW |