Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_MEDIA_SINK_SERVICE_BASE_H_ | |
| 6 #define CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_MEDIA_SINK_SERVICE_BASE_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <set> | |
| 10 | |
| 11 #include "base/gtest_prod_util.h" | |
| 12 #include "base/timer/timer.h" | |
| 13 #include "chrome/common/media_router/discovery/media_sink_internal.h" | |
| 14 #include "chrome/common/media_router/discovery/media_sink_service.h" | |
| 15 | |
| 16 namespace media_router { | |
| 17 | |
| 18 class MediaSinkServiceBase : public MediaSinkService { | |
| 19 public: | |
| 20 explicit MediaSinkServiceBase(const OnSinksDiscoveredCallback& callback); | |
| 21 ~MediaSinkServiceBase() override; | |
| 22 | |
| 23 protected: | |
| 24 void SetTimerForTest(std::unique_ptr<base::Timer> timer); | |
| 25 | |
| 26 // Called when |finish_timer_| expires. | |
| 27 void OnFetchCompleted(); | |
| 28 | |
| 29 // Helper function to start |finish_timer_|. | |
|
mark a. foltz
2017/05/15 22:04:07
Will all media sink services have the timer-based
zhaobin
2017/05/16 17:47:29
Yes, plan to implement CastMediaSinkService with t
| |
| 30 void StartTimer(); | |
| 31 | |
| 32 // Timer for finishing fetching. | |
| 33 std::unique_ptr<base::Timer> finish_timer_; | |
| 34 | |
| 35 // Time out value for |finish_timer_| | |
| 36 int fetch_complete_timeout_secs_; | |
| 37 | |
| 38 // Sorted sinks from current round of discovery. | |
| 39 std::set<MediaSinkInternal> current_sinks_; | |
| 40 | |
| 41 // Sorted sinks sent to Media Router Provider in last FetchCompleted(). | |
| 42 std::set<MediaSinkInternal> mrp_sinks_; | |
| 43 | |
| 44 private: | |
| 45 friend class MediaSinkServiceBaseTest; | |
| 46 FRIEND_TEST_ALL_PREFIXES(MediaSinkServiceBaseTest, | |
| 47 TestFetchCompleted_SameSink); | |
| 48 }; | |
| 49 | |
| 50 } // namespace media_router | |
| 51 | |
| 52 #endif // CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_MEDIA_SINK_SERVICE_BASE_H_ | |
| OLD | NEW |