Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(420)

Unified Diff: chrome/browser/extensions/api/system_info_storage/system_info_storage_api.cc

Issue 18578008: [SystemInfo API] Move Storage API out of experimental namespace and rename to the "system" namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix PermissionTest unittest. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/system_info_storage/system_info_storage_api.cc
diff --git a/chrome/browser/extensions/api/system_info_storage/system_info_storage_api.cc b/chrome/browser/extensions/api/system_info_storage/system_info_storage_api.cc
deleted file mode 100644
index 8249eaa8b566533a638bcd9eb3e856b09f2a7329..0000000000000000000000000000000000000000
--- a/chrome/browser/extensions/api/system_info_storage/system_info_storage_api.cc
+++ /dev/null
@@ -1,144 +0,0 @@
-// Copyright (c) 2012 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.
-#include "chrome/browser/extensions/api/system_info_storage/system_info_storage_api.h"
-
-namespace extensions {
-
-using api::experimental_system_info_storage::StorageUnitInfo;
-namespace EjectDevice = api::experimental_system_info_storage::EjectDevice;
-
-SystemInfoStorageGetFunction::SystemInfoStorageGetFunction() {
-}
-
-SystemInfoStorageGetFunction::~SystemInfoStorageGetFunction() {
-}
-
-bool SystemInfoStorageGetFunction::RunImpl() {
- StorageInfoProvider::Get()->StartQueryInfo(
- base::Bind(&SystemInfoStorageGetFunction::OnGetStorageInfoCompleted,
- this));
- return true;
-}
-
-void SystemInfoStorageGetFunction::OnGetStorageInfoCompleted(bool success) {
- if (success) {
- results_ =
- api::experimental_system_info_storage::Get::Results::Create(
- StorageInfoProvider::Get()->storage_unit_info_list());
- } else {
- SetError("Error occurred when querying storage information.");
- }
-
- SendResponse(success);
-}
-
-SystemInfoStorageEjectDeviceFunction::~SystemInfoStorageEjectDeviceFunction() {
-}
-
-bool SystemInfoStorageEjectDeviceFunction::RunImpl() {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
-
- scoped_ptr<EjectDevice::Params> params(EjectDevice::Params::Create(*args_));
- EXTENSION_FUNCTION_VALIDATE(params.get());
-
- chrome::StorageMonitor::GetInstance()->EnsureInitialized(base::Bind(
- &SystemInfoStorageEjectDeviceFunction::OnStorageMonitorInit,
- this,
- params->id));
- return true;
-}
-
-void SystemInfoStorageEjectDeviceFunction::OnStorageMonitorInit(
- const std::string& transient_device_id) {
- DCHECK(chrome::StorageMonitor::GetInstance()->IsInitialized());
- chrome::StorageMonitor* monitor = chrome::StorageMonitor::GetInstance();
- std::string device_id_str =
- StorageInfoProvider::Get()->GetDeviceIdForTransientId(
- transient_device_id);
-
- if (device_id_str == "") {
- HandleResponse(chrome::StorageMonitor::EJECT_NO_SUCH_DEVICE);
- return;
- }
-
- monitor->EjectDevice(
- device_id_str,
- base::Bind(&SystemInfoStorageEjectDeviceFunction::HandleResponse,
- this));
-}
-
-void SystemInfoStorageEjectDeviceFunction::HandleResponse(
- chrome::StorageMonitor::EjectStatus status) {
- api::experimental_system_info_storage:: EjectDeviceResultCode result =
- api::experimental_system_info_storage::EJECT_DEVICE_RESULT_CODE_FAILURE;
- switch (status) {
- case chrome::StorageMonitor::EJECT_OK:
- result = api::experimental_system_info_storage::
- EJECT_DEVICE_RESULT_CODE_SUCCESS;
- break;
- case chrome::StorageMonitor::EJECT_IN_USE:
- result = api::experimental_system_info_storage::
- EJECT_DEVICE_RESULT_CODE_IN_USE;
- break;
- case chrome::StorageMonitor::EJECT_NO_SUCH_DEVICE:
- result = api::experimental_system_info_storage::
- EJECT_DEVICE_RESULT_CODE_NO_SUCH_DEVICE;
- break;
- case chrome::StorageMonitor::EJECT_FAILURE:
- result = api::experimental_system_info_storage::
- EJECT_DEVICE_RESULT_CODE_FAILURE;
- }
-
- SetResult(base::StringValue::CreateStringValue(
- api::experimental_system_info_storage::ToString(result)));
- SendResponse(true);
-}
-
-SystemInfoStorageAddWatchFunction::SystemInfoStorageAddWatchFunction() {
-}
-
-SystemInfoStorageAddWatchFunction::~SystemInfoStorageAddWatchFunction() {
-}
-
-bool SystemInfoStorageAddWatchFunction::RunImpl() {
- // TODO(Haojian): Implement the addWatch api.
- return false;
-}
-
-SystemInfoStorageRemoveWatchFunction::SystemInfoStorageRemoveWatchFunction() {
-}
-
-SystemInfoStorageRemoveWatchFunction::~SystemInfoStorageRemoveWatchFunction() {
-}
-
-bool SystemInfoStorageRemoveWatchFunction::RunImpl() {
- // TODO(Haojian): Implement the removeWatch api.
- return false;
-}
-
-SystemInfoStorageGetAllWatchFunction::SystemInfoStorageGetAllWatchFunction() {
-}
-
-SystemInfoStorageGetAllWatchFunction::~SystemInfoStorageGetAllWatchFunction() {
-}
-
-bool SystemInfoStorageGetAllWatchFunction::RunImpl() {
- // TODO(Haojian): Implement the getAllWatch api.
- return false;
-}
-
-SystemInfoStorageRemoveAllWatchFunction::
-SystemInfoStorageRemoveAllWatchFunction() {
-}
-
-SystemInfoStorageRemoveAllWatchFunction::
-~SystemInfoStorageRemoveAllWatchFunction() {
-}
-
-bool SystemInfoStorageRemoveAllWatchFunction::RunImpl() {
- // TODO(Haojian): Implement the removeAllWatch api.
- return false;
-}
-
-} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698