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

Unified Diff: chrome/browser/chromeos/extensions/file_browser_private_api.cc

Issue 12221132: filemanager: Fix GetDriveConnectionStateFunctionChange to return "offline" when DriveSystemService … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: refactor the if-clause Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/file_manager/js/file_manager.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/extensions/file_browser_private_api.cc
diff --git a/chrome/browser/chromeos/extensions/file_browser_private_api.cc b/chrome/browser/chromeos/extensions/file_browser_private_api.cc
index 85c4c2c851be68267af29ae07046b488d97ee8c7..1977d2c67b2bd2afffee9019015b0e6319ff157d 100644
--- a/chrome/browser/chromeos/extensions/file_browser_private_api.cc
+++ b/chrome/browser/chromeos/extensions/file_browser_private_api.cc
@@ -122,6 +122,7 @@ const char kDriveConnectionTypeOnline[] = "online";
*/
const char kDriveConnectionReasonNotReady[] = "not_ready";
const char kDriveConnectionReasonNoNetwork[] = "no_network";
+const char kDriveConnectionReasonNoService[] = "no_service";
// Unescape rules used for parsing query parameters.
const net::UnescapeRule::Type kUnescapeRuleForQueryParameters =
@@ -3082,16 +3083,20 @@ bool GetDriveConnectionStateFunction::RunImpl() {
drive::DriveSystemService* system_service =
drive::DriveSystemServiceFactory::GetForProfile(profile_);
- bool ready = system_service->drive_service()->CanStartOperation();
+ bool ready = system_service &&
+ system_service->drive_service()->CanStartOperation();
bool is_connection_cellular =
net::NetworkChangeNotifier::IsConnectionCellular(
net::NetworkChangeNotifier::GetConnectionType());
+
if (net::NetworkChangeNotifier::IsOffline() || !ready) {
type_string = kDriveConnectionTypeOffline;
if (net::NetworkChangeNotifier::IsOffline())
reasons->AppendString(kDriveConnectionReasonNoNetwork);
if (!ready)
reasons->AppendString(kDriveConnectionReasonNotReady);
+ if (!system_service)
+ reasons->AppendString(kDriveConnectionReasonNoService);
} else if (
is_connection_cellular &&
profile_->GetPrefs()->GetBoolean(prefs::kDisableDriveOverCellular)) {
« no previous file with comments | « no previous file | chrome/browser/resources/file_manager/js/file_manager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698