blob: 922864d2245fdd4506c684c6e1a45e7cbcf7e9ad [file] [log] [blame]
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// This file provides miscellaneous API functions, which don't belong to
// other files.
#ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MISC_H_
#define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MISC_H_
#include "chrome/browser/chromeos/extensions/file_manager/private_api_base.h"
#include "chrome/browser/chromeos/extensions/file_manager/zip_file_creator.h"
namespace file_manager {
// Implements the chrome.fileBrowserPrivate.logoutUser method.
class LogoutUserFunction : public SyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.logoutUser",
FILEBROWSERPRIVATE_LOGOUTUSER)
LogoutUserFunction();
protected:
virtual ~LogoutUserFunction();
// SyncExtensionFunction overrides.
virtual bool RunImpl() OVERRIDE;
};
// Implements the chrome.fileBrowserPrivate.getPreferences method.
// Gets settings for Files.app.
class GetPreferencesFunction : public SyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.getPreferences",
FILEBROWSERPRIVATE_GETPREFERENCES)
GetPreferencesFunction();
protected:
virtual ~GetPreferencesFunction();
virtual bool RunImpl() OVERRIDE;
};
// Implements the chrome.fileBrowserPrivate.setPreferences method.
// Sets settings for Files.app.
class SetPreferencesFunction : public SyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.setPreferences",
FILEBROWSERPRIVATE_SETPREFERENCES)
SetPreferencesFunction();
protected:
virtual ~SetPreferencesFunction();
virtual bool RunImpl() OVERRIDE;
};
// Implements the chrome.fileBrowserPrivate.zipSelection method.
// Creates a zip file for the selected files.
class ZipSelectionFunction : public LoggedAsyncExtensionFunction,
public ZipFileCreator::Observer {
public:
DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.zipSelection",
FILEBROWSERPRIVATE_ZIPSELECTION)
ZipSelectionFunction();
protected:
virtual ~ZipSelectionFunction();
// AsyncExtensionFunction overrides.
virtual bool RunImpl() OVERRIDE;
// extensions::ZipFileCreator::Delegate overrides.
virtual void OnZipDone(bool success) OVERRIDE;
private:
scoped_refptr<ZipFileCreator> zip_file_creator_;
};
// Implements the chrome.fileBrowserPrivate.zoom method.
// Changes the zoom level of the file manager by internally calling
// RenderViewHost::Zoom(). TODO(hirono): Remove this function once the zoom
// level change is supported for all apps. crbug.com/227175.
class ZoomFunction : public SyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.zoom",
FILEBROWSERPRIVATE_ZOOM);
ZoomFunction();
protected:
virtual ~ZoomFunction();
virtual bool RunImpl() OVERRIDE;
};
} // namespace file_manager
#endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MISC_H_