| 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 #include "components/arc/intent_helper/arc_intent_helper_bridge.h" | 5 #include "components/arc/intent_helper/arc_intent_helper_bridge.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/desktop_background/user_wallpaper_delegate.h" | 9 #include "ash/desktop_background/user_wallpaper_delegate.h" |
| 10 #include "ash/new_window_delegate.h" | 10 #include "ash/new_window_delegate.h" |
| 11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "ash/shell_delegate.h" | 12 #include "ash/shell_delegate.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "components/arc/intent_helper/activity_icon_loader.h" | 14 #include "components/arc/intent_helper/activity_icon_loader.h" |
| 15 #include "components/arc/intent_helper/link_handler_model_impl.h" | 15 #include "components/arc/intent_helper/link_handler_model_impl.h" |
| 16 #include "components/arc/intent_helper/local_activity_resolver.h" |
| 16 #include "ui/base/layout.h" | 17 #include "ui/base/layout.h" |
| 17 #include "url/gurl.h" | 18 #include "url/gurl.h" |
| 18 | 19 |
| 19 namespace arc { | 20 namespace arc { |
| 20 | 21 |
| 21 namespace { | 22 namespace { |
| 22 | 23 |
| 23 constexpr char kArcIntentHelperPackageName[] = "org.chromium.arc.intent_helper"; | 24 constexpr char kArcIntentHelperPackageName[] = "org.chromium.arc.intent_helper"; |
| 24 | 25 |
| 25 } // namespace | 26 } // namespace |
| 26 | 27 |
| 27 ArcIntentHelperBridge::ArcIntentHelperBridge( | 28 ArcIntentHelperBridge::ArcIntentHelperBridge( |
| 28 ArcBridgeService* bridge_service, | 29 ArcBridgeService* bridge_service, |
| 29 const scoped_refptr<ActivityIconLoader>& icon_loader) | 30 const scoped_refptr<ActivityIconLoader>& icon_loader, |
| 30 : ArcService(bridge_service), binding_(this), icon_loader_(icon_loader) { | 31 const scoped_refptr<LocalActivityResolver>& activity_resolver) |
| 32 : ArcService(bridge_service), |
| 33 binding_(this), |
| 34 icon_loader_(icon_loader), |
| 35 activity_resolver_(activity_resolver) { |
| 31 arc_bridge_service()->AddObserver(this); | 36 arc_bridge_service()->AddObserver(this); |
| 32 } | 37 } |
| 33 | 38 |
| 34 ArcIntentHelperBridge::~ArcIntentHelperBridge() { | 39 ArcIntentHelperBridge::~ArcIntentHelperBridge() { |
| 35 arc_bridge_service()->RemoveObserver(this); | 40 arc_bridge_service()->RemoveObserver(this); |
| 36 } | 41 } |
| 37 | 42 |
| 38 void ArcIntentHelperBridge::OnIntentHelperInstanceReady() { | 43 void ArcIntentHelperBridge::OnIntentHelperInstanceReady() { |
| 39 ash::Shell::GetInstance()->set_link_handler_model_factory(this); | 44 ash::Shell::GetInstance()->set_link_handler_model_factory(this); |
| 40 arc_bridge_service()->intent_helper_instance()->Init( | 45 arc_bridge_service()->intent_helper_instance()->Init( |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 mojo::Array<mojom::UrlHandlerInfoPtr> handlers) { | 93 mojo::Array<mojom::UrlHandlerInfoPtr> handlers) { |
| 89 mojo::Array<mojom::UrlHandlerInfoPtr> handlers_filtered; | 94 mojo::Array<mojom::UrlHandlerInfoPtr> handlers_filtered; |
| 90 for (auto& handler : handlers) { | 95 for (auto& handler : handlers) { |
| 91 if (IsIntentHelperPackage(handler->package_name.get())) | 96 if (IsIntentHelperPackage(handler->package_name.get())) |
| 92 continue; | 97 continue; |
| 93 handlers_filtered.push_back(std::move(handler)); | 98 handlers_filtered.push_back(std::move(handler)); |
| 94 } | 99 } |
| 95 return handlers_filtered; | 100 return handlers_filtered; |
| 96 } | 101 } |
| 97 | 102 |
| 103 void ArcIntentHelperBridge::OnIntentFiltersUpdated( |
| 104 mojo::Array<mojom::IntentFilterPtr> filters) { |
| 105 activity_resolver_->UpdateIntentFilters(filters); |
| 106 } |
| 107 |
| 98 } // namespace arc | 108 } // namespace arc |
| OLD | NEW |