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

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

Issue 10828385: Rename DocumentsServiceInterface to DriveServiceInterface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unnecessary includes. Created 8 years, 4 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 | Annotate | Revision Log
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_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"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/browser/chromeos/cros/cros_library.h" 12 #include "chrome/browser/chromeos/cros/cros_library.h"
13 #include "chrome/browser/chromeos/extensions/file_browser_notifications.h" 13 #include "chrome/browser/chromeos/extensions/file_browser_notifications.h"
14 #include "chrome/browser/chromeos/extensions/file_manager_util.h" 14 #include "chrome/browser/chromeos/extensions/file_manager_util.h"
15 #include "chrome/browser/chromeos/gdata/documents_service_interface.h" 15 #include "chrome/browser/chromeos/gdata/drive_service_interface.h"
16 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" 16 #include "chrome/browser/chromeos/gdata/gdata_system_service.h"
17 #include "chrome/browser/chromeos/gdata/gdata_util.h" 17 #include "chrome/browser/chromeos/gdata/gdata_util.h"
18 #include "chrome/browser/chromeos/login/base_login_display_host.h" 18 #include "chrome/browser/chromeos/login/base_login_display_host.h"
19 #include "chrome/browser/chromeos/login/screen_locker.h" 19 #include "chrome/browser/chromeos/login/screen_locker.h"
20 #include "chrome/browser/chromeos/login/user_manager.h" 20 #include "chrome/browser/chromeos/login/user_manager.h"
21 #include "chrome/browser/extensions/event_names.h" 21 #include "chrome/browser/extensions/event_names.h"
22 #include "chrome/browser/extensions/event_router.h" 22 #include "chrome/browser/extensions/event_router.h"
23 #include "chrome/browser/extensions/extension_service.h" 23 #include "chrome/browser/extensions/extension_service.h"
24 #include "chrome/browser/prefs/pref_change_registrar.h" 24 #include "chrome/browser/prefs/pref_change_registrar.h"
25 #include "chrome/browser/prefs/pref_service.h" 25 #include "chrome/browser/prefs/pref_service.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 if (!profile_) { 107 if (!profile_) {
108 NOTREACHED(); 108 NOTREACHED();
109 return; 109 return;
110 } 110 }
111 DiskMountManager::GetInstance()->RemoveObserver(this); 111 DiskMountManager::GetInstance()->RemoveObserver(this);
112 112
113 GDataSystemService* system_service = 113 GDataSystemService* system_service =
114 GDataSystemServiceFactory::FindForProfile(profile_); 114 GDataSystemServiceFactory::FindForProfile(profile_);
115 if (system_service) { 115 if (system_service) {
116 system_service->file_system()->RemoveObserver(this); 116 system_service->file_system()->RemoveObserver(this);
117 system_service->docs_service()->operation_registry()->RemoveObserver(this); 117 system_service->drive_service()->operation_registry()->RemoveObserver(this);
118 } 118 }
119 119
120 chromeos::NetworkLibrary* network_library = 120 chromeos::NetworkLibrary* network_library =
121 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); 121 chromeos::CrosLibrary::Get()->GetNetworkLibrary();
122 if (network_library) 122 if (network_library)
123 network_library->RemoveNetworkManagerObserver(this); 123 network_library->RemoveNetworkManagerObserver(this);
124 124
125 profile_ = NULL; 125 profile_ = NULL;
126 } 126 }
127 127
128 void FileBrowserEventRouter::ObserveFileSystemEvents() { 128 void FileBrowserEventRouter::ObserveFileSystemEvents() {
129 if (!profile_) { 129 if (!profile_) {
130 NOTREACHED(); 130 NOTREACHED();
131 return; 131 return;
132 } 132 }
133 if (!chromeos::UserManager::Get()->IsUserLoggedIn()) 133 if (!chromeos::UserManager::Get()->IsUserLoggedIn())
134 return; 134 return;
135 135
136 DiskMountManager* disk_mount_manager = DiskMountManager::GetInstance(); 136 DiskMountManager* disk_mount_manager = DiskMountManager::GetInstance();
137 disk_mount_manager->RemoveObserver(this); 137 disk_mount_manager->RemoveObserver(this);
138 disk_mount_manager->AddObserver(this); 138 disk_mount_manager->AddObserver(this);
139 disk_mount_manager->RequestMountInfoRefresh(); 139 disk_mount_manager->RequestMountInfoRefresh();
140 140
141 GDataSystemService* system_service = 141 GDataSystemService* system_service =
142 GDataSystemServiceFactory::GetForProfile(profile_); 142 GDataSystemServiceFactory::GetForProfile(profile_);
143 if (!system_service) { 143 if (!system_service) {
144 NOTREACHED(); 144 NOTREACHED();
145 return; 145 return;
146 } 146 }
147 system_service->docs_service()->operation_registry()->AddObserver(this); 147 system_service->drive_service()->operation_registry()->AddObserver(this);
148 system_service->file_system()->AddObserver(this); 148 system_service->file_system()->AddObserver(this);
149 149
150 chromeos::NetworkLibrary* network_library = 150 chromeos::NetworkLibrary* network_library =
151 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); 151 chromeos::CrosLibrary::Get()->GetNetworkLibrary();
152 if (network_library) 152 if (network_library)
153 network_library->AddNetworkManagerObserver(this); 153 network_library->AddNetworkManagerObserver(this);
154 154
155 pref_change_registrar_->Init(profile_->GetPrefs()); 155 pref_change_registrar_->Init(profile_->GetPrefs());
156 pref_change_registrar_->Add(prefs::kDisableGDataOverCellular, this); 156 pref_change_registrar_->Add(prefs::kDisableGDataOverCellular, this);
157 pref_change_registrar_->Add(prefs::kDisableGDataHostedFiles, this); 157 pref_change_registrar_->Add(prefs::kDisableGDataHostedFiles, this);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 } 226 }
227 } 227 }
228 228
229 void FileBrowserEventRouter::MountDrive( 229 void FileBrowserEventRouter::MountDrive(
230 const base::Closure& callback) { 230 const base::Closure& callback) {
231 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 231 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
232 232
233 gdata::GDataSystemService* system_service = 233 gdata::GDataSystemService* system_service =
234 gdata::GDataSystemServiceFactory::GetForProfile(profile_); 234 gdata::GDataSystemServiceFactory::GetForProfile(profile_);
235 if (system_service) { 235 if (system_service) {
236 system_service->docs_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::GDataErrorCode error,
246 const std::string& token) { 246 const std::string& token) {
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698