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

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

Issue 11094061: drive: Move IsDriveEnabled() and DisableDrive() to DriveSystemService (Closed) Base URL: http://git.chromium.org/chromium/src.git@drive_available
Patch Set: rebase Created 8 years, 2 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 <sys/statvfs.h> 7 #include <sys/statvfs.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 // Will finish asynchronously. 514 // Will finish asynchronously.
515 return true; 515 return true;
516 } 516 }
517 517
518 void RequestLocalFileSystemFunction::RespondSuccessOnUIThread( 518 void RequestLocalFileSystemFunction::RespondSuccessOnUIThread(
519 const std::string& name, const GURL& root_path) { 519 const std::string& name, const GURL& root_path) {
520 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 520 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
521 // Add drive mount point immediately when we kick of first instance of file 521 // Add drive mount point immediately when we kick of first instance of file
522 // manager. The actual mount event will be sent to UI only when we perform 522 // manager. The actual mount event will be sent to UI only when we perform
523 // proper authentication. 523 // proper authentication.
524 if (gdata::util::IsDriveEnabled(profile_)) 524 if (gdata::DriveSystemService::IsDriveEnabled(profile_))
525 AddDriveMountPoint(profile_, extension_id(), render_view_host()); 525 AddDriveMountPoint(profile_, extension_id(), render_view_host());
526 DictionaryValue* dict = new DictionaryValue(); 526 DictionaryValue* dict = new DictionaryValue();
527 SetResult(dict); 527 SetResult(dict);
528 dict->SetString("name", name); 528 dict->SetString("name", name);
529 dict->SetString("path", root_path.spec()); 529 dict->SetString("path", root_path.spec());
530 dict->SetInteger("error", gdata::DRIVE_FILE_OK); 530 dict->SetInteger("error", gdata::DRIVE_FILE_OK);
531 SendResponse(true); 531 SendResponse(true);
532 } 532 }
533 533
534 void RequestLocalFileSystemFunction::RespondFailedOnUIThread( 534 void RequestLocalFileSystemFunction::RespondFailedOnUIThread(
(...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after
2016 SET_STRING(IDS_FILE_BROWSER, TIME_YESTERDAY); 2016 SET_STRING(IDS_FILE_BROWSER, TIME_YESTERDAY);
2017 2017
2018 SET_STRING(IDS_FILE_BROWSER, ALL_FILES_FILTER); 2018 SET_STRING(IDS_FILE_BROWSER, ALL_FILES_FILTER);
2019 #undef SET_STRING 2019 #undef SET_STRING
2020 2020
2021 dict->SetBoolean("PDF_VIEW_ENABLED", 2021 dict->SetBoolean("PDF_VIEW_ENABLED",
2022 file_manager_util::ShouldBeOpenedWithPdfPlugin(profile(), ".pdf")); 2022 file_manager_util::ShouldBeOpenedWithPdfPlugin(profile(), ".pdf"));
2023 2023
2024 ChromeURLDataManager::DataSource::SetFontAndTextDirection(dict); 2024 ChromeURLDataManager::DataSource::SetFontAndTextDirection(dict);
2025 2025
2026 dict->SetBoolean("ENABLE_GDATA", gdata::util::IsDriveEnabled(profile())); 2026 dict->SetBoolean("ENABLE_GDATA",
2027 gdata::DriveSystemService::IsDriveEnabled(profile()));
2027 2028
2028 #if defined(USE_ASH) 2029 #if defined(USE_ASH)
2029 dict->SetBoolean("ASH", true); 2030 dict->SetBoolean("ASH", true);
2030 #else 2031 #else
2031 dict->SetBoolean("ASH", false); 2032 dict->SetBoolean("ASH", false);
2032 #endif 2033 #endif
2033 2034
2034 std::string board; 2035 std::string board;
2035 const char kMachineInfoBoard[] = "CHROMEOS_RELEASE_BOARD"; 2036 const char kMachineInfoBoard[] = "CHROMEOS_RELEASE_BOARD";
2036 chromeos::system::StatisticsProvider* provider = 2037 chromeos::system::StatisticsProvider* provider =
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
2588 SendResponse(false); 2589 SendResponse(false);
2589 } 2590 }
2590 } 2591 }
2591 2592
2592 // Read Drive-related preferences. 2593 // Read Drive-related preferences.
2593 bool GetDrivePreferencesFunction::RunImpl() { 2594 bool GetDrivePreferencesFunction::RunImpl() {
2594 scoped_ptr<DictionaryValue> value(new DictionaryValue()); 2595 scoped_ptr<DictionaryValue> value(new DictionaryValue());
2595 2596
2596 const PrefService* service = profile_->GetPrefs(); 2597 const PrefService* service = profile_->GetPrefs();
2597 2598
2598 bool drive_enabled = gdata::util::IsDriveEnabled(profile_); 2599 bool drive_enabled = gdata::DriveSystemService::IsDriveEnabled(profile_);
2599 2600
2600 if (drive_enabled) 2601 if (drive_enabled)
2601 AddDriveMountPoint(profile_, extension_id(), render_view_host()); 2602 AddDriveMountPoint(profile_, extension_id(), render_view_host());
2602 2603
2603 value->SetBoolean("driveEnabled", drive_enabled); 2604 value->SetBoolean("driveEnabled", drive_enabled);
2604 2605
2605 value->SetBoolean("cellularDisabled", 2606 value->SetBoolean("cellularDisabled",
2606 service->GetBoolean(prefs::kDisableGDataOverCellular)); 2607 service->GetBoolean(prefs::kDisableGDataOverCellular));
2607 2608
2608 value->SetBoolean("hostedFilesDisabled", 2609 value->SetBoolean("hostedFilesDisabled",
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
2755 gdata::DriveSystemService* system_service = 2756 gdata::DriveSystemService* system_service =
2756 gdata::DriveSystemServiceFactory::GetForProfile(profile_); 2757 gdata::DriveSystemServiceFactory::GetForProfile(profile_);
2757 if (!system_service || !system_service->file_system()) 2758 if (!system_service || !system_service->file_system())
2758 return false; 2759 return false;
2759 2760
2760 FilePath directory_path = GetVirtualPathFromURL(GURL(file_url_as_string)); 2761 FilePath directory_path = GetVirtualPathFromURL(GURL(file_url_as_string));
2761 system_service->file_system()->RequestDirectoryRefresh(directory_path); 2762 system_service->file_system()->RequestDirectoryRefresh(directory_path);
2762 2763
2763 return true; 2764 return true;
2764 } 2765 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698