#include "chrome/browser/ui/webui/chromeos/drive_internals_ui.h"
#include "base/bind.h"
-#include "base/command_line.h"
-#include "base/file_util.h"
#include "base/files/file_enumerator.h"
+#include "base/files/file_util.h"
#include "base/format_macros.h"
#include "base/memory/scoped_vector.h"
#include "base/memory/weak_ptr.h"
#include "google_apis/drive/auth_service.h"
#include "google_apis/drive/drive_api_parser.h"
#include "google_apis/drive/gdata_errorcode.h"
-#include "google_apis/drive/gdata_wapi_parser.h"
#include "google_apis/drive/time_util.h"
#include "grit/browser_resources.h"
// Formats |entry| into text.
std::string FormatEntry(const base::FilePath& path,
const drive::ResourceEntry& entry) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
using base::StringAppendF;
void DriveInternalsWebUIHandler::OnGetAboutResource(
google_apis::GDataErrorCode status,
scoped_ptr<google_apis::AboutResource> parsed_about_resource) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (status != google_apis::HTTP_SUCCESS) {
LOG(ERROR) << "Failed to get about resource";
void DriveInternalsWebUIHandler::OnGetAppList(
google_apis::GDataErrorCode status,
scoped_ptr<google_apis::AppList> parsed_app_list) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (status != google_apis::HTTP_SUCCESS) {
LOG(ERROR) << "Failed to get app list";
drive::DriveIntegrationService*
DriveInternalsWebUIHandler::GetIntegrationService() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
Profile* profile = Profile::FromWebUI(web_ui());
drive::DriveIntegrationService* service =
}
drive::DriveServiceInterface* DriveInternalsWebUIHandler::GetDriveService() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
Profile* profile = Profile::FromWebUI(web_ui());
return drive::util::GetDriveServiceByProfile(profile);
}
drive::DebugInfoCollector* DriveInternalsWebUIHandler::GetDebugInfoCollector() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
drive::DriveIntegrationService* integration_service = GetIntegrationService();
return integration_service ?
}
void DriveInternalsWebUIHandler::OnPageLoaded(const base::ListValue* args) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
drive::DriveIntegrationService* integration_service =
GetIntegrationService();
}
void DriveInternalsWebUIHandler::UpdateDriveRelatedPreferencesSection() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
const char* kDriveRelatedPreferences[] = {
prefs::kDisableDrive,
void DriveInternalsWebUIHandler::UpdateConnectionStatusSection(
drive::DriveServiceInterface* drive_service) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(drive_service);
std::string status;
void DriveInternalsWebUIHandler::UpdateAboutResourceSection(
drive::DriveServiceInterface* drive_service) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(drive_service);
drive_service->GetAboutResource(
void DriveInternalsWebUIHandler::UpdateAppListSection(
drive::DriveServiceInterface* drive_service) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(drive_service);
drive_service->GetAppList(
void DriveInternalsWebUIHandler::UpdateLocalMetadataSection(
drive::DebugInfoCollector* debug_info_collector) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(debug_info_collector);
debug_info_collector->GetMetadata(
void DriveInternalsWebUIHandler::OnGetFilesystemMetadataForLocal(
const drive::FileSystemMetadata& metadata) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
base::DictionaryValue local_metadata;
local_metadata.SetDouble("account-largest-changestamp-local",
}
void DriveInternalsWebUIHandler::ClearAccessToken(const base::ListValue* args) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
drive::DriveServiceInterface* drive_service = GetDriveService();
if (drive_service)
void DriveInternalsWebUIHandler::ClearRefreshToken(
const base::ListValue* args) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
drive::DriveServiceInterface* drive_service = GetDriveService();
if (drive_service)
void DriveInternalsWebUIHandler::ResetDriveFileSystem(
const base::ListValue* args) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
drive::DriveIntegrationService* integration_service =
GetIntegrationService();
}
void DriveInternalsWebUIHandler::ResetFinished(bool success) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
web_ui()->CallJavascriptFunction("updateResetStatus",
base::FundamentalValue(success));
}
void DriveInternalsWebUIHandler::ListFileEntries(const base::ListValue* args) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
UpdateFileSystemContentsSection();
}
void DriveInternalsWebUIHandler::UpdateDeltaUpdateStatusSection(
drive::DebugInfoCollector* debug_info_collector) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(debug_info_collector);
debug_info_collector->GetMetadata(
void DriveInternalsWebUIHandler::OnGetFilesystemMetadataForDeltaUpdate(
const drive::FileSystemMetadata& metadata) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
Profile* profile = Profile::FromWebUI(web_ui());
drive::DriveNotificationManager* drive_notification_manager =
- drive::DriveNotificationManagerFactory::GetForBrowserContext(profile);
+ drive::DriveNotificationManagerFactory::FindForBrowserContext(profile);
if (!drive_notification_manager)
return;
void DriveInternalsWebUIHandler::UpdateInFlightOperationsSection(
drive::JobListInterface* job_list) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(job_list);
std::vector<drive::JobInfo> info_list = job_list->GetJobInfoList();
}
void DriveInternalsWebUIHandler::UpdateGCacheContentsSection() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
// Start updating the GCache contents section.
Profile* profile = Profile::FromWebUI(web_ui());
}
void DriveInternalsWebUIHandler::UpdateFileSystemContentsSection() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
drive::DebugInfoCollector* debug_info_collector = GetDebugInfoCollector();
if (!debug_info_collector)
}
void DriveInternalsWebUIHandler::UpdateLocalStorageUsageSection() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
// Propagate the amount of local free space in bytes.
base::FilePath home_path;
void DriveInternalsWebUIHandler::UpdateCacheContentsSection(
drive::DebugInfoCollector* debug_info_collector) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(debug_info_collector);
debug_info_collector->IterateFileCache(
}
void DriveInternalsWebUIHandler::UpdateEventLogSection() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
drive::DriveIntegrationService* integration_service =
GetIntegrationService();
}
void DriveInternalsWebUIHandler::UpdatePathConfigurationsSection() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
Profile* const profile = Profile::FromWebUI(web_ui());
void DriveInternalsWebUIHandler::OnGetGCacheContents(
base::ListValue* gcache_contents,
base::DictionaryValue* gcache_summary) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(gcache_contents);
DCHECK(gcache_summary);
const base::FilePath& path,
drive::FileError error,
scoped_ptr<drive::ResourceEntry> entry) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (error == drive::FILE_ERROR_OK) {
DCHECK(entry.get());
const base::FilePath& parent_path,
drive::FileError error,
scoped_ptr<drive::ResourceEntryVector> entries) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (error == drive::FILE_ERROR_OK) {
DCHECK(entries.get());
void DriveInternalsWebUIHandler::UpdateCacheEntry(
const std::string& local_id,
const drive::FileCacheEntry& cache_entry) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
// Convert |cache_entry| into a dictionary.
base::DictionaryValue value;
void DriveInternalsWebUIHandler::OnGetFreeDiskSpace(
base::DictionaryValue* local_storage_summary) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(local_storage_summary);
web_ui()->CallJavascriptFunction(
}
void DriveInternalsWebUIHandler::OnPeriodicUpdate(const base::ListValue* args) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
drive::DriveIntegrationService* integration_service =
GetIntegrationService();