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 "components/drive/service/fake_drive_service.h" | 5 #include "components/drive/service/fake_drive_service.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
11 #include <utility> | 11 #include <utility> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
15 #include "base/json/json_string_value_serializer.h" | 15 #include "base/json/json_string_value_serializer.h" |
16 #include "base/logging.h" | 16 #include "base/logging.h" |
17 #include "base/md5.h" | 17 #include "base/md5.h" |
18 #include "base/memory/ptr_util.h" | 18 #include "base/memory/ptr_util.h" |
19 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
20 #include "base/strings/string_split.h" | 20 #include "base/strings/string_split.h" |
21 #include "base/strings/string_tokenizer.h" | 21 #include "base/strings/string_tokenizer.h" |
22 #include "base/strings/string_util.h" | 22 #include "base/strings/string_util.h" |
23 #include "base/strings/stringprintf.h" | 23 #include "base/strings/stringprintf.h" |
24 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
| 25 #include "base/threading/thread_restrictions.h" |
25 #include "base/threading/thread_task_runner_handle.h" | 26 #include "base/threading/thread_task_runner_handle.h" |
26 #include "base/values.h" | 27 #include "base/values.h" |
27 #include "components/drive/drive_api_util.h" | 28 #include "components/drive/drive_api_util.h" |
28 #include "google_apis/drive/drive_api_parser.h" | 29 #include "google_apis/drive/drive_api_parser.h" |
29 #include "google_apis/drive/test_util.h" | 30 #include "google_apis/drive/test_util.h" |
30 #include "net/base/escape.h" | 31 #include "net/base/escape.h" |
31 #include "net/base/url_util.h" | 32 #include "net/base/url_util.h" |
32 | 33 |
33 using google_apis::AboutResource; | 34 using google_apis::AboutResource; |
34 using google_apis::AboutResourceCallback; | 35 using google_apis::AboutResourceCallback; |
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 weak_ptr_factory_.GetWeakPtr())); | 807 weak_ptr_factory_.GetWeakPtr())); |
807 return CancelCallback(); | 808 return CancelCallback(); |
808 } | 809 } |
809 | 810 |
810 CancelCallback FakeDriveService::DownloadFile( | 811 CancelCallback FakeDriveService::DownloadFile( |
811 const base::FilePath& local_cache_path, | 812 const base::FilePath& local_cache_path, |
812 const std::string& resource_id, | 813 const std::string& resource_id, |
813 const DownloadActionCallback& download_action_callback, | 814 const DownloadActionCallback& download_action_callback, |
814 const GetContentCallback& get_content_callback, | 815 const GetContentCallback& get_content_callback, |
815 const ProgressCallback& progress_callback) { | 816 const ProgressCallback& progress_callback) { |
| 817 base::ThreadRestrictions::ScopedAllowIO allow_io; |
816 DCHECK(thread_checker_.CalledOnValidThread()); | 818 DCHECK(thread_checker_.CalledOnValidThread()); |
817 DCHECK(!download_action_callback.is_null()); | 819 DCHECK(!download_action_callback.is_null()); |
818 | 820 |
819 if (offline_) { | 821 if (offline_) { |
820 base::ThreadTaskRunnerHandle::Get()->PostTask( | 822 base::ThreadTaskRunnerHandle::Get()->PostTask( |
821 FROM_HERE, | 823 FROM_HERE, |
822 base::Bind(download_action_callback, | 824 base::Bind(download_action_callback, |
823 DRIVE_NO_CONNECTION, | 825 DRIVE_NO_CONNECTION, |
824 base::FilePath())); | 826 base::FilePath())); |
825 return CancelCallback(); | 827 return CancelCallback(); |
(...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1873 NOTREACHED(); | 1875 NOTREACHED(); |
1874 return std::unique_ptr<BatchRequestConfiguratorInterface>(); | 1876 return std::unique_ptr<BatchRequestConfiguratorInterface>(); |
1875 } | 1877 } |
1876 | 1878 |
1877 void FakeDriveService::NotifyObservers() { | 1879 void FakeDriveService::NotifyObservers() { |
1878 for (auto& observer : change_observers_) | 1880 for (auto& observer : change_observers_) |
1879 observer.OnNewChangeAvailable(); | 1881 observer.OnNewChangeAvailable(); |
1880 } | 1882 } |
1881 | 1883 |
1882 } // namespace drive | 1884 } // namespace drive |
OLD | NEW |