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
3 // found in the LICENSE file.
5 #ifndef CHROME_UTILITY_EXTENSIONS_EXTENSIONS_HANDLER_H_
6 #define CHROME_UTILITY_EXTENSIONS_EXTENSIONS_HANDLER_H_
8 #include "base/base64.h"
9 #include "base/compiler_specific.h"
10 #include "base/json/json_reader.h"
11 #include "base/macros.h"
12 #include "chrome/common/media_galleries/picasa_types.h"
13 #include "chrome/utility/utility_message_handler.h"
14 #include "extensions/utility/utility_handler.h"
16 #if !defined(ENABLE_EXTENSIONS)
17 #error "Extensions must be enabled"
21 class MediaMetadataParser
;
24 namespace extensions
{
26 // Dispatches IPCs for Chrome extensions utility messages.
27 class ExtensionsHandler
: public UtilityMessageHandler
{
30 ~ExtensionsHandler() override
;
32 static void PreSandboxStartup();
33 static void UtilityThreadStarted();
35 // UtilityMessageHandler:
36 bool OnMessageReceived(const IPC::Message
& message
) override
;
39 // IPC message handlers.
40 void OnUnpackExtension(const base::FilePath
& extension_path
,
41 const std::string
& extension_id
,
42 int location
, int creation_flags
);
43 void OnUnzipToDir(const base::FilePath
& zip_path
, const base::FilePath
& dir
);
44 void OnDecodeImageBase64(const std::string
& encoded_data
);
45 void OnParseJSON(const std::string
& json
);
46 void OnCheckMediaFile(int64 milliseconds_of_decoding
,
47 const IPC::PlatformFileForTransit
& media_file
);
50 void OnParseITunesPrefXml(const std::string
& itunes_xml_data
);
51 #endif // defined(OS_WIN)
53 #if defined(OS_MACOSX)
54 void OnParseIPhotoLibraryXmlFile(
55 const IPC::PlatformFileForTransit
& iphoto_library_file
);
56 #endif // defined(OS_MACOSX)
58 #if defined(OS_WIN) || defined(OS_MACOSX)
59 void OnParseITunesLibraryXmlFile(
60 const IPC::PlatformFileForTransit
& itunes_library_file
);
62 void OnParsePicasaPMPDatabase(
63 const picasa::AlbumTableFilesForTransit
& album_table_files
);
65 void OnIndexPicasaAlbumsContents(
66 const picasa::AlbumUIDSet
& album_uids
,
67 const std::vector
<picasa::FolderINIContents
>& folders_inis
);
68 #endif // defined(OS_WIN) || defined(OS_MACOSX)
71 void OnGetWiFiCredentials(const std::string
& network_guid
);
72 #endif // defined(OS_WIN)
74 UtilityHandler utility_handler_
;
76 DISALLOW_COPY_AND_ASSIGN(ExtensionsHandler
);
79 } // namespace extensions
81 #endif // CHROME_UTILITY_EXTENSIONS_EXTENSIONS_HANDLER_H_