| 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_LOCAL_ACTIVITY_RESOLVER_H_ | 5 #ifndef COMPONENTS_ARC_INTENT_HELPER_LOCAL_ACTIVITY_RESOLVER_H_ |
| 6 #define COMPONENTS_ARC_INTENT_HELPER_LOCAL_ACTIVITY_RESOLVER_H_ | 6 #define COMPONENTS_ARC_INTENT_HELPER_LOCAL_ACTIVITY_RESOLVER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "components/arc/common/intent_helper.mojom.h" | 12 #include "components/arc/common/intent_helper.mojom.h" |
| 13 #include "components/arc/intent_helper/intent_filter.h" | 13 #include "components/arc/intent_helper/intent_filter.h" |
| 14 #include "mojo/public/cpp/bindings/array.h" | |
| 15 | 14 |
| 16 class GURL; | 15 class GURL; |
| 17 | 16 |
| 18 namespace arc { | 17 namespace arc { |
| 19 | 18 |
| 20 class LocalActivityResolver : public base::RefCounted<LocalActivityResolver> { | 19 class LocalActivityResolver : public base::RefCounted<LocalActivityResolver> { |
| 21 public: | 20 public: |
| 22 LocalActivityResolver(); | 21 LocalActivityResolver(); |
| 23 | 22 |
| 24 // Returns true when |url| can only be handled by Chrome. Otherwise, which is | 23 // Returns true when |url| can only be handled by Chrome. Otherwise, which is |
| 25 // when there might be one or more ARC apps that can handle |url|, returns | 24 // when there might be one or more ARC apps that can handle |url|, returns |
| 26 // false. This function synchronously checks the |url| without making any IPC | 25 // false. This function synchronously checks the |url| without making any IPC |
| 27 // to ARC side. Note that this function only supports http and https. If url's | 26 // to ARC side. Note that this function only supports http and https. If url's |
| 28 // scheme is neither http nor https, the function immediately returns true | 27 // scheme is neither http nor https, the function immediately returns true |
| 29 // without checking the filters. | 28 // without checking the filters. |
| 30 bool ShouldChromeHandleUrl(const GURL& url); | 29 bool ShouldChromeHandleUrl(const GURL& url); |
| 31 | 30 |
| 32 // Called when the list of intent filters on ARC side is updated. | 31 // Called when the list of intent filters on ARC side is updated. |
| 33 void UpdateIntentFilters(mojo::Array<mojom::IntentFilterPtr> intent_filters); | 32 void UpdateIntentFilters(std::vector<mojom::IntentFilterPtr> intent_filters); |
| 34 | 33 |
| 35 private: | 34 private: |
| 36 friend class base::RefCounted<LocalActivityResolver>; | 35 friend class base::RefCounted<LocalActivityResolver>; |
| 37 ~LocalActivityResolver(); | 36 ~LocalActivityResolver(); |
| 38 | 37 |
| 39 // List of intent filters from Android. Used to determine if Chrome should | 38 // List of intent filters from Android. Used to determine if Chrome should |
| 40 // handle a URL without handing off to Android. | 39 // handle a URL without handing off to Android. |
| 41 std::vector<IntentFilter> intent_filters_; | 40 std::vector<IntentFilter> intent_filters_; |
| 42 | 41 |
| 43 DISALLOW_COPY_AND_ASSIGN(LocalActivityResolver); | 42 DISALLOW_COPY_AND_ASSIGN(LocalActivityResolver); |
| 44 }; | 43 }; |
| 45 | 44 |
| 46 } // namespace arc | 45 } // namespace arc |
| 47 | 46 |
| 48 #endif // COMPONENTS_ARC_INTENT_HELPER_LOCAL_ACTIVITY_RESOLVER_H_ | 47 #endif // COMPONENTS_ARC_INTENT_HELPER_LOCAL_ACTIVITY_RESOLVER_H_ |
| OLD | NEW |