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 #ifndef CHROME_UTILITY_EXTENSIONS_EXTENSIONS_HANDLER_H_ | 5 #ifndef CHROME_UTILITY_EXTENSIONS_EXTENSIONS_HANDLER_H_ |
6 #define CHROME_UTILITY_EXTENSIONS_EXTENSIONS_HANDLER_H_ | 6 #define CHROME_UTILITY_EXTENSIONS_EXTENSIONS_HANDLER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "chrome/common/media_galleries/picasa_types.h" | 14 #include "chrome/common/media_galleries/picasa_types.h" |
15 #include "chrome/utility/utility_message_handler.h" | 15 #include "chrome/utility/utility_message_handler.h" |
16 #include "extensions/features/features.h" | 16 #include "extensions/features/features.h" |
17 #include "extensions/utility/utility_handler.h" | 17 #include "extensions/utility/utility_handler.h" |
18 | 18 |
19 #if !BUILDFLAG(ENABLE_EXTENSIONS) | 19 #if !BUILDFLAG(ENABLE_EXTENSIONS) |
20 #error "Extensions must be enabled" | 20 #error "Extensions must be enabled" |
21 #endif | 21 #endif |
22 | 22 |
23 class ChromeContentUtilityClient; | 23 class ChromeContentUtilityClient; |
24 | 24 |
| 25 namespace service_manager { |
| 26 class InterfaceRegistry; |
| 27 } |
| 28 |
25 namespace extensions { | 29 namespace extensions { |
26 | 30 |
27 // Dispatches IPCs for Chrome extensions utility messages. | 31 // Dispatches IPCs for Chrome extensions utility messages. |
28 class ExtensionsHandler : public UtilityMessageHandler { | 32 class ExtensionsHandler : public UtilityMessageHandler { |
29 public: | 33 public: |
30 explicit ExtensionsHandler(ChromeContentUtilityClient* utility_client); | 34 ExtensionsHandler(); |
31 ~ExtensionsHandler() override; | 35 ~ExtensionsHandler() override; |
32 | 36 |
33 static void PreSandboxStartup(); | 37 static void PreSandboxStartup(); |
34 | 38 |
| 39 // TODO(noel): consider moving this API to the UtilityMessageHandler |
| 40 // interface. |
| 41 static void ExposeInterfacesToBrowser( |
| 42 service_manager::InterfaceRegistry* registry, |
| 43 ChromeContentUtilityClient* utility_client, |
| 44 bool running_elevated); |
| 45 |
35 // UtilityMessageHandler: | 46 // UtilityMessageHandler: |
36 bool OnMessageReceived(const IPC::Message& message) override; | 47 bool OnMessageReceived(const IPC::Message& message) override; |
37 | 48 |
38 private: | 49 private: |
39 // IPC message handlers. | 50 // IPC message handlers. |
40 void OnCheckMediaFile(int64_t milliseconds_of_decoding, | 51 void OnCheckMediaFile(int64_t milliseconds_of_decoding, |
41 const IPC::PlatformFileForTransit& media_file); | 52 const IPC::PlatformFileForTransit& media_file); |
42 | 53 |
43 void OnParseMediaMetadata(const std::string& mime_type, | |
44 int64_t total_size, | |
45 bool get_attached_images); | |
46 | |
47 #if defined(OS_WIN) | 54 #if defined(OS_WIN) |
48 void OnParseITunesPrefXml(const std::string& itunes_xml_data); | 55 void OnParseITunesPrefXml(const std::string& itunes_xml_data); |
49 #endif // defined(OS_WIN) | 56 #endif // defined(OS_WIN) |
50 | 57 |
51 #if defined(OS_WIN) || defined(OS_MACOSX) | 58 #if defined(OS_WIN) || defined(OS_MACOSX) |
52 void OnParseITunesLibraryXmlFile( | 59 void OnParseITunesLibraryXmlFile( |
53 const IPC::PlatformFileForTransit& itunes_library_file); | 60 const IPC::PlatformFileForTransit& itunes_library_file); |
54 | 61 |
55 void OnParsePicasaPMPDatabase( | 62 void OnParsePicasaPMPDatabase( |
56 const picasa::AlbumTableFilesForTransit& album_table_files); | 63 const picasa::AlbumTableFilesForTransit& album_table_files); |
57 | 64 |
58 void OnIndexPicasaAlbumsContents( | 65 void OnIndexPicasaAlbumsContents( |
59 const picasa::AlbumUIDSet& album_uids, | 66 const picasa::AlbumUIDSet& album_uids, |
60 const std::vector<picasa::FolderINIContents>& folders_inis); | 67 const std::vector<picasa::FolderINIContents>& folders_inis); |
61 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 68 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
62 | 69 |
63 #if defined(OS_WIN) | 70 #if defined(OS_WIN) |
64 void OnGetWiFiCredentials(const std::string& network_guid); | 71 void OnGetWiFiCredentials(const std::string& network_guid); |
65 #endif // defined(OS_WIN) | 72 #endif // defined(OS_WIN) |
66 | 73 |
67 UtilityHandler utility_handler_; | 74 UtilityHandler utility_handler_; |
68 | 75 |
69 // The client that owns this. | |
70 ChromeContentUtilityClient* const utility_client_; | |
71 | |
72 DISALLOW_COPY_AND_ASSIGN(ExtensionsHandler); | 76 DISALLOW_COPY_AND_ASSIGN(ExtensionsHandler); |
73 }; | 77 }; |
74 | 78 |
75 } // namespace extensions | 79 } // namespace extensions |
76 | 80 |
77 #endif // CHROME_UTILITY_EXTENSIONS_EXTENSIONS_HANDLER_H_ | 81 #endif // CHROME_UTILITY_EXTENSIONS_EXTENSIONS_HANDLER_H_ |
OLD | NEW |