| OLD | NEW |
| 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_manager/file_browser_private_a
pi.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/file_browser_private_a
pi.h" |
| 6 | 6 |
| 7 #include <sys/stat.h> | 7 #include <sys/stat.h> |
| 8 #include <sys/statvfs.h> | 8 #include <sys/statvfs.h> |
| 9 #include <sys/types.h> | 9 #include <sys/types.h> |
| 10 #include <utime.h> | 10 #include <utime.h> |
| (...skipping 2223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2234 SET_STRING("HELP_LINK_LABEL", IDS_FILE_BROWSER_HELP_LINK_LABEL); | 2234 SET_STRING("HELP_LINK_LABEL", IDS_FILE_BROWSER_HELP_LINK_LABEL); |
| 2235 #undef SET_STRING | 2235 #undef SET_STRING |
| 2236 | 2236 |
| 2237 dict->SetBoolean("PDF_VIEW_ENABLED", | 2237 dict->SetBoolean("PDF_VIEW_ENABLED", |
| 2238 file_manager_util::ShouldBeOpenedWithPlugin(profile(), ".pdf")); | 2238 file_manager_util::ShouldBeOpenedWithPlugin(profile(), ".pdf")); |
| 2239 dict->SetBoolean("SWF_VIEW_ENABLED", | 2239 dict->SetBoolean("SWF_VIEW_ENABLED", |
| 2240 file_manager_util::ShouldBeOpenedWithPlugin(profile(), ".swf")); | 2240 file_manager_util::ShouldBeOpenedWithPlugin(profile(), ".swf")); |
| 2241 | 2241 |
| 2242 webui::SetFontAndTextDirection(dict); | 2242 webui::SetFontAndTextDirection(dict); |
| 2243 | 2243 |
| 2244 drive::DriveIntegrationService* integration_service = | |
| 2245 drive::DriveIntegrationServiceFactory::GetForProfile(profile_); | |
| 2246 dict->SetBoolean("ENABLE_GDATA", integration_service != NULL); | |
| 2247 | |
| 2248 #if defined(USE_ASH) | |
| 2249 dict->SetBoolean("ASH", true); | |
| 2250 #else | |
| 2251 dict->SetBoolean("ASH", false); | |
| 2252 #endif | |
| 2253 | |
| 2254 std::string board; | 2244 std::string board; |
| 2255 chromeos::system::StatisticsProvider* provider = | 2245 chromeos::system::StatisticsProvider* provider = |
| 2256 chromeos::system::StatisticsProvider::GetInstance(); | 2246 chromeos::system::StatisticsProvider::GetInstance(); |
| 2257 if (!provider->GetMachineStatistic(chromeos::system::kMachineInfoBoard, | 2247 if (!provider->GetMachineStatistic(chromeos::system::kMachineInfoBoard, |
| 2258 &board)) { | 2248 &board)) { |
| 2259 board = "unknown"; | 2249 board = "unknown"; |
| 2260 } | 2250 } |
| 2261 dict->SetString(chromeos::system::kMachineInfoBoard, board); | 2251 dict->SetString(chromeos::system::kMachineInfoBoard, board); |
| 2262 return true; | 2252 return true; |
| 2263 } | 2253 } |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2596 GURL(destination_file_url)); | 2586 GURL(destination_file_url)); |
| 2597 if (source_file.empty() || destination_file.empty()) | 2587 if (source_file.empty() || destination_file.empty()) |
| 2598 return false; | 2588 return false; |
| 2599 | 2589 |
| 2600 bool source_file_under_drive = | 2590 bool source_file_under_drive = |
| 2601 drive::util::IsUnderDriveMountPoint(source_file); | 2591 drive::util::IsUnderDriveMountPoint(source_file); |
| 2602 bool destination_file_under_drive = | 2592 bool destination_file_under_drive = |
| 2603 drive::util::IsUnderDriveMountPoint(destination_file); | 2593 drive::util::IsUnderDriveMountPoint(destination_file); |
| 2604 | 2594 |
| 2605 if (source_file_under_drive && !destination_file_under_drive) { | 2595 if (source_file_under_drive && !destination_file_under_drive) { |
| 2606 // Transfer a file from gdata to local file system. | 2596 // Transfer a file from drive to local file system. |
| 2607 source_file = drive::util::ExtractDrivePath(source_file); | 2597 source_file = drive::util::ExtractDrivePath(source_file); |
| 2608 integration_service->file_system()->TransferFileFromRemoteToLocal( | 2598 integration_service->file_system()->TransferFileFromRemoteToLocal( |
| 2609 source_file, | 2599 source_file, |
| 2610 destination_file, | 2600 destination_file, |
| 2611 base::Bind(&TransferFileFunction::OnTransferCompleted, this)); | 2601 base::Bind(&TransferFileFunction::OnTransferCompleted, this)); |
| 2612 } else if (!source_file_under_drive && destination_file_under_drive) { | 2602 } else if (!source_file_under_drive && destination_file_under_drive) { |
| 2613 // Transfer a file from local to Drive file system | 2603 // Transfer a file from local to Drive file system |
| 2614 destination_file = drive::util::ExtractDrivePath(destination_file); | 2604 destination_file = drive::util::ExtractDrivePath(destination_file); |
| 2615 integration_service->file_system()->TransferFileFromLocalToRemote( | 2605 integration_service->file_system()->TransferFileFromLocalToRemote( |
| 2616 source_file, | 2606 source_file, |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3079 integration_service->drive_service()->RequestAccessToken( | 3069 integration_service->drive_service()->RequestAccessToken( |
| 3080 base::Bind(&RequestAccessTokenFunction::OnAccessTokenFetched, this)); | 3070 base::Bind(&RequestAccessTokenFunction::OnAccessTokenFetched, this)); |
| 3081 return true; | 3071 return true; |
| 3082 } | 3072 } |
| 3083 | 3073 |
| 3084 void RequestAccessTokenFunction::OnAccessTokenFetched( | 3074 void RequestAccessTokenFunction::OnAccessTokenFetched( |
| 3085 google_apis::GDataErrorCode code, const std::string& access_token) { | 3075 google_apis::GDataErrorCode code, const std::string& access_token) { |
| 3086 SetResult(new base::StringValue(access_token)); | 3076 SetResult(new base::StringValue(access_token)); |
| 3087 SendResponse(true); | 3077 SendResponse(true); |
| 3088 } | 3078 } |
| OLD | NEW |