OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_ARC_INTENT_HELPER_LINK_HANDLER_MODEL_IMPL_H_ |
| 6 #define COMPONENTS_ARC_INTENT_HELPER_LINK_HANDLER_MODEL_IMPL_H_ |
| 7 |
| 8 #include "ash/renderer_context_menu/link_handler_model.h" |
| 9 #include "base/memory/weak_ptr.h" |
| 10 #include "components/arc/arc_service.h" |
| 11 #include "components/arc/common/intent_helper.mojom.h" |
| 12 |
| 13 namespace arc { |
| 14 |
| 15 class ArcBridgeService; |
| 16 |
| 17 class LinkHandlerModelImpl : public ash::LinkHandlerModel { |
| 18 public: |
| 19 explicit LinkHandlerModelImpl(ArcBridgeService* bridge_service); |
| 20 ~LinkHandlerModelImpl() override; |
| 21 |
| 22 // ash::LinkHandlerModel overrides: |
| 23 void AddObserver(Observer* observer) override; |
| 24 void OpenLinkWithHandler(const GURL& url, uint32_t handler_id) override; |
| 25 |
| 26 // Starts retrieving handler information for the |url| and returns true. |
| 27 // Returns false when the information cannot be retrieved. In that case, |
| 28 // the caller should delete |this| object. |
| 29 bool Init(const GURL& url); |
| 30 |
| 31 private: |
| 32 IntentHelperInstance* GetIntentHelper(); |
| 33 void OnUrlHandlerList(mojo::Array<UrlHandlerInfoPtr> handlers); |
| 34 void NotifyObserver(); |
| 35 |
| 36 ArcBridgeService* bridge_service_; |
| 37 |
| 38 Observer* observer_; |
| 39 mojo::Array<UrlHandlerInfoPtr> handlers_; |
| 40 bool has_results_; |
| 41 |
| 42 // Always keep this the last member of this class to make sure it's the |
| 43 // first thing to be destructed. |
| 44 base::WeakPtrFactory<LinkHandlerModelImpl> weak_ptr_factory_; |
| 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(LinkHandlerModelImpl); |
| 47 }; |
| 48 |
| 49 } // namespace arc |
| 50 |
| 51 #endif // COMPONENTS_ARC_INTENT_HELPER_LINK_HANDLER_MODEL_IMPL_H_ |
OLD | NEW |