Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_FACTORY_H_ | 5 #ifndef UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_FACTORY_H_ |
| 6 #define UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_FACTORY_H_ | 6 #define UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_FACTORY_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ui/base/dragdrop/os_exchange_data.h" | 10 #include "ui/base/dragdrop/os_exchange_data.h" |
| 11 #include "ui/base/ui_base_export.h" | 11 #include "ui/base/ui_base_export.h" |
| 12 | 12 |
| 13 namespace ui { | 13 namespace ui { |
| 14 | 14 |
| 15 // Builds OSExchangeDataProviders. We need to be able to switch providers at | 15 // Builds OSExchangeDataProviders. We need to be able to switch providers at |
| 16 // runtime based on the configuration flags. If no factory is set, | 16 // runtime based on the configuration flags. If no factory is set, |
| 17 // CreateProvider() will default to the current operating system's default. | 17 // CreateProvider() will default to the current operating system's default. |
| 18 class UI_BASE_EXPORT OSExchangeDataProviderFactory { | 18 class UI_BASE_EXPORT OSExchangeDataProviderFactory { |
| 19 public: | 19 public: |
| 20 class Factory { | 20 class Factory { |
| 21 public: | 21 public: |
| 22 virtual std::unique_ptr<OSExchangeData::Provider> BuildProvider() = 0; | 22 virtual std::unique_ptr<OSExchangeData::Provider> BuildProvider() = 0; |
| 23 }; | 23 }; |
| 24 | 24 |
| 25 // Sets the factory which builds the providers. | 25 // Sets the factory which builds the providers. |
| 26 static void SetFactory(Factory* factory); | 26 static void SetFactory(Factory* factory); |
| 27 | 27 |
| 28 // Returns the current factory and sets the factory to null. | |
| 29 static Factory* TakeFactory(); | |
|
sky
2017/04/12 19:38:15
Can this return a std::unique_ptr?
Elliot Glaysher
2017/04/12 19:52:25
Not easily without changing the ownership the Fact
| |
| 30 | |
| 28 // Creates a Provider based on the current configuration. | 31 // Creates a Provider based on the current configuration. |
| 29 static std::unique_ptr<OSExchangeData::Provider> CreateProvider(); | 32 static std::unique_ptr<OSExchangeData::Provider> CreateProvider(); |
| 30 }; | 33 }; |
| 31 | 34 |
| 32 } // namespace ui | 35 } // namespace ui |
| 33 | 36 |
| 34 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_FACTORY_H_ | 37 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_FACTORY_H_ |
| OLD | NEW |