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/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 LinkHandlerModelImpl : public ash::LinkHandlerModel { |
| 16 public: |
| 17 LinkHandlerModelImpl(); |
| 18 ~LinkHandlerModelImpl() override; |
| 19 |
| 20 // ash::LinkHandlerModel overrides: |
| 21 void AddObserver(Observer* observer) override; |
| 22 void OpenLinkWithHandler(const GURL& url, uint32_t handler_id) override; |
| 23 |
| 24 // Starts retrieving handler information for the |url| and returns true. |
| 25 // Returns false when the information cannot be retrieved. In that case, |
| 26 // the caller should delete |this| object. |
| 27 bool Init(const GURL& url); |
| 28 |
| 29 private: |
| 30 mojom::IntentHelperInstance* GetIntentHelper(); |
| 31 void OnUrlHandlerList(mojo::Array<mojom::UrlHandlerInfoPtr> handlers); |
| 32 void NotifyObserver(); |
| 33 |
| 34 Observer* observer_; |
| 35 mojo::Array<mojom::UrlHandlerInfoPtr> handlers_; |
| 36 |
| 37 // Always keep this the last member of this class to make sure it's the |
| 38 // first thing to be destructed. |
| 39 base::WeakPtrFactory<LinkHandlerModelImpl> weak_ptr_factory_; |
| 40 |
| 41 DISALLOW_COPY_AND_ASSIGN(LinkHandlerModelImpl); |
| 42 }; |
| 43 |
| 44 } // namespace arc |
| 45 |
| 46 #endif // COMPONENTS_ARC_INTENT_HELPER_LINK_HANDLER_MODEL_IMPL_H_ |
OLD | NEW |