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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "build/build_config.h" |
9 #include "chrome/common/chrome_utility_messages.h" | 10 #include "chrome/common/chrome_utility_messages.h" |
10 #include "chrome/common/extensions/chrome_extensions_client.h" | 11 #include "chrome/common/extensions/chrome_extensions_client.h" |
11 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" | 12 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" |
12 #include "chrome/common/media_galleries/metadata_types.h" | 13 #include "chrome/common/media_galleries/metadata_types.h" |
13 #include "chrome/utility/chrome_content_utility_client.h" | 14 #include "chrome/utility/chrome_content_utility_client.h" |
14 #include "chrome/utility/media_galleries/image_metadata_extractor.h" | 15 #include "chrome/utility/media_galleries/image_metadata_extractor.h" |
15 #include "chrome/utility/media_galleries/ipc_data_source.h" | 16 #include "chrome/utility/media_galleries/ipc_data_source.h" |
16 #include "chrome/utility/media_galleries/media_metadata_parser.h" | 17 #include "chrome/utility/media_galleries/media_metadata_parser.h" |
17 #include "content/public/common/content_paths.h" | 18 #include "content/public/common/content_paths.h" |
18 #include "content/public/utility/utility_thread.h" | 19 #include "content/public/utility/utility_thread.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_GetWiFiCredentials, | 115 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_GetWiFiCredentials, |
115 OnGetWiFiCredentials) | 116 OnGetWiFiCredentials) |
116 #endif // defined(OS_WIN) | 117 #endif // defined(OS_WIN) |
117 | 118 |
118 IPC_MESSAGE_UNHANDLED(handled = false) | 119 IPC_MESSAGE_UNHANDLED(handled = false) |
119 IPC_END_MESSAGE_MAP() | 120 IPC_END_MESSAGE_MAP() |
120 return handled || utility_handler_.OnMessageReceived(message); | 121 return handled || utility_handler_.OnMessageReceived(message); |
121 } | 122 } |
122 | 123 |
123 void ExtensionsHandler::OnCheckMediaFile( | 124 void ExtensionsHandler::OnCheckMediaFile( |
124 int64 milliseconds_of_decoding, | 125 int64_t milliseconds_of_decoding, |
125 const IPC::PlatformFileForTransit& media_file) { | 126 const IPC::PlatformFileForTransit& media_file) { |
126 #if !defined(MEDIA_DISABLE_FFMPEG) | 127 #if !defined(MEDIA_DISABLE_FFMPEG) |
127 media::MediaFileChecker checker( | 128 media::MediaFileChecker checker( |
128 IPC::PlatformFileForTransitToFile(media_file)); | 129 IPC::PlatformFileForTransitToFile(media_file)); |
129 const bool check_success = checker.Start( | 130 const bool check_success = checker.Start( |
130 base::TimeDelta::FromMilliseconds(milliseconds_of_decoding)); | 131 base::TimeDelta::FromMilliseconds(milliseconds_of_decoding)); |
131 Send(new ChromeUtilityHostMsg_CheckMediaFile_Finished(check_success)); | 132 Send(new ChromeUtilityHostMsg_CheckMediaFile_Finished(check_success)); |
132 #else | 133 #else |
133 Send(new ChromeUtilityHostMsg_CheckMediaFile_Finished(false)); | 134 Send(new ChromeUtilityHostMsg_CheckMediaFile_Finished(false)); |
134 #endif | 135 #endif |
135 ReleaseProcessIfNeeded(); | 136 ReleaseProcessIfNeeded(); |
136 } | 137 } |
137 | 138 |
138 void ExtensionsHandler::OnParseMediaMetadata( | 139 void ExtensionsHandler::OnParseMediaMetadata(const std::string& mime_type, |
139 const std::string& mime_type, int64 total_size, bool get_attached_images) { | 140 int64_t total_size, |
| 141 bool get_attached_images) { |
140 // Only one IPCDataSource may be created and added to the list of handlers. | 142 // Only one IPCDataSource may be created and added to the list of handlers. |
141 scoped_ptr<metadata::IPCDataSource> source( | 143 scoped_ptr<metadata::IPCDataSource> source( |
142 new metadata::IPCDataSource(total_size)); | 144 new metadata::IPCDataSource(total_size)); |
143 metadata::MediaMetadataParser* parser = new metadata::MediaMetadataParser( | 145 metadata::MediaMetadataParser* parser = new metadata::MediaMetadataParser( |
144 source.get(), mime_type, get_attached_images); | 146 source.get(), mime_type, get_attached_images); |
145 utility_client_->AddHandler(source.Pass()); | 147 utility_client_->AddHandler(source.Pass()); |
146 parser->Start(base::Bind(&FinishParseMediaMetadata, base::Owned(parser))); | 148 parser->Start(base::Bind(&FinishParseMediaMetadata, base::Owned(parser))); |
147 } | 149 } |
148 | 150 |
149 #if defined(OS_WIN) | 151 #if defined(OS_WIN) |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 | 223 |
222 std::string key_data; | 224 std::string key_data; |
223 std::string error; | 225 std::string error; |
224 wifi_service->GetKeyFromSystem(network_guid, &key_data, &error); | 226 wifi_service->GetKeyFromSystem(network_guid, &key_data, &error); |
225 | 227 |
226 Send(new ChromeUtilityHostMsg_GotWiFiCredentials(key_data, error.empty())); | 228 Send(new ChromeUtilityHostMsg_GotWiFiCredentials(key_data, error.empty())); |
227 } | 229 } |
228 #endif // defined(OS_WIN) | 230 #endif // defined(OS_WIN) |
229 | 231 |
230 } // namespace extensions | 232 } // namespace extensions |
OLD | NEW |