OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/file_system_provider/request_manager.h" | 5 #include "chrome/browser/chromeos/file_system_provider/request_manager.h" |
6 | 6 |
7 #include "base/files/file.h" | 7 #include "base/files/file.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 | 9 |
10 namespace chromeos { | 10 namespace chromeos { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 return 0; | 66 return 0; |
67 } | 67 } |
68 | 68 |
69 FOR_EACH_OBSERVER(Observer, observers_, OnRequestExecuted(request_id)); | 69 FOR_EACH_OBSERVER(Observer, observers_, OnRequestExecuted(request_id)); |
70 | 70 |
71 return request_id; | 71 return request_id; |
72 } | 72 } |
73 | 73 |
74 bool RequestManager::FulfillRequest(int request_id, | 74 bool RequestManager::FulfillRequest(int request_id, |
75 scoped_ptr<RequestValue> response, | 75 scoped_ptr<RequestValue> response, |
76 bool has_next) { | 76 bool has_more) { |
77 RequestMap::iterator request_it = requests_.find(request_id); | 77 RequestMap::iterator request_it = requests_.find(request_id); |
78 if (request_it == requests_.end()) | 78 if (request_it == requests_.end()) |
79 return false; | 79 return false; |
80 | 80 |
81 request_it->second->handler->OnSuccess(request_id, response.Pass(), has_next); | 81 request_it->second->handler->OnSuccess(request_id, response.Pass(), has_more); |
82 | 82 |
83 FOR_EACH_OBSERVER( | 83 FOR_EACH_OBSERVER( |
84 Observer, observers_, OnRequestFulfilled(request_id, has_next)); | 84 Observer, observers_, OnRequestFulfilled(request_id, has_more)); |
85 | 85 |
86 if (!has_next) | 86 if (!has_more) |
87 DestroyRequest(request_id); | 87 DestroyRequest(request_id); |
88 else | 88 else |
89 request_it->second->timeout_timer.Reset(); | 89 request_it->second->timeout_timer.Reset(); |
90 | 90 |
91 return true; | 91 return true; |
92 } | 92 } |
93 | 93 |
94 bool RequestManager::RejectRequest(int request_id, base::File::Error error) { | 94 bool RequestManager::RejectRequest(int request_id, base::File::Error error) { |
95 RequestMap::iterator request_it = requests_.find(request_id); | 95 RequestMap::iterator request_it = requests_.find(request_id); |
96 if (request_it == requests_.end()) | 96 if (request_it == requests_.end()) |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 return; | 139 return; |
140 | 140 |
141 delete request_it->second; | 141 delete request_it->second; |
142 requests_.erase(request_it); | 142 requests_.erase(request_it); |
143 | 143 |
144 FOR_EACH_OBSERVER(Observer, observers_, OnRequestDestroyed(request_id)); | 144 FOR_EACH_OBSERVER(Observer, observers_, OnRequestDestroyed(request_id)); |
145 } | 145 } |
146 | 146 |
147 } // namespace file_system_provider | 147 } // namespace file_system_provider |
148 } // namespace chromeos | 148 } // namespace chromeos |
OLD | NEW |