| 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 UTF8ToUTF16(path.BaseName().value())), | 226 UTF8ToUTF16(path.BaseName().value())), |
| 227 l10n_util::GetStringUTF16(IDS_FILE_BROWSER_ERROR_VIEWING_FILE), | 227 l10n_util::GetStringUTF16(IDS_FILE_BROWSER_ERROR_VIEWING_FILE), |
| 228 chrome::MESSAGE_BOX_TYPE_WARNING); | 228 chrome::MESSAGE_BOX_TYPE_WARNING); |
| 229 } | 229 } |
| 230 | 230 |
| 231 // Called when a file on GData was found. Opens the file found at |file_path| | 231 // Called when a file on GData was found. Opens the file found at |file_path| |
| 232 // in a new tab with a URL computed based on the |file_type| | 232 // in a new tab with a URL computed based on the |file_type| |
| 233 void OnGDataFileFound(Profile* profile, | 233 void OnGDataFileFound(Profile* profile, |
| 234 const FilePath& file_path, | 234 const FilePath& file_path, |
| 235 gdata::DriveFileType file_type, | 235 gdata::DriveFileType file_type, |
| 236 gdata::GDataFileError error, | 236 gdata::DriveFileError error, |
| 237 scoped_ptr<gdata::DriveEntryProto> entry_proto) { | 237 scoped_ptr<gdata::DriveEntryProto> entry_proto) { |
| 238 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 238 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 239 | 239 |
| 240 if (entry_proto.get() && !entry_proto->has_file_specific_info()) | 240 if (entry_proto.get() && !entry_proto->has_file_specific_info()) |
| 241 error = gdata::GDATA_FILE_ERROR_NOT_FOUND; | 241 error = gdata::DRIVE_FILE_ERROR_NOT_FOUND; |
| 242 | 242 |
| 243 if (error == gdata::GDATA_FILE_OK) { | 243 if (error == gdata::DRIVE_FILE_OK) { |
| 244 GURL page_url; | 244 GURL page_url; |
| 245 if (file_type == gdata::REGULAR_FILE) { | 245 if (file_type == gdata::REGULAR_FILE) { |
| 246 page_url = gdata::util::GetFileResourceUrl( | 246 page_url = gdata::util::GetFileResourceUrl( |
| 247 entry_proto->resource_id(), | 247 entry_proto->resource_id(), |
| 248 entry_proto->base_name()); | 248 entry_proto->base_name()); |
| 249 } else if (file_type == gdata::HOSTED_DOCUMENT) { | 249 } else if (file_type == gdata::HOSTED_DOCUMENT) { |
| 250 page_url = GURL(entry_proto->file_specific_info().alternate_url()); | 250 page_url = GURL(entry_proto->file_specific_info().alternate_url()); |
| 251 } else { | 251 } else { |
| 252 NOTREACHED(); | 252 NOTREACHED(); |
| 253 } | 253 } |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 OperationRegistry::ProgressStatus>::const_iterator iter = | 749 OperationRegistry::ProgressStatus>::const_iterator iter = |
| 750 list.begin(); | 750 list.begin(); |
| 751 iter != list.end(); ++iter) { | 751 iter != list.end(); ++iter) { |
| 752 result_list->Append( | 752 result_list->Append( |
| 753 ProgessStatusToDictionaryValue(profile, origin_url, *iter)); | 753 ProgessStatusToDictionaryValue(profile, origin_url, *iter)); |
| 754 } | 754 } |
| 755 return result_list.release(); | 755 return result_list.release(); |
| 756 } | 756 } |
| 757 | 757 |
| 758 } // namespace file_manager_util | 758 } // namespace file_manager_util |
| OLD | NEW |