| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_SEARCH_OPERATION_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_SEARCH_OPERATION_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_SEARCH_OPERATION_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_SEARCH_OPERATION_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "chrome/browser/chromeos/drive/file_errors.h" | 12 #include "chrome/browser/chromeos/drive/file_errors.h" |
| 13 #include "chrome/browser/chromeos/drive/file_system_interface.h" | 13 #include "chrome/browser/chromeos/drive/file_system_interface.h" |
| 14 #include "google_apis/drive/gdata_errorcode.h" | 14 #include "google_apis/drive/gdata_errorcode.h" |
| 15 | 15 |
| 16 namespace base { | 16 namespace base { |
| 17 class SequencedTaskRunner; | 17 class SequencedTaskRunner; |
| 18 } // namespace base | 18 } // namespace base |
| 19 | 19 |
| 20 namespace google_apis { | 20 namespace google_apis { |
| 21 class ResourceEntry; | 21 class FileList; |
| 22 class ResourceList; | |
| 23 } // namespace google_apis | 22 } // namespace google_apis |
| 24 | 23 |
| 25 namespace drive { | 24 namespace drive { |
| 26 | 25 |
| 27 class JobScheduler; | 26 class JobScheduler; |
| 28 | 27 |
| 29 namespace internal { | 28 namespace internal { |
| 30 class LoaderController; | 29 class LoaderController; |
| 31 class ResourceMetadata; | 30 class ResourceMetadata; |
| 32 } // namespace internal | 31 } // namespace internal |
| (...skipping 14 matching lines...) Expand all Loading... |
| 47 // |next_link| is set, this is the search result url that will be fetched. | 46 // |next_link| is set, this is the search result url that will be fetched. |
| 48 // Upon completion, |callback| will be called with the result. This is | 47 // Upon completion, |callback| will be called with the result. This is |
| 49 // implementation of FileSystemInterface::Search() method. | 48 // implementation of FileSystemInterface::Search() method. |
| 50 // | 49 // |
| 51 // |callback| must not be null. | 50 // |callback| must not be null. |
| 52 void Search(const std::string& search_query, | 51 void Search(const std::string& search_query, |
| 53 const GURL& next_link, | 52 const GURL& next_link, |
| 54 const SearchCallback& callback); | 53 const SearchCallback& callback); |
| 55 | 54 |
| 56 private: | 55 private: |
| 57 // Part of Search(), called after the ResourceList is fetched from the server. | 56 // Part of Search(), called after the FileList is fetched from the server. |
| 58 void SearchAfterGetResourceList( | 57 void SearchAfterGetFileList( |
| 59 const SearchCallback& callback, | 58 const SearchCallback& callback, |
| 60 google_apis::GDataErrorCode gdata_error, | 59 google_apis::GDataErrorCode gdata_error, |
| 61 scoped_ptr<google_apis::ResourceList> resource_list); | 60 scoped_ptr<google_apis::FileList> file_list); |
| 62 | 61 |
| 63 // Part of Search(), called after |result| is filled on the blocking pool. | 62 // Part of Search(), called after |result| is filled on the blocking pool. |
| 64 void SearchAfterResolveSearchResult( | 63 void SearchAfterResolveSearchResult( |
| 65 const SearchCallback& callback, | 64 const SearchCallback& callback, |
| 66 const GURL& next_link, | 65 const GURL& next_link, |
| 67 scoped_ptr<std::vector<SearchResultInfo> > result, | 66 scoped_ptr<std::vector<SearchResultInfo> > result, |
| 68 FileError error); | 67 FileError error); |
| 69 | 68 |
| 70 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 69 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
| 71 JobScheduler* scheduler_; | 70 JobScheduler* scheduler_; |
| 72 internal::ResourceMetadata* metadata_; | 71 internal::ResourceMetadata* metadata_; |
| 73 internal::LoaderController* loader_controller_; | 72 internal::LoaderController* loader_controller_; |
| 74 | 73 |
| 75 // Note: This should remain the last member so it'll be destroyed and | 74 // Note: This should remain the last member so it'll be destroyed and |
| 76 // invalidate the weak pointers before any other members are destroyed. | 75 // invalidate the weak pointers before any other members are destroyed. |
| 77 base::WeakPtrFactory<SearchOperation> weak_ptr_factory_; | 76 base::WeakPtrFactory<SearchOperation> weak_ptr_factory_; |
| 78 DISALLOW_COPY_AND_ASSIGN(SearchOperation); | 77 DISALLOW_COPY_AND_ASSIGN(SearchOperation); |
| 79 }; | 78 }; |
| 80 | 79 |
| 81 } // namespace file_system | 80 } // namespace file_system |
| 82 } // namespace drive | 81 } // namespace drive |
| 83 | 82 |
| 84 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_SEARCH_OPERATION_H_ | 83 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_SEARCH_OPERATION_H_ |
| OLD | NEW |