1 // Copyright 2020 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_CHROMEOS_ARC_SHARESHEET_ARC_SHARESHEET_BRIDGE_H_ 6 #define CHROME_BROWSER_CHROMEOS_ARC_SHARESHEET_ARC_SHARESHEET_BRIDGE_H_ 7 8 #include "base/memory/weak_ptr.h" 9 #include "components/arc/mojom/sharesheet.mojom.h" 10 #include "components/keyed_service/core/keyed_service.h" 11 12 class Profile; 13 14 namespace content { 15 class BrowserContext; 16 } // namespace content 17 18 namespace arc { 19 20 class ArcBridgeService; 21 22 // This class handles sharesheet related IPC from ARC++ and allows sharesheet 23 // to be displayed and managed in Chrome preview instead of the Android 24 // sharesheet activity. 25 class ArcSharesheetBridge : public KeyedService, public mojom::SharesheetHost { 26 public: 27 // Returns singleton instance for the given BrowserContext, 28 // or nullptr if the browser |context| is not allowed to use ARC. 29 static ArcSharesheetBridge* GetForBrowserContext( 30 content::BrowserContext* context); 31 32 ArcSharesheetBridge(content::BrowserContext* context, 33 ArcBridgeService* bridge_service); 34 ArcSharesheetBridge(const ArcSharesheetBridge&) = delete; 35 ArcSharesheetBridge& operator=(const ArcSharesheetBridge&) = delete; 36 ~ArcSharesheetBridge() override; 37 38 // mojom::SharesheetHost overrides: 39 // TODO(phshah): Add overrides. 40 41 private: 42 ArcBridgeService* const arc_bridge_service_; // Owned by ArcServiceManager. 43 44 Profile* const profile_; 45 46 base::WeakPtrFactory<ArcSharesheetBridge> weak_ptr_factory_{this}; 47 }; 48 49 } // namespace arc 50 51 #endif // CHROME_BROWSER_CHROMEOS_ARC_SHARESHEET_ARC_SHARESHEET_BRIDGE_H_ 52