| 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" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "chrome/browser/chromeos/extensions/file_handler_util.h" | 16 #include "chrome/browser/chromeos/extensions/file_handler_util.h" |
| 17 #include "chrome/browser/chromeos/gdata/gdata.pb.h" | 17 #include "chrome/browser/chromeos/gdata/drive.pb.h" |
| 18 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" | 18 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" |
| 19 #include "chrome/browser/chromeos/gdata/gdata_files.h" | 19 #include "chrome/browser/chromeos/gdata/gdata_files.h" |
| 20 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" | 20 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" |
| 21 #include "chrome/browser/chromeos/gdata/gdata_util.h" | 21 #include "chrome/browser/chromeos/gdata/gdata_util.h" |
| 22 #include "chrome/browser/chromeos/gdata/operation_registry.h" | 22 #include "chrome/browser/chromeos/gdata/operation_registry.h" |
| 23 #include "chrome/browser/chromeos/media/media_player.h" | 23 #include "chrome/browser/chromeos/media/media_player.h" |
| 24 #include "chrome/browser/extensions/crx_installer.h" | 24 #include "chrome/browser/extensions/crx_installer.h" |
| 25 #include "chrome/browser/extensions/extension_install_prompt.h" | 25 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 26 #include "chrome/browser/extensions/extension_service.h" | 26 #include "chrome/browser/extensions/extension_service.h" |
| 27 #include "chrome/browser/plugin_prefs.h" | 27 #include "chrome/browser/plugin_prefs.h" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 l10n_util::GetStringUTF16(IDS_FILE_BROWSER_ERROR_VIEWING_FILE), | 225 l10n_util::GetStringUTF16(IDS_FILE_BROWSER_ERROR_VIEWING_FILE), |
| 226 chrome::MESSAGE_BOX_TYPE_WARNING); | 226 chrome::MESSAGE_BOX_TYPE_WARNING); |
| 227 } | 227 } |
| 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::DriveEntryProto> entry_proto) { |
| 236 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 236 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 237 | 237 |
| 238 if (entry_proto.get() && !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(), |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 OperationRegistry::ProgressStatus>::const_iterator iter = | 719 OperationRegistry::ProgressStatus>::const_iterator iter = |
| 720 list.begin(); | 720 list.begin(); |
| 721 iter != list.end(); ++iter) { | 721 iter != list.end(); ++iter) { |
| 722 result_list->Append( | 722 result_list->Append( |
| 723 ProgessStatusToDictionaryValue(profile, origin_url, *iter)); | 723 ProgessStatusToDictionaryValue(profile, origin_url, *iter)); |
| 724 } | 724 } |
| 725 return result_list.release(); | 725 return result_list.release(); |
| 726 } | 726 } |
| 727 | 727 |
| 728 } // namespace file_manager_util | 728 } // namespace file_manager_util |
| OLD | NEW |