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/drive/file_system.h" | 5 #include "chrome/browser/chromeos/drive/file_system.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/platform_file.h" | 9 #include "base/platform_file.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 const GetShareUrlCallback& callback, | 736 const GetShareUrlCallback& callback, |
737 FileError error, | 737 FileError error, |
738 scoped_ptr<ResourceEntry> entry) { | 738 scoped_ptr<ResourceEntry> entry) { |
739 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 739 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
740 DCHECK(!callback.is_null()); | 740 DCHECK(!callback.is_null()); |
741 | 741 |
742 if (error != FILE_ERROR_OK) { | 742 if (error != FILE_ERROR_OK) { |
743 callback.Run(error, GURL()); | 743 callback.Run(error, GURL()); |
744 return; | 744 return; |
745 } | 745 } |
746 if (util::IsSpecialResourceId(entry->resource_id())) { | 746 if (entry->resource_id().empty()) { |
747 // Do not load special directories. Just return. | 747 // This entry does not exist on the server. Just return. |
748 callback.Run(FILE_ERROR_FAILED, GURL()); | 748 callback.Run(FILE_ERROR_FAILED, GURL()); |
749 return; | 749 return; |
750 } | 750 } |
751 | 751 |
752 scheduler_->GetShareUrl( | 752 scheduler_->GetShareUrl( |
753 entry->resource_id(), | 753 entry->resource_id(), |
754 embed_origin, | 754 embed_origin, |
755 ClientContext(USER_INITIATED), | 755 ClientContext(USER_INITIATED), |
756 base::Bind(&FileSystem::OnGetResourceEntryForGetShareUrl, | 756 base::Bind(&FileSystem::OnGetResourceEntryForGetShareUrl, |
757 weak_ptr_factory_.GetWeakPtr(), | 757 weak_ptr_factory_.GetWeakPtr(), |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 OpenMode open_mode, | 926 OpenMode open_mode, |
927 const std::string& mime_type, | 927 const std::string& mime_type, |
928 const OpenFileCallback& callback) { | 928 const OpenFileCallback& callback) { |
929 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 929 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
930 DCHECK(!callback.is_null()); | 930 DCHECK(!callback.is_null()); |
931 | 931 |
932 open_file_operation_->OpenFile(file_path, open_mode, mime_type, callback); | 932 open_file_operation_->OpenFile(file_path, open_mode, mime_type, callback); |
933 } | 933 } |
934 | 934 |
935 } // namespace drive | 935 } // namespace drive |
OLD | NEW |