OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/chromeos/extensions/file_manager_util.h" | 4 #include "chrome/browser/chromeos/extensions/file_manager_util.h" |
5 | 5 |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 | 228 |
229 // Called when a file on GData was found. Opens the file found at |file_path| | 229 // Called when a file on GData was found. Opens the file found at |file_path| |
230 // in a new tab with a URL computed based on the |file_type| | 230 // in a new tab with a URL computed based on the |file_type| |
231 void OnGDataFileFound(Profile* profile, | 231 void OnGDataFileFound(Profile* profile, |
232 const FilePath& file_path, | 232 const FilePath& file_path, |
233 gdata::GDataFileType file_type, | 233 gdata::GDataFileType file_type, |
234 gdata::GDataFileError error, | 234 gdata::GDataFileError error, |
235 scoped_ptr<gdata::GDataEntryProto> entry_proto) { | 235 scoped_ptr<gdata::GDataEntryProto> entry_proto) { |
236 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 236 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
237 | 237 |
238 if (!entry_proto->has_file_specific_info()) | 238 if (entry_proto.get() && !entry_proto->has_file_specific_info()) |
239 error = gdata::GDATA_FILE_ERROR_NOT_FOUND; | 239 error = gdata::GDATA_FILE_ERROR_NOT_FOUND; |
240 | 240 |
241 if (error == gdata::GDATA_FILE_OK) { | 241 if (error == gdata::GDATA_FILE_OK) { |
242 GURL page_url; | 242 GURL page_url; |
243 if (file_type == gdata::REGULAR_FILE) { | 243 if (file_type == gdata::REGULAR_FILE) { |
244 page_url = gdata::util::GetFileResourceUrl( | 244 page_url = gdata::util::GetFileResourceUrl( |
245 entry_proto->resource_id(), | 245 entry_proto->resource_id(), |
246 entry_proto->base_name()); | 246 entry_proto->base_name()); |
247 } else if (file_type == gdata::HOSTED_DOCUMENT) { | 247 } else if (file_type == gdata::HOSTED_DOCUMENT) { |
248 page_url = GURL(entry_proto->file_specific_info().alternate_url()); | 248 page_url = GURL(entry_proto->file_specific_info().alternate_url()); |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 GDataOperationRegistry::ProgressStatus>::const_iterator iter = | 716 GDataOperationRegistry::ProgressStatus>::const_iterator iter = |
717 list.begin(); | 717 list.begin(); |
718 iter != list.end(); ++iter) { | 718 iter != list.end(); ++iter) { |
719 result_list->Append( | 719 result_list->Append( |
720 ProgessStatusToDictionaryValue(profile, origin_url, *iter)); | 720 ProgessStatusToDictionaryValue(profile, origin_url, *iter)); |
721 } | 721 } |
722 return result_list.release(); | 722 return result_list.release(); |
723 } | 723 } |
724 | 724 |
725 } // namespace file_manager_util | 725 } // namespace file_manager_util |
OLD | NEW |