| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 if (!profile_) { | 97 if (!profile_) { |
| 98 NOTREACHED(); | 98 NOTREACHED(); |
| 99 return; | 99 return; |
| 100 } | 100 } |
| 101 DiskMountManager::GetInstance()->RemoveObserver(this); | 101 DiskMountManager::GetInstance()->RemoveObserver(this); |
| 102 | 102 |
| 103 GDataSystemService* system_service = | 103 GDataSystemService* system_service = |
| 104 GDataSystemServiceFactory::FindForProfile(profile_); | 104 GDataSystemServiceFactory::FindForProfile(profile_); |
| 105 if (system_service) { | 105 if (system_service) { |
| 106 system_service->file_system()->RemoveObserver(this); | 106 system_service->file_system()->RemoveObserver(this); |
| 107 system_service->file_system()->RemoveOperationObserver(this); | 107 system_service->file_system()->GetOperationRegistry()-> |
| 108 RemoveObserver(this); |
| 108 } | 109 } |
| 109 | 110 |
| 110 profile_ = NULL; | 111 profile_ = NULL; |
| 111 } | 112 } |
| 112 | 113 |
| 113 void FileBrowserEventRouter::ObserveFileSystemEvents() { | 114 void FileBrowserEventRouter::ObserveFileSystemEvents() { |
| 114 if (!profile_) { | 115 if (!profile_) { |
| 115 NOTREACHED(); | 116 NOTREACHED(); |
| 116 return; | 117 return; |
| 117 } | 118 } |
| 118 if (!chromeos::UserManager::Get()->IsUserLoggedIn()) | 119 if (!chromeos::UserManager::Get()->IsUserLoggedIn()) |
| 119 return; | 120 return; |
| 120 | 121 |
| 121 DiskMountManager* disk_mount_manager = DiskMountManager::GetInstance(); | 122 DiskMountManager* disk_mount_manager = DiskMountManager::GetInstance(); |
| 122 disk_mount_manager->RemoveObserver(this); | 123 disk_mount_manager->RemoveObserver(this); |
| 123 disk_mount_manager->AddObserver(this); | 124 disk_mount_manager->AddObserver(this); |
| 124 disk_mount_manager->RequestMountInfoRefresh(); | 125 disk_mount_manager->RequestMountInfoRefresh(); |
| 125 | 126 |
| 126 GDataSystemService* system_service = | 127 GDataSystemService* system_service = |
| 127 GDataSystemServiceFactory::GetForProfile(profile_); | 128 GDataSystemServiceFactory::GetForProfile(profile_); |
| 128 if (!system_service) { | 129 if (!system_service) { |
| 129 NOTREACHED(); | 130 NOTREACHED(); |
| 130 return; | 131 return; |
| 131 } | 132 } |
| 132 system_service->file_system()->AddOperationObserver(this); | 133 system_service->file_system()->GetOperationRegistry()->AddObserver(this); |
| 133 system_service->file_system()->AddObserver(this); | 134 system_service->file_system()->AddObserver(this); |
| 134 } | 135 } |
| 135 | 136 |
| 136 // File watch setup routines. | 137 // File watch setup routines. |
| 137 bool FileBrowserEventRouter::AddFileWatch( | 138 bool FileBrowserEventRouter::AddFileWatch( |
| 138 const FilePath& local_path, | 139 const FilePath& local_path, |
| 139 const FilePath& virtual_path, | 140 const FilePath& virtual_path, |
| 140 const std::string& extension_id) { | 141 const std::string& extension_id) { |
| 141 base::AutoLock lock(lock_); | 142 base::AutoLock lock(lock_); |
| 142 FilePath watch_path = local_path; | 143 FilePath watch_path = local_path; |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 return scoped_refptr<RefcountedProfileKeyedService>( | 618 return scoped_refptr<RefcountedProfileKeyedService>( |
| 618 new FileBrowserEventRouter(profile)); | 619 new FileBrowserEventRouter(profile)); |
| 619 } | 620 } |
| 620 | 621 |
| 621 bool FileBrowserEventRouterFactory::ServiceHasOwnInstanceInIncognito() { | 622 bool FileBrowserEventRouterFactory::ServiceHasOwnInstanceInIncognito() { |
| 622 // Explicitly and always allow this router in guest login mode. see | 623 // Explicitly and always allow this router in guest login mode. see |
| 623 // chrome/browser/profiles/profile_keyed_base_factory.h comment | 624 // chrome/browser/profiles/profile_keyed_base_factory.h comment |
| 624 // for the details. | 625 // for the details. |
| 625 return true; | 626 return true; |
| 626 } | 627 } |
| OLD | NEW |