diff options
11 files changed, 37 insertions, 62 deletions
diff --git a/chrome/browser/chromeos/extensions/file_manager/event_router.cc b/chrome/browser/chromeos/extensions/file_manager/event_router.cc index eb40b93..38416cc 100644 --- a/chrome/browser/chromeos/extensions/file_manager/event_router.cc +++ b/chrome/browser/chromeos/extensions/file_manager/event_router.cc @@ -155,7 +155,7 @@ bool IsRecoveryToolRunning(Profile* profile) { return false; const std::string kRecoveryToolIds[] = { - "kkebgepbbgbcmghedmmdfcbdcodlkngh", // Recovert tool staging + "kkebgepbbgbcmghedmmdfcbdcodlkngh", // Recovery tool staging "jndclpdbaamdhonoechobihbbiimdgai" // Recovery tool prod }; diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_tasks.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_tasks.cc index e2cb9fe..44efe99 100644 --- a/chrome/browser/chromeos/extensions/file_manager/private_api_tasks.cc +++ b/chrome/browser/chromeos/extensions/file_manager/private_api_tasks.cc @@ -27,6 +27,7 @@ namespace extensions { namespace { // Error messages. +const char kInvalidTask[] = "Invalid task: "; const char kInvalidFileUrl[] = "Invalid file URL"; // Make a set of unique filename suffixes out of the list of file URLs. @@ -95,7 +96,7 @@ bool FileBrowserPrivateExecuteTaskFunction::RunAsync() { file_manager::file_tasks::TaskDescriptor task; if (!file_manager::file_tasks::ParseTaskID(params->task_id, &task)) { - LOG(WARNING) << "Invalid task " << params->task_id; + SetError(kInvalidTask + params->task_id); results_ = Create(extensions::api::file_browser_private::TASK_RESULT_FAILED); return false; diff --git a/chrome/browser/chromeos/file_manager/file_browser_handlers.cc b/chrome/browser/chromeos/file_manager/file_browser_handlers.cc index 3159231..1222e10 100644 --- a/chrome/browser/chromeos/file_manager/file_browser_handlers.cc +++ b/chrome/browser/chromeos/file_manager/file_browser_handlers.cc @@ -200,7 +200,7 @@ FileBrowserHandlerExecutor::SetupFileAccessPermissions( scoped_refptr<fileapi::FileSystemContext> file_system_context_handler, const scoped_refptr<const Extension>& handler_extension, const std::vector<FileSystemURL>& file_urls) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); + DCHECK_CURRENTLY_ON(BrowserThread::FILE); DCHECK(handler_extension.get()); fileapi::ExternalFileSystemBackend* backend = @@ -298,7 +298,7 @@ void FileBrowserHandlerExecutor::ExecuteAfterSetupFileAccess( } void FileBrowserHandlerExecutor::ExecuteDoneOnUIThread(bool success) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + DCHECK_CURRENTLY_ON(BrowserThread::UI); if (!done_.is_null()) done_.Run( success @@ -310,7 +310,7 @@ void FileBrowserHandlerExecutor::ExecuteDoneOnUIThread(bool success) { void FileBrowserHandlerExecutor::ExecuteFileActionsOnUIThread( scoped_ptr<FileDefinitionList> file_definition_list, scoped_ptr<EntryDefinitionList> entry_definition_list) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + DCHECK_CURRENTLY_ON(BrowserThread::UI); if (file_definition_list->empty() || entry_definition_list->empty()) { ExecuteDoneOnUIThread(false); @@ -471,11 +471,8 @@ bool ExecuteFileBrowserHandler( // files to be directly opened with the browser. if (ShouldBeOpenedWithBrowser(extension->id(), action_id)) { const bool result = OpenFilesWithBrowser(profile, file_urls); - if (!done.is_null()) { - done.Run(result - ? extensions::api::file_browser_private::TASK_RESULT_OPENED - : extensions::api::file_browser_private::TASK_RESULT_FAILED); - } + if (result && !done.is_null()) + done.Run(extensions::api::file_browser_private::TASK_RESULT_OPENED); return result; } diff --git a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc index 23ce0fc..a7c9470 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc +++ b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc @@ -13,10 +13,7 @@ #include "apps/app_window.h" #include "apps/app_window_registry.h" -#include "ash/session/session_state_delegate.h" -#include "ash/shell.h" #include "base/bind.h" -#include "base/callback.h" #include "base/file_util.h" #include "base/files/file_path.h" #include "base/json/json_reader.h" @@ -24,10 +21,8 @@ #include "base/json/json_writer.h" #include "base/prefs/pref_service.h" #include "base/strings/string_piece.h" -#include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/time/time.h" -#include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chromeos/drive/drive_integration_service.h" #include "chrome/browser/chromeos/drive/file_system_interface.h" @@ -43,13 +38,11 @@ #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/extensions/extension_test_message_listener.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chromeos/chromeos_switches.h" -#include "content/public/browser/browser_context.h" #include "content/public/browser/notification_service.h" #include "content/public/test/test_utils.h" #include "extensions/browser/api/test/test_api.h" @@ -190,7 +183,6 @@ struct AddEntriesMessage { base::JSONValueConverter<AddEntriesMessage>* converter); }; - // static void AddEntriesMessage::RegisterJSONConverter( base::JSONValueConverter<AddEntriesMessage>* converter) { diff --git a/chrome/browser/chromeos/file_manager/file_tasks.cc b/chrome/browser/chromeos/file_manager/file_tasks.cc index 271c4fa..1733bd3 100644 --- a/chrome/browser/chromeos/file_manager/file_tasks.cc +++ b/chrome/browser/chromeos/file_manager/file_tasks.cc @@ -46,10 +46,6 @@ namespace { // The values "file" and "app" are confusing, but cannot be changed easily as // these are used in default task IDs stored in preferences. -// -// TODO(satorux): We should rename them to "file_browser_handler" and -// "file_handler" respectively when switching from preferences to -// chrome.storage crbug.com/267359 const char kFileBrowserHandlerTaskType[] = "file"; const char kFileHandlerTaskType[] = "app"; const char kDriveAppTaskType[] = "drive"; @@ -283,7 +279,6 @@ bool ParseTaskID(const std::string& task_id, TaskDescriptor* task) { // Parse a legacy task ID that only contain two parts. Drive tasks are // identified by a prefix "drive-app:" on the extension ID. The legacy task // IDs can be stored in preferences. - // TODO(satorux): We should get rid of this code: crbug.com/267359. if (count == 2) { if (StartsWithASCII(result[0], kDriveTaskExtensionPrefix, true)) { task->task_type = TASK_TYPE_DRIVE_APP; diff --git a/chrome/browser/chromeos/file_manager/file_tasks.h b/chrome/browser/chromeos/file_manager/file_tasks.h index 0b6d519..0d9d964 100644 --- a/chrome/browser/chromeos/file_manager/file_tasks.h +++ b/chrome/browser/chromeos/file_manager/file_tasks.h @@ -210,8 +210,6 @@ std::string MakeTaskID(const std::string& app_id, const std::string& action_id); // Returns a task id for the Drive app with |app_id|. -// TODO(gspencer): For now, the action id is always "open-with", but we -// could add any actions that the drive app supports. std::string MakeDriveAppTaskId(const std::string& app_id); // Converts |task_descriptor| to a task ID. diff --git a/chrome/browser/chromeos/file_manager/file_watcher.cc b/chrome/browser/chromeos/file_manager/file_watcher.cc index 8823630..bd46237 100644 --- a/chrome/browser/chromeos/file_manager/file_watcher.cc +++ b/chrome/browser/chromeos/file_manager/file_watcher.cc @@ -5,7 +5,6 @@ #include "chrome/browser/chromeos/file_manager/file_watcher.h" #include "base/bind.h" -#include "base/message_loop/message_loop_proxy.h" #include "content/public/browser/browser_thread.h" #include "google_apis/drive/task_util.h" @@ -19,7 +18,7 @@ namespace { base::FilePathWatcher* CreateAndStartFilePathWatcher( const base::FilePath& watch_path, const base::FilePathWatcher::Callback& callback) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); + DCHECK_CURRENTLY_ON(BrowserThread::FILE); DCHECK(!callback.is_null()); scoped_ptr<base::FilePathWatcher> watcher(new base::FilePathWatcher); @@ -35,11 +34,11 @@ FileWatcher::FileWatcher(const base::FilePath& virtual_path) : local_file_watcher_(NULL), virtual_path_(virtual_path), weak_ptr_factory_(this) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + DCHECK_CURRENTLY_ON(BrowserThread::UI); } FileWatcher::~FileWatcher() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + DCHECK_CURRENTLY_ON(BrowserThread::UI); BrowserThread::DeleteSoon(BrowserThread::FILE, FROM_HERE, @@ -47,13 +46,13 @@ FileWatcher::~FileWatcher() { } void FileWatcher::AddExtension(const std::string& extension_id) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + DCHECK_CURRENTLY_ON(BrowserThread::UI); extensions_[extension_id]++; } void FileWatcher::RemoveExtension(const std::string& extension_id) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + DCHECK_CURRENTLY_ON(BrowserThread::UI); ExtensionCountMap::iterator it = extensions_.find(extension_id); if (it == extensions_.end()) { @@ -83,7 +82,7 @@ void FileWatcher::WatchLocalFile( const base::FilePath& local_path, const base::FilePathWatcher::Callback& file_watcher_callback, const BoolCallback& callback) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(!callback.is_null()); DCHECK(!local_file_watcher_); @@ -101,7 +100,7 @@ void FileWatcher::WatchLocalFile( void FileWatcher::OnWatcherStarted( const BoolCallback& callback, base::FilePathWatcher* file_watcher) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(!callback.is_null()); DCHECK(!local_file_watcher_); diff --git a/chrome/browser/chromeos/file_manager/fileapi_util.cc b/chrome/browser/chromeos/file_manager/fileapi_util.cc index 68e4cab..e840832 100644 --- a/chrome/browser/chromeos/file_manager/fileapi_util.cc +++ b/chrome/browser/chromeos/file_manager/fileapi_util.cc @@ -100,7 +100,7 @@ FileDefinitionListConverter::FileDefinitionListConverter( file_definition_list_(file_definition_list), callback_(callback), result_(new EntryDefinitionList) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + DCHECK_CURRENTLY_ON(BrowserThread::UI); // File browser APIs are meant to be used only from extension context, so // the extension's site is the one in whose file system context the virtual @@ -158,7 +158,7 @@ void FileDefinitionListConverter::OnResolvedURL( const fileapi::FileSystemInfo& info, const base::FilePath& file_path, fileapi::FileSystemContext::ResolvedEntryType type) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + DCHECK_CURRENTLY_ON(BrowserThread::UI); if (error != base::File::FILE_OK) { OnIteratorConverted(self_deleter.Pass(), @@ -319,7 +319,7 @@ void ConvertFileDefinitionListToEntryDefinitionList( const std::string& extension_id, const FileDefinitionList& file_definition_list, const EntryDefinitionListCallback& callback) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + DCHECK_CURRENTLY_ON(BrowserThread::UI); // The converter object destroys itself. new FileDefinitionListConverter( @@ -331,7 +331,7 @@ void ConvertFileDefinitionToEntryDefinition( const std::string& extension_id, const FileDefinition& file_definition, const EntryDefinitionCallback& callback) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + DCHECK_CURRENTLY_ON(BrowserThread::UI); FileDefinitionList file_definition_list; file_definition_list.push_back(file_definition); diff --git a/chrome/browser/chromeos/file_manager/open_util.cc b/chrome/browser/chromeos/file_manager/open_util.cc index 3378da0..b0c97d2a 100644 --- a/chrome/browser/chromeos/file_manager/open_util.cc +++ b/chrome/browser/chromeos/file_manager/open_util.cc @@ -90,8 +90,6 @@ void OpenFileManagerWithInternalActionId(Profile* profile, // Opens the file specified by |url| by finding and executing a file // task for the file. Returns false if failed to open the file (i.e. no file // task is found). -// TODO(fukino): curbug.com/352250. Currently |path| is used only for retrieving -// file extension, but we might want to sniff file contents and infer mime type. bool OpenFile(Profile* profile, const base::FilePath& path, const GURL& url) { // The file is opened per the file extension, hence extension-less files // cannot be opened properly. @@ -129,7 +127,7 @@ void ContinueOpenItem(Profile* profile, const base::FilePath& file_path, const GURL& url, base::File::Error error) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + DCHECK_CURRENTLY_ON(BrowserThread::UI); if (error == base::File::FILE_OK) { // A directory exists at |url|. Open it with the file manager. @@ -170,7 +168,7 @@ bool ConvertPath(Profile* profile, } // namespace void OpenRemovableDrive(Profile* profile, const base::FilePath& file_path) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + DCHECK_CURRENTLY_ON(BrowserThread::UI); base::FilePath converted_path; GURL url; @@ -181,7 +179,7 @@ void OpenRemovableDrive(Profile* profile, const base::FilePath& file_path) { } void OpenItem(Profile* profile, const base::FilePath& file_path) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + DCHECK_CURRENTLY_ON(BrowserThread::UI); base::FilePath converted_path; GURL url; @@ -195,7 +193,7 @@ void OpenItem(Profile* profile, const base::FilePath& file_path) { } void ShowItemInFolder(Profile* profile, const base::FilePath& file_path) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + DCHECK_CURRENTLY_ON(BrowserThread::UI); base::FilePath converted_path; GURL url; diff --git a/chrome/browser/chromeos/file_manager/open_with_browser.cc b/chrome/browser/chromeos/file_manager/open_with_browser.cc index 0a3bb52..e3608d9 100644 --- a/chrome/browser/chromeos/file_manager/open_with_browser.cc +++ b/chrome/browser/chromeos/file_manager/open_with_browser.cc @@ -97,7 +97,7 @@ bool IsFlashPluginEnabled(Profile* profile) { } void OpenNewTab(Profile* profile, const GURL& url) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + DCHECK_CURRENTLY_ON(BrowserThread::UI); // Check the validity of the pointer so that the closure from // base::Bind(&OpenNewTab, profile) can be passed between threads. @@ -128,7 +128,7 @@ GURL ReadUrlFromGDocOnBlockingPool(const base::FilePath& file_path) { } // namespace bool OpenFileWithBrowser(Profile* profile, const base::FilePath& file_path) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(profile); // For things supported natively by the browser, we should open it diff --git a/chrome/browser/chromeos/file_manager/volume_manager.cc b/chrome/browser/chromeos/file_manager/volume_manager.cc index 2ed9c2f..29e9f91 100644 --- a/chrome/browser/chromeos/file_manager/volume_manager.cc +++ b/chrome/browser/chromeos/file_manager/volume_manager.cc @@ -6,18 +6,14 @@ #include "base/basictypes.h" #include "base/bind.h" -#include "base/callback.h" #include "base/command_line.h" #include "base/files/file_path.h" #include "base/logging.h" -#include "base/memory/singleton.h" #include "base/metrics/histogram.h" #include "base/prefs/pref_service.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" -#include "base/sys_info.h" #include "chrome/browser/chromeos/drive/drive_integration_service.h" -#include "chrome/browser/chromeos/drive/file_errors.h" #include "chrome/browser/chromeos/drive/file_system_interface.h" #include "chrome/browser/chromeos/drive/file_system_util.h" #include "chrome/browser/chromeos/file_manager/mounted_disk_monitor.h" @@ -32,7 +28,6 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chromeos/chromeos_switches.h" -#include "chromeos/dbus/cros_disks_client.h" #include "chromeos/disks/disk_mount_manager.h" #include "components/storage_monitor/storage_monitor.h" #include "content/public/browser/browser_context.h" @@ -421,19 +416,19 @@ void VolumeManager::Shutdown() { } void VolumeManager::AddObserver(VolumeManagerObserver* observer) { - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK(observer); observers_.AddObserver(observer); } void VolumeManager::RemoveObserver(VolumeManagerObserver* observer) { - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK(observer); observers_.RemoveObserver(observer); } std::vector<VolumeInfo> VolumeManager::GetVolumeInfoList() const { - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); std::vector<VolumeInfo> result; for (std::map<std::string, VolumeInfo>::const_iterator iter = @@ -447,7 +442,7 @@ std::vector<VolumeInfo> VolumeManager::GetVolumeInfoList() const { bool VolumeManager::FindVolumeInfoById(const std::string& volume_id, VolumeInfo* result) const { - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK(result); std::map<std::string, VolumeInfo>::const_iterator iter = @@ -460,7 +455,7 @@ bool VolumeManager::FindVolumeInfoById(const std::string& volume_id, bool VolumeManager::RegisterDownloadsDirectoryForTesting( const base::FilePath& path) { - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); base::FilePath old_path; if (FindDownloadsMountPointPath(profile_, &old_path)) { @@ -479,14 +474,14 @@ bool VolumeManager::RegisterDownloadsDirectoryForTesting( void VolumeManager::AddVolumeInfoForTesting(const base::FilePath& path, VolumeType volume_type, chromeos::DeviceType device_type) { - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DoMountEvent(chromeos::MOUNT_ERROR_NONE, CreateTestingVolumeInfo(path, volume_type, device_type), kNotRemounting); } void VolumeManager::OnFileSystemMounted() { - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); // Raise mount event. // We can pass chromeos::MOUNT_ERROR_NONE even when authentication is failed @@ -496,7 +491,7 @@ void VolumeManager::OnFileSystemMounted() { } void VolumeManager::OnFileSystemBeingUnmounted() { - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); VolumeInfo volume_info = CreateDriveVolumeInfo(profile_); DoUnmountEvent(chromeos::MOUNT_ERROR_NONE, volume_info); @@ -505,7 +500,7 @@ void VolumeManager::OnFileSystemBeingUnmounted() { void VolumeManager::OnDiskEvent( chromeos::disks::DiskMountManager::DiskEvent event, const chromeos::disks::DiskMountManager::Disk* disk) { - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); // Disregard hidden devices. if (disk->is_hidden()) @@ -559,7 +554,7 @@ void VolumeManager::OnDiskEvent( void VolumeManager::OnDeviceEvent( chromeos::disks::DiskMountManager::DeviceEvent event, const std::string& device_path) { - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DVLOG(1) << "OnDeviceEvent: " << event << ", " << device_path; switch (event) { @@ -587,7 +582,7 @@ void VolumeManager::OnMountEvent( chromeos::disks::DiskMountManager::MountEvent event, chromeos::MountError error_code, const chromeos::disks::DiskMountManager::MountPointInfo& mount_info) { - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK_NE(chromeos::MOUNT_TYPE_INVALID, mount_info.mount_type); if (mount_info.mount_type == chromeos::MOUNT_TYPE_ARCHIVE) { @@ -632,7 +627,7 @@ void VolumeManager::OnFormatEvent( chromeos::disks::DiskMountManager::FormatEvent event, chromeos::FormatError error_code, const std::string& device_path) { - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DVLOG(1) << "OnDeviceEvent: " << event << ", " << error_code << ", " << device_path; |