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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 system_service->file_system()->AddObserver(this); | 151 system_service->file_system()->AddObserver(this); |
152 | 152 |
153 chromeos::NetworkLibrary* network_library = | 153 chromeos::NetworkLibrary* network_library = |
154 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 154 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
155 if (network_library) | 155 if (network_library) |
156 network_library->AddNetworkManagerObserver(this); | 156 network_library->AddNetworkManagerObserver(this); |
157 | 157 |
158 pref_change_registrar_->Init(profile_->GetPrefs()); | 158 pref_change_registrar_->Init(profile_->GetPrefs()); |
159 pref_change_registrar_->Add(prefs::kDisableGDataOverCellular, this); | 159 pref_change_registrar_->Add(prefs::kDisableGDataOverCellular, this); |
160 pref_change_registrar_->Add(prefs::kDisableGDataHostedFiles, this); | 160 pref_change_registrar_->Add(prefs::kDisableGDataHostedFiles, this); |
| 161 pref_change_registrar_->Add(prefs::kDisableGData, this); |
161 } | 162 } |
162 | 163 |
163 // File watch setup routines. | 164 // File watch setup routines. |
164 bool FileBrowserEventRouter::AddFileWatch( | 165 bool FileBrowserEventRouter::AddFileWatch( |
165 const FilePath& local_path, | 166 const FilePath& local_path, |
166 const FilePath& virtual_path, | 167 const FilePath& virtual_path, |
167 const std::string& extension_id) { | 168 const std::string& extension_id) { |
168 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 169 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
169 | 170 |
170 base::AutoLock lock(lock_); | 171 base::AutoLock lock(lock_); |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 if (error_code == chromeos::MOUNT_ERROR_NONE || | 503 if (error_code == chromeos::MOUNT_ERROR_NONE || |
503 mount_info.mount_condition) { | 504 mount_info.mount_condition) { |
504 // Convert mount point path to relative path with the external file system | 505 // Convert mount point path to relative path with the external file system |
505 // exposed within File API. | 506 // exposed within File API. |
506 if (file_manager_util::ConvertFileToRelativeFileSystemPath(profile_, | 507 if (file_manager_util::ConvertFileToRelativeFileSystemPath(profile_, |
507 FilePath(mount_info.mount_path), | 508 FilePath(mount_info.mount_path), |
508 &relative_mount_path)) { | 509 &relative_mount_path)) { |
509 mount_info_value->SetString("mountPath", | 510 mount_info_value->SetString("mountPath", |
510 "/" + relative_mount_path.value()); | 511 "/" + relative_mount_path.value()); |
511 relative_mount_path_set = true; | 512 relative_mount_path_set = true; |
| 513 } else { |
| 514 LOG(ERROR) << "Mount path is not accessible: " << mount_info.mount_path; |
| 515 mount_info_value->SetString("status", |
| 516 MountErrorToString(chromeos::MOUNT_ERROR_PATH_UNMOUNTED)); |
512 } | 517 } |
513 } | 518 } |
514 | 519 |
515 std::string args_json; | 520 std::string args_json; |
516 base::JSONWriter::Write(&args, &args_json); | 521 base::JSONWriter::Write(&args, &args_json); |
517 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( | 522 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( |
518 extension_event_names::kOnFileBrowserMountCompleted, args_json, NULL, | 523 extension_event_names::kOnFileBrowserMountCompleted, args_json, NULL, |
519 GURL()); | 524 GURL()); |
520 | 525 |
521 // Do not attempt to open File Manager while the login is in progress or | 526 // Do not attempt to open File Manager while the login is in progress or |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 return scoped_refptr<RefcountedProfileKeyedService>( | 775 return scoped_refptr<RefcountedProfileKeyedService>( |
771 new FileBrowserEventRouter(profile)); | 776 new FileBrowserEventRouter(profile)); |
772 } | 777 } |
773 | 778 |
774 bool FileBrowserEventRouterFactory::ServiceHasOwnInstanceInIncognito() { | 779 bool FileBrowserEventRouterFactory::ServiceHasOwnInstanceInIncognito() { |
775 // Explicitly and always allow this router in guest login mode. see | 780 // Explicitly and always allow this router in guest login mode. see |
776 // chrome/browser/profiles/profile_keyed_base_factory.h comment | 781 // chrome/browser/profiles/profile_keyed_base_factory.h comment |
777 // for the details. | 782 // for the details. |
778 return true; | 783 return true; |
779 } | 784 } |
OLD | NEW |