Chromium Code Reviews| 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 363 DiskMountManager::MountTypeToString(mount_info.mount_type)); | 363 DiskMountManager::MountTypeToString(mount_info.mount_type)); | 
| 364 | 364 | 
| 365 if (mount_info.mount_type == chromeos::MOUNT_TYPE_ARCHIVE || | 365 if (mount_info.mount_type == chromeos::MOUNT_TYPE_ARCHIVE || | 
| 366 mount_info.mount_type == chromeos::MOUNT_TYPE_GDATA) { | 366 mount_info.mount_type == chromeos::MOUNT_TYPE_GDATA) { | 
| 367 GURL source_url; | 367 GURL source_url; | 
| 368 if (file_manager_util::ConvertFileToFileSystemUrl(profile_, | 368 if (file_manager_util::ConvertFileToFileSystemUrl(profile_, | 
| 369 FilePath(mount_info.source_path), | 369 FilePath(mount_info.source_path), | 
| 370 file_manager_util::GetFileBrowserExtensionUrl().GetOrigin(), | 370 file_manager_util::GetFileBrowserExtensionUrl().GetOrigin(), | 
| 371 &source_url)) { | 371 &source_url)) { | 
| 372 mount_info_value->SetString("sourceUrl", source_url.spec()); | 372 mount_info_value->SetString("sourceUrl", source_url.spec()); | 
| 373 } else { | |
| 374 // If mounting of gdata moutn point failed, we may not be able to convert | |
| 
 
achuithb
2012/03/21 19:38:29
nit: moutn->mount
 
 | |
| 375 // source path to source url, so let just send empty string. | |
| 376 DCHECK(mount_info.mount_type == chromeos::MOUNT_TYPE_GDATA && | |
| 377 error_code != chromeos::MOUNT_ERROR_NONE); | |
| 378 mount_info_value->SetString("sourceUrl", ""); | |
| 373 } | 379 } | 
| 374 } else { | 380 } else { | 
| 375 mount_info_value->SetString("sourceUrl", mount_info.source_path); | 381 mount_info_value->SetString("sourceUrl", mount_info.source_path); | 
| 376 } | 382 } | 
| 377 | 383 | 
| 378 FilePath relative_mount_path; | 384 FilePath relative_mount_path; | 
| 379 bool relative_mount_path_set = false; | 385 bool relative_mount_path_set = false; | 
| 380 | 386 | 
| 381 // If there were no error or some special conditions occured, add mountPath | 387 // If there were no error or some special conditions occured, add mountPath | 
| 382 // to the event. | 388 // to the event. | 
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 601 } | 607 } | 
| 602 | 608 | 
| 603 FileBrowserEventRouterFactory::~FileBrowserEventRouterFactory() { | 609 FileBrowserEventRouterFactory::~FileBrowserEventRouterFactory() { | 
| 604 } | 610 } | 
| 605 | 611 | 
| 606 scoped_refptr<RefcountedProfileKeyedService> | 612 scoped_refptr<RefcountedProfileKeyedService> | 
| 607 FileBrowserEventRouterFactory::BuildServiceInstanceFor(Profile* profile) const { | 613 FileBrowserEventRouterFactory::BuildServiceInstanceFor(Profile* profile) const { | 
| 608 return scoped_refptr<RefcountedProfileKeyedService>( | 614 return scoped_refptr<RefcountedProfileKeyedService>( | 
| 609 new FileBrowserEventRouter(profile)); | 615 new FileBrowserEventRouter(profile)); | 
| 610 } | 616 } | 
| OLD | NEW |