Chromium Code Reviews| 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 | 14 |
| 15 class GURL; | 15 class GURL; |
| 16 | 16 |
| 17 namespace arc { | 17 namespace arc { |
| 18 | 18 |
| 19 class IntentFilter; | |
|
Yusuke Sato
2016/11/30 21:47:16
seems unnecessary (see L13 & L42)
yoshiki
2016/12/02 19:34:28
Done.
| |
| 20 | |
| 19 class LocalActivityResolver : public base::RefCounted<LocalActivityResolver> { | 21 class LocalActivityResolver : public base::RefCounted<LocalActivityResolver> { |
| 20 public: | 22 public: |
| 21 LocalActivityResolver(); | 23 LocalActivityResolver(); |
| 22 | 24 |
| 23 // Returns true when |url| can only be handled by Chrome. Otherwise, which is | 25 // Returns true when |url| can only be handled by Chrome. Otherwise, which is |
| 24 // when there might be one or more ARC apps that can handle |url|, returns | 26 // when there might be one or more ARC apps that can handle |url|, returns |
| 25 // false. This function synchronously checks the |url| without making any IPC | 27 // false. This function synchronously checks the |url| without making any IPC |
| 26 // to ARC side. Note that this function only supports http and https. If url's | 28 // to ARC side. Note that this function only supports http and https. If url's |
| 27 // scheme is neither http nor https, the function immediately returns true | 29 // scheme is neither http nor https, the function immediately returns true |
| 28 // without checking the filters. | 30 // without checking the filters. |
| 29 bool ShouldChromeHandleUrl(const GURL& url); | 31 bool ShouldChromeHandleUrl(const GURL& url); |
| 30 | 32 |
| 31 // Called when the list of intent filters on ARC side is updated. | 33 // Called when the list of intent filters on ARC side is updated. |
| 32 void UpdateIntentFilters(std::vector<mojom::IntentFilterPtr> intent_filters); | 34 void UpdateIntentFilters(std::vector<IntentFilter> intent_filters); |
| 33 | 35 |
| 34 private: | 36 private: |
| 35 friend class base::RefCounted<LocalActivityResolver>; | 37 friend class base::RefCounted<LocalActivityResolver>; |
| 36 ~LocalActivityResolver(); | 38 ~LocalActivityResolver(); |
| 37 | 39 |
| 38 // List of intent filters from Android. Used to determine if Chrome should | 40 // List of intent filters from Android. Used to determine if Chrome should |
| 39 // handle a URL without handing off to Android. | 41 // handle a URL without handing off to Android. |
| 40 std::vector<IntentFilter> intent_filters_; | 42 std::vector<IntentFilter> intent_filters_; |
| 41 | 43 |
| 42 DISALLOW_COPY_AND_ASSIGN(LocalActivityResolver); | 44 DISALLOW_COPY_AND_ASSIGN(LocalActivityResolver); |
| 43 }; | 45 }; |
| 44 | 46 |
| 45 } // namespace arc | 47 } // namespace arc |
| 46 | 48 |
| 47 #endif // COMPONENTS_ARC_INTENT_HELPER_LOCAL_ACTIVITY_RESOLVER_H_ | 49 #endif // COMPONENTS_ARC_INTENT_HELPER_LOCAL_ACTIVITY_RESOLVER_H_ |
| OLD | NEW |