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

Side by Side Diff: chrome/browser/chromeos/extensions/file_browser_private_api.cc

Issue 10083067: gdata: Support opening zip file on Google Docs. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: gdata: Support opening zip file on Google Docs. Created 8 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/extensions/file_browser_private_api.h" 5 #include "chrome/browser/chromeos/extensions/file_browser_private_api.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 const std::string& mount_type_str, 1008 const std::string& mount_type_str,
1009 const SelectedFileInfoList& files) { 1009 const SelectedFileInfoList& files) {
1010 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1010 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1011 1011
1012 if (!files.size()) { 1012 if (!files.size()) {
1013 SendResponse(false); 1013 SendResponse(false);
1014 return; 1014 return;
1015 } 1015 }
1016 1016
1017 #if defined(OS_CHROMEOS) 1017 #if defined(OS_CHROMEOS)
1018 FilePath source_file = files[0].path; 1018 const FilePath& source_path = files[0].path;
1019 const FilePath::StringType& display_name = files[0].display_name;
1020 // Check if the source path is under GData cache directory.
1021 gdata::GDataSystemService* system_service =
1022 gdata::GDataSystemServiceFactory::GetForProfile(profile_);
1023 gdata::GDataFileSystem* file_system =
1024 system_service ? system_service->file_system() : NULL;
1025 if (file_system && file_system->IsUnderGDataCacheDirectory(source_path)) {
1026 file_system->SetMountedState(
1027 source_path,
1028 true,
1029 base::Bind(&AddMountFunction::OnMountedStateSet, this, mount_type_str,
1030 display_name));
1031 } else {
1032 OnMountedStateSet(mount_type_str, display_name,
1033 base::PLATFORM_FILE_OK, source_path);
1034 }
1035 #else
1036 SendResponse(true);
1037 #endif // defined(OS_CHROMEOS)
1038 }
1039
1040 void AddMountFunction::OnMountedStateSet(const std::string& mount_type,
1041 const FilePath::StringType& file_name,
1042 base::PlatformFileError error,
1043 const FilePath& file_path) {
1044 #if defined(OS_CHROMEOS)
1045 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1019 DiskMountManager* disk_mount_manager = DiskMountManager::GetInstance(); 1046 DiskMountManager* disk_mount_manager = DiskMountManager::GetInstance();
1020 // MountPath() takes a std::string. 1047 // MountPath() takes a std::string.
1021 disk_mount_manager->MountPath(source_file.AsUTF8Unsafe(), 1048 disk_mount_manager->MountPath(file_path.AsUTF8Unsafe(),
1022 DiskMountManager::MountTypeFromString(mount_type_str)); 1049 FilePath(file_name).Extension(),
1050 DiskMountManager::MountTypeFromString(
1051 mount_type));
1052 SendResponse(true);
1023 #endif // defined(OS_CHROMEOS) 1053 #endif // defined(OS_CHROMEOS)
1024
1025 SendResponse(true);
1026 } 1054 }
1027 1055
1028 RemoveMountFunction::RemoveMountFunction() { 1056 RemoveMountFunction::RemoveMountFunction() {
1029 } 1057 }
1030 1058
1031 RemoveMountFunction::~RemoveMountFunction() { 1059 RemoveMountFunction::~RemoveMountFunction() {
1032 } 1060 }
1033 1061
1034 bool RemoveMountFunction::RunImpl() { 1062 bool RemoveMountFunction::RunImpl() {
1035 if (args_->GetSize() != 1) { 1063 if (args_->GetSize() != 1) {
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after
1996 if (value->GetBoolean("cellularDisabled", &tmp)) { 2024 if (value->GetBoolean("cellularDisabled", &tmp)) {
1997 service->SetBoolean(prefs::kDisableGDataOverCellular, tmp); 2025 service->SetBoolean(prefs::kDisableGDataOverCellular, tmp);
1998 } 2026 }
1999 2027
2000 if (value->GetBoolean("hostedFilesDisabled", &tmp)) { 2028 if (value->GetBoolean("hostedFilesDisabled", &tmp)) {
2001 service->SetBoolean(prefs::kDisableGDataHostedFiles, tmp); 2029 service->SetBoolean(prefs::kDisableGDataHostedFiles, tmp);
2002 } 2030 }
2003 2031
2004 return true; 2032 return true;
2005 } 2033 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698