OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_picasa_album_table_reader.
h" | 5 #include "chrome/browser/media_galleries/fileapi/safe_picasa_album_table_reader.
h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" | 11 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" |
12 #include "chrome/common/chrome_utility_messages.h" | 12 #include "chrome/common/chrome_utility_messages.h" |
13 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" | 13 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" |
14 #include "chrome/grit/generated_resources.h" | 14 #include "chrome/grit/generated_resources.h" |
15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
16 #include "content/public/browser/child_process_data.h" | 16 #include "content/public/browser/child_process_data.h" |
17 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
18 | 18 |
19 using content::BrowserThread; | 19 using content::BrowserThread; |
20 | 20 |
21 namespace picasa { | 21 namespace picasa { |
22 | 22 |
23 SafePicasaAlbumTableReader::SafePicasaAlbumTableReader( | 23 SafePicasaAlbumTableReader::SafePicasaAlbumTableReader( |
24 AlbumTableFiles album_table_files) | 24 AlbumTableFiles album_table_files) |
25 : album_table_files_(std::move(album_table_files)), | 25 : album_table_files_(std::move(album_table_files)), |
26 parser_state_(INITIAL_STATE) { | 26 parser_state_(INITIAL_STATE) { |
27 // TODO(tommycli): Add DCHECK to make sure |album_table_files| are all | 27 // TODO(tommycli): Add DCHECK to make sure |album_table_files| are all |
28 // opened read-only once security adds ability to check PlatformFiles. | 28 // opened read-only once security adds ability to check PlatformFiles. |
29 DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); | 29 MediaFileSystemBackend::AssertCurrentlyOnMediaSequence(); |
30 } | 30 } |
31 | 31 |
32 void SafePicasaAlbumTableReader::Start(const ParserCallback& callback) { | 32 void SafePicasaAlbumTableReader::Start(const ParserCallback& callback) { |
33 DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); | 33 MediaFileSystemBackend::AssertCurrentlyOnMediaSequence(); |
34 DCHECK(!callback.is_null()); | 34 DCHECK(!callback.is_null()); |
35 | 35 |
36 callback_ = callback; | 36 callback_ = callback; |
37 | 37 |
38 // Don't bother spawning process if any of the files are invalid. | 38 // Don't bother spawning process if any of the files are invalid. |
39 if (!album_table_files_.indicator_file.IsValid() || | 39 if (!album_table_files_.indicator_file.IsValid() || |
40 !album_table_files_.category_file.IsValid() || | 40 !album_table_files_.category_file.IsValid() || |
41 !album_table_files_.date_file.IsValid() || | 41 !album_table_files_.date_file.IsValid() || |
42 !album_table_files_.filename_file.IsValid() || | 42 !album_table_files_.filename_file.IsValid() || |
43 !album_table_files_.name_file.IsValid() || | 43 !album_table_files_.name_file.IsValid() || |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 bool handled = true; | 117 bool handled = true; |
118 IPC_BEGIN_MESSAGE_MAP(SafePicasaAlbumTableReader, message) | 118 IPC_BEGIN_MESSAGE_MAP(SafePicasaAlbumTableReader, message) |
119 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ParsePicasaPMPDatabase_Finished, | 119 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ParsePicasaPMPDatabase_Finished, |
120 OnParsePicasaPMPDatabaseFinished) | 120 OnParsePicasaPMPDatabaseFinished) |
121 IPC_MESSAGE_UNHANDLED(handled = false) | 121 IPC_MESSAGE_UNHANDLED(handled = false) |
122 IPC_END_MESSAGE_MAP() | 122 IPC_END_MESSAGE_MAP() |
123 return handled; | 123 return handled; |
124 } | 124 } |
125 | 125 |
126 } // namespace picasa | 126 } // namespace picasa |
OLD | NEW |