#include "chrome/browser/chromeos/extensions/file_manager/private_api_drive.h"
#include "chrome/browser/chromeos/drive/drive_integration_service.h"
-#include "chrome/browser/chromeos/drive/logging.h"
#include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h"
#include "chrome/browser/chromeos/file_manager/file_tasks.h"
+#include "chrome/browser/chromeos/file_manager/fileapi_util.h"
#include "chrome/browser/chromeos/file_manager/url_util.h"
#include "chrome/browser/chromeos/fileapi/file_system_backend.h"
#include "chrome/browser/drive/drive_app_registry.h"
+#include "chrome/browser/drive/event_logger.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/extensions/api/file_browser_private.h"
#include "content/public/browser/browser_thread.h"
if (error == drive::FILE_ERROR_OK) {
SendResponse(true);
} else {
- error_ = drive::FileErrorToString(error);
+ SetError(drive::FileErrorToString(error));
SendResponse(false);
}
}
if (error == drive::FILE_ERROR_OK) {
local_paths_.push_back(local_path.AsUTF8Unsafe());
DVLOG(1) << "Got " << drive_path.value() << " as " << local_path.value();
-
- // TODO(benchan): If the file is a hosted document, a temporary JSON file
- // is created to represent the document. The JSON file is not cached and
- // should be deleted after use. We need to somehow communicate with
- // file_manager.js to manage the lifetime of the temporary file.
- // See crosbug.com/28058.
} else {
local_paths_.push_back("");
DVLOG(1) << "Failed to get " << drive_path.value()
base::DictionaryValue* entry = new base::DictionaryValue();
entry->SetString("fileSystemName", info.name);
entry->SetString("fileSystemRoot", info.root_url.spec());
- entry->SetString("fileFullPath", "/" + results->at(i).path.value());
+ entry->SetString("fileFullPath",
+ "/" + file_manager::util::ConvertDrivePathToRelativeFileSystemPath(
+ GetProfile(), extension_->id(),
+ results->at(i).path).AsUTF8Unsafe());
entry->SetBoolean("fileIsDirectory", results->at(i).is_directory);
entries->Append(entry);
}
const scoped_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
- drive::util::Log(logging::LOG_INFO,
- "%s[%d] called. (types: '%s', maxResults: '%d')",
- name().c_str(),
- request_id(),
- api::file_browser_private::ToString(
- params->search_params.types).c_str(),
- params->search_params.max_results);
+ drive::EventLogger* logger = file_manager::util::GetLogger(GetProfile());
+ if (logger) {
+ logger->Log(logging::LOG_INFO,
+ "%s[%d] called. (types: '%s', maxResults: '%d')",
+ name().c_str(),
+ request_id(),
+ api::file_browser_private::ToString(
+ params->search_params.types).c_str(),
+ params->search_params.max_results);
+ }
set_log_on_completion(true);
drive::FileSystemInterface* const file_system =
base::DictionaryValue* entry = new base::DictionaryValue();
entry->SetString("fileSystemName", info.name);
entry->SetString("fileSystemRoot", info.root_url.spec());
- entry->SetString("fileFullPath", "/" + results->at(i).path.value());
+ entry->SetString("fileFullPath",
+ "/" + file_manager::util::ConvertDrivePathToRelativeFileSystemPath(
+ GetProfile(), extension_->id(),
+ results->at(i).path).AsUTF8Unsafe());
entry->SetBoolean("fileIsDirectory",
results->at(i).entry.file_info().is_directory());
results_ = api::file_browser_private::GetDriveConnectionState::Results::
Create(result);
- drive::util::Log(logging::LOG_INFO, "%s succeeded.", name().c_str());
+ drive::EventLogger* logger = file_manager::util::GetLogger(GetProfile());
+ if (logger)
+ logger->Log(logging::LOG_INFO, "%s succeeded.", name().c_str());
return true;
}
drive::FileError error,
const GURL& share_url) {
if (error != drive::FILE_ERROR_OK) {
- error_ = "Share Url for this item is not available.";
+ SetError("Share Url for this item is not available.");
SendResponse(false);
return;
}