1 // Copyright 2019 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_SEND_TAB_TO_SELF_RECEIVING_UI_HANDLER_REGISTRY_H_ 6 #define CHROME_BROWSER_SEND_TAB_TO_SELF_RECEIVING_UI_HANDLER_REGISTRY_H_ 7 8 #include <memory> 9 #include <vector> 10 11 #include "base/macros.h" 12 13 class Profile; 14 15 namespace base { 16 template <typename T> 17 struct DefaultSingletonTraits; 18 } // namespace base 19 20 namespace send_tab_to_self { 21 22 class ReceivingUiHandler; 23 24 // Registry responsible for keeping track of which UI handlers are appropriate 25 // for each platform. A platform can have multiple handlers which are 26 // called in the order specified. 27 // Singleton. 28 class ReceivingUiHandlerRegistry { 29 public: 30 // Returns the singleton instance of this class. 31 static ReceivingUiHandlerRegistry* GetInstance(); 32 void InstantiatePlatformSpecificHandlers(Profile* profile_); 33 34 // Returns all the handlers to perform UI updates for the platform. 35 // Called by the SendTabToSelfClientService. 36 const std::vector<std::unique_ptr<ReceivingUiHandler>>& GetHandlers() const; 37 38 private: 39 friend struct base::DefaultSingletonTraits<ReceivingUiHandlerRegistry>; 40 41 ReceivingUiHandlerRegistry(); 42 ~ReceivingUiHandlerRegistry(); 43 std::vector<std::unique_ptr<ReceivingUiHandler>> applicable_handlers_; 44 DISALLOW_COPY_AND_ASSIGN(ReceivingUiHandlerRegistry); 45 }; 46 47 } // namespace send_tab_to_self 48 49 #endif // CHROME_BROWSER_SEND_TAB_TO_SELF_RECEIVING_UI_HANDLER_REGISTRY_H_ 50