| 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_browser_event_router.h" | 5 #include "chrome/browser/chromeos/extensions/file_browser_event_router.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 if (system_service) { | 235 if (system_service) { |
| 236 system_service->drive_service()->Authenticate( | 236 system_service->drive_service()->Authenticate( |
| 237 base::Bind(&FileBrowserEventRouter::OnAuthenticated, | 237 base::Bind(&FileBrowserEventRouter::OnAuthenticated, |
| 238 this, | 238 this, |
| 239 callback)); | 239 callback)); |
| 240 } | 240 } |
| 241 } | 241 } |
| 242 | 242 |
| 243 void FileBrowserEventRouter::OnAuthenticated( | 243 void FileBrowserEventRouter::OnAuthenticated( |
| 244 const base::Closure& callback, | 244 const base::Closure& callback, |
| 245 gdata::GDataErrorCode error, | 245 gdata::DriveErrorCode error, |
| 246 const std::string& token) { | 246 const std::string& token) { |
| 247 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 247 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 248 | 248 |
| 249 chromeos::MountError error_code; | 249 chromeos::MountError error_code; |
| 250 // For the file manager to work offline, GDATA_NO_CONNECTION is allowed. | 250 // For the file manager to work offline, GDATA_NO_CONNECTION is allowed. |
| 251 if (error == gdata::HTTP_SUCCESS || error == gdata::GDATA_NO_CONNECTION) | 251 if (error == gdata::HTTP_SUCCESS || error == gdata::DRIVE_NO_CONNECTION) |
| 252 error_code = chromeos::MOUNT_ERROR_NONE; | 252 error_code = chromeos::MOUNT_ERROR_NONE; |
| 253 else | 253 else |
| 254 error_code = chromeos::MOUNT_ERROR_NOT_AUTHENTICATED; | 254 error_code = chromeos::MOUNT_ERROR_NOT_AUTHENTICATED; |
| 255 | 255 |
| 256 // Pass back the gdata mount point path as source path. | 256 // Pass back the gdata mount point path as source path. |
| 257 const std::string& gdata_path = gdata::util::GetGDataMountPointPathAsString(); | 257 const std::string& gdata_path = gdata::util::GetGDataMountPointPathAsString(); |
| 258 DiskMountManager::MountPointInfo mount_info( | 258 DiskMountManager::MountPointInfo mount_info( |
| 259 gdata_path, | 259 gdata_path, |
| 260 gdata_path, | 260 gdata_path, |
| 261 chromeos::MOUNT_TYPE_GDATA, | 261 chromeos::MOUNT_TYPE_GDATA, |
| (...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 return scoped_refptr<RefcountedProfileKeyedService>( | 861 return scoped_refptr<RefcountedProfileKeyedService>( |
| 862 new FileBrowserEventRouter(profile)); | 862 new FileBrowserEventRouter(profile)); |
| 863 } | 863 } |
| 864 | 864 |
| 865 bool FileBrowserEventRouterFactory::ServiceHasOwnInstanceInIncognito() { | 865 bool FileBrowserEventRouterFactory::ServiceHasOwnInstanceInIncognito() { |
| 866 // Explicitly and always allow this router in guest login mode. see | 866 // Explicitly and always allow this router in guest login mode. see |
| 867 // chrome/browser/profiles/profile_keyed_base_factory.h comment | 867 // chrome/browser/profiles/profile_keyed_base_factory.h comment |
| 868 // for the details. | 868 // for the details. |
| 869 return true; | 869 return true; |
| 870 } | 870 } |
| OLD | NEW |