Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1508)

Side by Side Diff: chrome/browser/media_galleries/fileapi/safe_picasa_albums_indexer.cc

Issue 18986012: Media Galleries API Picasa: Make PicasaDataProvider handle async PMP and INI parsing robustly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@0039-picasa-import-sandbox-ini-parsing
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_albums_indexer.h" 5 #include "chrome/browser/media_galleries/fileapi/safe_picasa_albums_indexer.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" 8 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h"
9 #include "chrome/common/chrome_utility_messages.h" 9 #include "chrome/common/chrome_utility_messages.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 114 }
115 115
116 void SafePicasaAlbumsIndexer::OnIndexPicasaAlbumsContentsFinished( 116 void SafePicasaAlbumsIndexer::OnIndexPicasaAlbumsContentsFinished(
117 const AlbumImagesMap& albums_images) { 117 const AlbumImagesMap& albums_images) {
118 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 118 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
119 if (parser_state_ != STARTED_PARSING_STATE) 119 if (parser_state_ != STARTED_PARSING_STATE)
120 return; 120 return;
121 121
122 MediaFileSystemBackend::MediaTaskRunner()->PostTask( 122 MediaFileSystemBackend::MediaTaskRunner()->PostTask(
123 FROM_HERE, 123 FROM_HERE,
124 base::Bind(callback_, true, albums_images)); 124 base::Bind(callback_,
125 make_scoped_refptr(this),
126 true,
127 albums_images));
125 parser_state_ = FINISHED_PARSING_STATE; 128 parser_state_ = FINISHED_PARSING_STATE;
126 } 129 }
127 130
128 void SafePicasaAlbumsIndexer::OnProcessCrashed(int exit_code) { 131 void SafePicasaAlbumsIndexer::OnProcessCrashed(int exit_code) {
129 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 132 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
130 133
131 MediaFileSystemBackend::MediaTaskRunner()->PostTask( 134 MediaFileSystemBackend::MediaTaskRunner()->PostTask(
132 FROM_HERE, 135 FROM_HERE,
133 base::Bind(callback_, false, AlbumImagesMap())); 136 base::Bind(callback_,
137 make_scoped_refptr(this),
138 false,
139 AlbumImagesMap()));
134 } 140 }
135 141
136 bool SafePicasaAlbumsIndexer::OnMessageReceived( 142 bool SafePicasaAlbumsIndexer::OnMessageReceived(
137 const IPC::Message& message) { 143 const IPC::Message& message) {
138 bool handled = true; 144 bool handled = true;
139 IPC_BEGIN_MESSAGE_MAP(SafePicasaAlbumsIndexer, message) 145 IPC_BEGIN_MESSAGE_MAP(SafePicasaAlbumsIndexer, message)
140 IPC_MESSAGE_HANDLER( 146 IPC_MESSAGE_HANDLER(
141 ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished, 147 ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished,
142 OnIndexPicasaAlbumsContentsFinished) 148 OnIndexPicasaAlbumsContentsFinished)
143 IPC_MESSAGE_UNHANDLED(handled = false) 149 IPC_MESSAGE_UNHANDLED(handled = false)
144 IPC_END_MESSAGE_MAP() 150 IPC_END_MESSAGE_MAP()
145 return handled; 151 return handled;
146 } 152 }
147 153
148 } // namespace picasa 154 } // namespace picasa
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698