| 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 #ifndef CHROME_TEST_BASE_UI_TEST_UTILS_H_ | 5 #ifndef CHROME_TEST_BASE_UI_TEST_UTILS_H_ |
| 6 #define CHROME_TEST_BASE_UI_TEST_UTILS_H_ | 6 #define CHROME_TEST_BASE_UI_TEST_UTILS_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 // Fills |details| with the details of the notification received for |source|. | 212 // Fills |details| with the details of the notification received for |source|. |
| 213 bool GetDetailsFor(uintptr_t source, U* details) { | 213 bool GetDetailsFor(uintptr_t source, U* details) { |
| 214 typename std::map<uintptr_t, U>::const_iterator iter = | 214 typename std::map<uintptr_t, U>::const_iterator iter = |
| 215 details_.find(source); | 215 details_.find(source); |
| 216 if (iter == details_.end()) | 216 if (iter == details_.end()) |
| 217 return false; | 217 return false; |
| 218 *details = iter->second; | 218 *details = iter->second; |
| 219 return true; | 219 return true; |
| 220 } | 220 } |
| 221 | 221 |
| 222 virtual void Observe(int type, | 222 void Observe(int type, |
| 223 const content::NotificationSource& source, | 223 const content::NotificationSource& source, |
| 224 const content::NotificationDetails& details) override { | 224 const content::NotificationDetails& details) override { |
| 225 const U* details_ptr = content::Details<U>(details).ptr(); | 225 const U* details_ptr = content::Details<U>(details).ptr(); |
| 226 if (details_ptr) | 226 if (details_ptr) |
| 227 details_[source.map_key()] = *details_ptr; | 227 details_[source.map_key()] = *details_ptr; |
| 228 content::WindowedNotificationObserver::Observe(type, source, details); | 228 content::WindowedNotificationObserver::Observe(type, source, details); |
| 229 } | 229 } |
| 230 | 230 |
| 231 private: | 231 private: |
| 232 std::map<uintptr_t, U> details_; | 232 std::map<uintptr_t, U> details_; |
| 233 | 233 |
| 234 DISALLOW_COPY_AND_ASSIGN(WindowedNotificationObserverWithDetails); | 234 DISALLOW_COPY_AND_ASSIGN(WindowedNotificationObserverWithDetails); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 std::vector<GURL> urls_; | 293 std::vector<GURL> urls_; |
| 294 | 294 |
| 295 base::CancelableTaskTracker tracker_; | 295 base::CancelableTaskTracker tracker_; |
| 296 | 296 |
| 297 DISALLOW_COPY_AND_ASSIGN(HistoryEnumerator); | 297 DISALLOW_COPY_AND_ASSIGN(HistoryEnumerator); |
| 298 }; | 298 }; |
| 299 | 299 |
| 300 } // namespace ui_test_utils | 300 } // namespace ui_test_utils |
| 301 | 301 |
| 302 #endif // CHROME_TEST_BASE_UI_TEST_UTILS_H_ | 302 #endif // CHROME_TEST_BASE_UI_TEST_UTILS_H_ |
| OLD | NEW |