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

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

Issue 10231010: gdata: Apply correct mount label when mounting archives in GData (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: gdata: Apply correct mount label when mounting archives in GData Created 8 years, 7 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 927 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 std::string file_url; 938 std::string file_url;
939 if (!args_->GetString(0, &file_url)) { 939 if (!args_->GetString(0, &file_url)) {
940 return false; 940 return false;
941 } 941 }
942 942
943 std::string mount_type_str; 943 std::string mount_type_str;
944 if (!args_->GetString(1, &mount_type_str)) { 944 if (!args_->GetString(1, &mount_type_str)) {
945 return false; 945 return false;
946 } 946 }
947 947
948 // Set default return source path to the input file_url
949 result_.reset(Value::CreateStringValue(file_url));
950
948 #if defined(OS_CHROMEOS) 951 #if defined(OS_CHROMEOS)
949 chromeos::MountType mount_type = 952 chromeos::MountType mount_type =
950 DiskMountManager::MountTypeFromString(mount_type_str); 953 DiskMountManager::MountTypeFromString(mount_type_str);
951 switch (mount_type) { 954 switch (mount_type) {
952 case chromeos::MOUNT_TYPE_INVALID: { 955 case chromeos::MOUNT_TYPE_INVALID: {
953 error_ = "Invalid mount type"; 956 error_ = "Invalid mount type";
954 SendResponse(false); 957 SendResponse(false);
955 break; 958 break;
956 } 959 }
957 case chromeos::MOUNT_TYPE_GDATA: { 960 case chromeos::MOUNT_TYPE_GDATA: {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 1044
1042 void AddMountFunction::OnMountedStateSet(const std::string& mount_type, 1045 void AddMountFunction::OnMountedStateSet(const std::string& mount_type,
1043 const FilePath::StringType& file_name, 1046 const FilePath::StringType& file_name,
1044 base::PlatformFileError error, 1047 base::PlatformFileError error,
1045 const FilePath& file_path) { 1048 const FilePath& file_path) {
1046 #if defined(OS_CHROMEOS) 1049 #if defined(OS_CHROMEOS)
1047 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1050 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1048 DiskMountManager* disk_mount_manager = DiskMountManager::GetInstance(); 1051 DiskMountManager* disk_mount_manager = DiskMountManager::GetInstance();
1049 // MountPath() takes a std::string. 1052 // MountPath() takes a std::string.
1050 disk_mount_manager->MountPath(file_path.AsUTF8Unsafe(), 1053 disk_mount_manager->MountPath(file_path.AsUTF8Unsafe(),
1051 FilePath(file_name).Extension(), 1054 FilePath(file_name).Extension(), file_name,
1052 DiskMountManager::MountTypeFromString( 1055 DiskMountManager::MountTypeFromString(
1053 mount_type)); 1056 mount_type));
1057 // Pass back the actual source path of the mount point.
tbarzic 2012/04/27 05:44:21 this seems a bit racy. What if mount completed eve
hshi 2012/04/27 18:48:56 Done.
1058 result_.reset(Value::CreateStringValue(file_path.value()));
1054 SendResponse(true); 1059 SendResponse(true);
1055 #endif // defined(OS_CHROMEOS) 1060 #endif // defined(OS_CHROMEOS)
1056 } 1061 }
1057 1062
1058 RemoveMountFunction::RemoveMountFunction() { 1063 RemoveMountFunction::RemoveMountFunction() {
1059 } 1064 }
1060 1065
1061 RemoveMountFunction::~RemoveMountFunction() { 1066 RemoveMountFunction::~RemoveMountFunction() {
1062 } 1067 }
1063 1068
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after
2034 if (value->GetBoolean("cellularDisabled", &tmp)) { 2039 if (value->GetBoolean("cellularDisabled", &tmp)) {
2035 service->SetBoolean(prefs::kDisableGDataOverCellular, tmp); 2040 service->SetBoolean(prefs::kDisableGDataOverCellular, tmp);
2036 } 2041 }
2037 2042
2038 if (value->GetBoolean("hostedFilesDisabled", &tmp)) { 2043 if (value->GetBoolean("hostedFilesDisabled", &tmp)) {
2039 service->SetBoolean(prefs::kDisableGDataHostedFiles, tmp); 2044 service->SetBoolean(prefs::kDisableGDataHostedFiles, tmp);
2040 } 2045 }
2041 2046
2042 return true; 2047 return true;
2043 } 2048 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698