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/browser/media_galleries/fileapi/safe_media_metadata_parser.h" | 5 #include "chrome/browser/media_galleries/fileapi/safe_media_metadata_parser.h" |
6 | 6 |
7 #include "chrome/browser/extensions/blob_reader.h" | 7 #include "chrome/browser/extensions/blob_reader.h" |
8 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" | 8 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" |
| 9 #include "chrome/grit/generated_resources.h" |
9 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
10 #include "content/public/browser/child_process_data.h" | 11 #include "content/public/browser/child_process_data.h" |
11 #include "content/public/browser/utility_process_host.h" | 12 #include "content/public/browser/utility_process_host.h" |
| 13 #include "ui/base/l10n/l10n_util.h" |
12 | 14 |
13 using content::BrowserThread; | 15 using content::BrowserThread; |
14 | 16 |
15 namespace metadata { | 17 namespace metadata { |
16 | 18 |
17 SafeMediaMetadataParser::SafeMediaMetadataParser( | 19 SafeMediaMetadataParser::SafeMediaMetadataParser( |
18 Profile* profile, const std::string& blob_uuid, int64 blob_size, | 20 Profile* profile, const std::string& blob_uuid, int64 blob_size, |
19 const std::string& mime_type, bool get_attached_images) | 21 const std::string& mime_type, bool get_attached_images) |
20 : profile_(profile), | 22 : profile_(profile), |
21 blob_uuid_(blob_uuid), | 23 blob_uuid_(blob_uuid), |
(...skipping 20 matching lines...) Expand all Loading... |
42 void SafeMediaMetadataParser::StartWorkOnIOThread( | 44 void SafeMediaMetadataParser::StartWorkOnIOThread( |
43 const DoneCallback& callback) { | 45 const DoneCallback& callback) { |
44 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 46 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
45 DCHECK_EQ(INITIAL_STATE, parser_state_); | 47 DCHECK_EQ(INITIAL_STATE, parser_state_); |
46 DCHECK(!callback.is_null()); | 48 DCHECK(!callback.is_null()); |
47 | 49 |
48 callback_ = callback; | 50 callback_ = callback; |
49 | 51 |
50 utility_process_host_ = content::UtilityProcessHost::Create( | 52 utility_process_host_ = content::UtilityProcessHost::Create( |
51 this, base::MessageLoopProxy::current())->AsWeakPtr(); | 53 this, base::MessageLoopProxy::current())->AsWeakPtr(); |
| 54 utility_process_host_->SetName(l10n_util::GetStringUTF16( |
| 55 IDS_UTILITY_PROCESS_MEDIA_FILE_CHECKER_NAME)); |
52 | 56 |
53 utility_process_host_->Send( | 57 utility_process_host_->Send( |
54 new ChromeUtilityMsg_ParseMediaMetadata(mime_type_, blob_size_, | 58 new ChromeUtilityMsg_ParseMediaMetadata(mime_type_, blob_size_, |
55 get_attached_images_)); | 59 get_attached_images_)); |
56 | 60 |
57 parser_state_ = STARTED_PARSING_STATE; | 61 parser_state_ = STARTED_PARSING_STATE; |
58 } | 62 } |
59 | 63 |
60 void SafeMediaMetadataParser::OnParseMediaMetadataFinished( | 64 void SafeMediaMetadataParser::OnParseMediaMetadataFinished( |
61 bool parse_success, const base::DictionaryValue& metadata_dictionary, | 65 bool parse_success, const base::DictionaryValue& metadata_dictionary, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 OnParseMediaMetadataFinished) | 147 OnParseMediaMetadataFinished) |
144 IPC_MESSAGE_HANDLER( | 148 IPC_MESSAGE_HANDLER( |
145 ChromeUtilityHostMsg_RequestBlobBytes, | 149 ChromeUtilityHostMsg_RequestBlobBytes, |
146 OnUtilityProcessRequestBlobBytes) | 150 OnUtilityProcessRequestBlobBytes) |
147 IPC_MESSAGE_UNHANDLED(handled = false) | 151 IPC_MESSAGE_UNHANDLED(handled = false) |
148 IPC_END_MESSAGE_MAP() | 152 IPC_END_MESSAGE_MAP() |
149 return handled; | 153 return handled; |
150 } | 154 } |
151 | 155 |
152 } // namespace metadata | 156 } // namespace metadata |
OLD | NEW |