| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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 MEDIA_BASE_RENDERER_FACTORY_SELECTOR_H_ | 5 #ifndef MEDIA_BASE_RENDERER_FACTORY_SELECTOR_H_ |
| 6 #define MEDIA_BASE_RENDERER_FACTORY_SELECTOR_H_ | 6 #define MEDIA_BASE_RENDERER_FACTORY_SELECTOR_H_ |
| 7 | 7 |
| 8 #include "base/optional.h" | 8 #include "base/optional.h" |
| 9 #include "media/base/renderer_factory.h" | 9 #include "media/base/renderer_factory.h" |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // NOTE: There should be at most one factory per factory type. | 29 // NOTE: There should be at most one factory per factory type. |
| 30 void AddFactory(FactoryType type, std::unique_ptr<RendererFactory> factory); | 30 void AddFactory(FactoryType type, std::unique_ptr<RendererFactory> factory); |
| 31 | 31 |
| 32 // Sets the base factory to be returned, when there are no signals telling us | 32 // Sets the base factory to be returned, when there are no signals telling us |
| 33 // to select any specific factory. | 33 // to select any specific factory. |
| 34 // NOTE: |type| can be different than FactoryType::DEFAULT. DEFAULT is used to | 34 // NOTE: |type| can be different than FactoryType::DEFAULT. DEFAULT is used to |
| 35 // identify the DefaultRendererFactory, not to indicate that a factory should | 35 // identify the DefaultRendererFactory, not to indicate that a factory should |
| 36 // be used by default. | 36 // be used by default. |
| 37 void SetBaseFactoryType(FactoryType type); | 37 void SetBaseFactoryType(FactoryType type); |
| 38 | 38 |
| 39 // SetBaseFactoryType() must be called before calling this method. | 39 // Updates |current_factory_| if necessary, and returns its value. |
| 40 // NOTE: This only returns the base factory type at the moment. | 40 // NOTE: SetBaseFactoryType() must be called before calling this method. |
| 41 RendererFactory* GetCurrentFactory(); | 41 RendererFactory* GetCurrentFactory(); |
| 42 | 42 |
| 43 #if defined(OS_ANDROID) |
| 44 // Sets whether we should be using the MEDIA_PLAYER factory instead of the |
| 45 // base factory. |
| 46 void SetUseMediaPlayer(bool use_media_player); |
| 47 #endif |
| 48 |
| 43 private: | 49 private: |
| 50 void UpdateCurrentFactory(); |
| 51 |
| 52 bool use_media_player_ = false; |
| 53 |
| 54 bool current_factory_needs_update_ = true; |
| 55 RendererFactory* current_factory_ = nullptr; |
| 56 |
| 44 base::Optional<FactoryType> base_factory_type_; | 57 base::Optional<FactoryType> base_factory_type_; |
| 45 std::unique_ptr<RendererFactory> factories_[FACTORY_TYPE_MAX + 1]; | 58 std::unique_ptr<RendererFactory> factories_[FACTORY_TYPE_MAX + 1]; |
| 46 DISALLOW_COPY_AND_ASSIGN(RendererFactorySelector); | 59 DISALLOW_COPY_AND_ASSIGN(RendererFactorySelector); |
| 47 }; | 60 }; |
| 48 | 61 |
| 49 } // namespace media | 62 } // namespace media |
| 50 | 63 |
| 51 #endif // MEDIA_BASE_RENDERER_FACTORY_H_ | 64 #endif // MEDIA_BASE_RENDERER_FACTORY_H_ |
| OLD | NEW |