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 static void ExposeInterfacesToBrowser( | |
Sam McNally
2017/01/10 06:55:14
I feel like we might want to put this in the Utili
Noel Gordon
2017/01/10 22:52:37
OK, added // TODO(noel): consider moving this API
| |
40 service_manager::InterfaceRegistry* registry, | |
41 ChromeContentUtilityClient* utility_client, | |
42 bool running_elevated); | |
43 | |
35 // UtilityMessageHandler: | 44 // UtilityMessageHandler: |
36 bool OnMessageReceived(const IPC::Message& message) override; | 45 bool OnMessageReceived(const IPC::Message& message) override; |
37 | 46 |
38 private: | 47 private: |
39 // IPC message handlers. | 48 // IPC message handlers. |
40 void OnCheckMediaFile(int64_t milliseconds_of_decoding, | 49 void OnCheckMediaFile(int64_t milliseconds_of_decoding, |
41 const IPC::PlatformFileForTransit& media_file); | 50 const IPC::PlatformFileForTransit& media_file); |
42 | 51 |
43 void OnParseMediaMetadata(const std::string& mime_type, | |
44 int64_t total_size, | |
45 bool get_attached_images); | |
46 | |
47 #if defined(OS_WIN) | 52 #if defined(OS_WIN) |
48 void OnParseITunesPrefXml(const std::string& itunes_xml_data); | 53 void OnParseITunesPrefXml(const std::string& itunes_xml_data); |
49 #endif // defined(OS_WIN) | 54 #endif // defined(OS_WIN) |
50 | 55 |
51 #if defined(OS_WIN) || defined(OS_MACOSX) | 56 #if defined(OS_WIN) || defined(OS_MACOSX) |
52 void OnParseITunesLibraryXmlFile( | 57 void OnParseITunesLibraryXmlFile( |
53 const IPC::PlatformFileForTransit& itunes_library_file); | 58 const IPC::PlatformFileForTransit& itunes_library_file); |
54 | 59 |
55 void OnParsePicasaPMPDatabase( | 60 void OnParsePicasaPMPDatabase( |
56 const picasa::AlbumTableFilesForTransit& album_table_files); | 61 const picasa::AlbumTableFilesForTransit& album_table_files); |
57 | 62 |
58 void OnIndexPicasaAlbumsContents( | 63 void OnIndexPicasaAlbumsContents( |
59 const picasa::AlbumUIDSet& album_uids, | 64 const picasa::AlbumUIDSet& album_uids, |
60 const std::vector<picasa::FolderINIContents>& folders_inis); | 65 const std::vector<picasa::FolderINIContents>& folders_inis); |
61 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 66 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
62 | 67 |
63 #if defined(OS_WIN) | 68 #if defined(OS_WIN) |
64 void OnGetWiFiCredentials(const std::string& network_guid); | 69 void OnGetWiFiCredentials(const std::string& network_guid); |
65 #endif // defined(OS_WIN) | 70 #endif // defined(OS_WIN) |
66 | 71 |
67 UtilityHandler utility_handler_; | 72 UtilityHandler utility_handler_; |
68 | 73 |
69 // The client that owns this. | |
70 ChromeContentUtilityClient* const utility_client_; | |
71 | |
72 DISALLOW_COPY_AND_ASSIGN(ExtensionsHandler); | 74 DISALLOW_COPY_AND_ASSIGN(ExtensionsHandler); |
73 }; | 75 }; |
74 | 76 |
75 } // namespace extensions | 77 } // namespace extensions |
76 | 78 |
77 #endif // CHROME_UTILITY_EXTENSIONS_EXTENSIONS_HANDLER_H_ | 79 #endif // CHROME_UTILITY_EXTENSIONS_EXTENSIONS_HANDLER_H_ |
OLD | NEW |