| 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 COMPONENTS_ARC_INTENT_HELPER_LINK_HANDLER_MODEL_IMPL_H_ | 5 #ifndef COMPONENTS_ARC_INTENT_HELPER_LINK_HANDLER_MODEL_IMPL_H_ |
| 6 #define COMPONENTS_ARC_INTENT_HELPER_LINK_HANDLER_MODEL_IMPL_H_ | 6 #define COMPONENTS_ARC_INTENT_HELPER_LINK_HANDLER_MODEL_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/link_handler_model.h" | 10 #include "ash/link_handler_model.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 // Starts retrieving handler information for the |url| and returns true. | 29 // Starts retrieving handler information for the |url| and returns true. |
| 30 // Returns false when the information cannot be retrieved. In that case, | 30 // Returns false when the information cannot be retrieved. In that case, |
| 31 // the caller should delete |this| object. | 31 // the caller should delete |this| object. |
| 32 bool Init(const GURL& url); | 32 bool Init(const GURL& url); |
| 33 | 33 |
| 34 static GURL RewriteUrlFromQueryIfAvailableForTesting(const GURL& url); | 34 static GURL RewriteUrlFromQueryIfAvailableForTesting(const GURL& url); |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 mojom::IntentHelperInstance* GetIntentHelper(); | 37 mojom::IntentHelperInstance* GetIntentHelper(); |
| 38 void OnUrlHandlerList(mojo::Array<mojom::UrlHandlerInfoPtr> handlers); | 38 void OnUrlHandlerList(mojo::Array<mojom::IntentHandlerInfoPtr> handlers); |
| 39 void NotifyObserver( | 39 void NotifyObserver( |
| 40 std::unique_ptr<ActivityIconLoader::ActivityToIconsMap> icons); | 40 std::unique_ptr<ActivityIconLoader::ActivityToIconsMap> icons); |
| 41 | 41 |
| 42 // Checks if the |url| matches the following pattern: | 42 // Checks if the |url| matches the following pattern: |
| 43 // "http(s)://<valid_google_hostname>/url?...&url=<valid_url>&..." | 43 // "http(s)://<valid_google_hostname>/url?...&url=<valid_url>&..." |
| 44 // If it does, creates a new GURL object from the <valid_url> and returns it. | 44 // If it does, creates a new GURL object from the <valid_url> and returns it. |
| 45 // Otherwise, returns the original |url| as-us. | 45 // Otherwise, returns the original |url| as-us. |
| 46 static GURL RewriteUrlFromQueryIfAvailable(const GURL& url); | 46 static GURL RewriteUrlFromQueryIfAvailable(const GURL& url); |
| 47 | 47 |
| 48 base::ObserverList<Observer> observer_list_; | 48 base::ObserverList<Observer> observer_list_; |
| 49 | 49 |
| 50 // Url handler info passed from ARC. | 50 // Url handler info passed from ARC. |
| 51 mojo::Array<mojom::UrlHandlerInfoPtr> handlers_; | 51 mojo::Array<mojom::IntentHandlerInfoPtr> handlers_; |
| 52 // Activity icon info passed from ARC. | 52 // Activity icon info passed from ARC. |
| 53 ActivityIconLoader::ActivityToIconsMap icons_; | 53 ActivityIconLoader::ActivityToIconsMap icons_; |
| 54 | 54 |
| 55 // Use refptr to retain the object even if ArcIntentHelperBridge is destructed | 55 // Use refptr to retain the object even if ArcIntentHelperBridge is destructed |
| 56 // first. | 56 // first. |
| 57 scoped_refptr<ActivityIconLoader> icon_loader_; | 57 scoped_refptr<ActivityIconLoader> icon_loader_; |
| 58 | 58 |
| 59 // Always keep this the last member of this class to make sure it's the | 59 // Always keep this the last member of this class to make sure it's the |
| 60 // first thing to be destructed. | 60 // first thing to be destructed. |
| 61 base::WeakPtrFactory<LinkHandlerModelImpl> weak_ptr_factory_; | 61 base::WeakPtrFactory<LinkHandlerModelImpl> weak_ptr_factory_; |
| 62 | 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(LinkHandlerModelImpl); | 63 DISALLOW_COPY_AND_ASSIGN(LinkHandlerModelImpl); |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 } // namespace arc | 66 } // namespace arc |
| 67 | 67 |
| 68 #endif // COMPONENTS_ARC_INTENT_HELPER_LINK_HANDLER_MODEL_IMPL_H_ | 68 #endif // COMPONENTS_ARC_INTENT_HELPER_LINK_HANDLER_MODEL_IMPL_H_ |
| OLD | NEW |