Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: components/arc/intent_helper/arc_intent_helper_bridge.cc

Issue 2078683002: Add handler and mojo interface to accept android intent filters. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unintentionally add mojo attribute and update version comment. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/desktop_background/user_wallpaper_delegate.h" 10 #include "ash/desktop_background/user_wallpaper_delegate.h"
11 #include "ash/new_window_delegate.h" 11 #include "ash/new_window_delegate.h"
12 #include "ash/shell.h" 12 #include "ash/shell.h"
13 #include "ash/shell_delegate.h" 13 #include "ash/shell_delegate.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "components/arc/intent_helper/activity_icon_loader.h" 15 #include "components/arc/intent_helper/activity_icon_loader.h"
16 #include "components/arc/intent_helper/link_handler_model_impl.h" 16 #include "components/arc/intent_helper/link_handler_model_impl.h"
17 #include "components/arc/intent_helper/local_activity_resolver.h"
17 #include "components/arc/set_wallpaper_delegate.h" 18 #include "components/arc/set_wallpaper_delegate.h"
18 #include "ui/base/layout.h" 19 #include "ui/base/layout.h"
19 #include "url/gurl.h" 20 #include "url/gurl.h"
20 21
21 namespace arc { 22 namespace arc {
22 23
23 namespace { 24 namespace {
24 25
25 constexpr char kArcIntentHelperPackageName[] = "org.chromium.arc.intent_helper"; 26 constexpr char kArcIntentHelperPackageName[] = "org.chromium.arc.intent_helper";
26 27
27 } // namespace 28 } // namespace
28 29
29 ArcIntentHelperBridge::ArcIntentHelperBridge( 30 ArcIntentHelperBridge::ArcIntentHelperBridge(
30 ArcBridgeService* bridge_service, 31 ArcBridgeService* bridge_service,
31 const scoped_refptr<ActivityIconLoader>& icon_loader, 32 const scoped_refptr<ActivityIconLoader>& icon_loader,
32 std::unique_ptr<SetWallpaperDelegate> set_wallpaper_delegate) 33 std::unique_ptr<SetWallpaperDelegate> set_wallpaper_delegate,
34 const scoped_refptr<LocalActivityResolver>& activity_resolver)
33 : ArcService(bridge_service), 35 : ArcService(bridge_service),
34 binding_(this), 36 binding_(this),
35 icon_loader_(icon_loader), 37 icon_loader_(icon_loader),
36 set_wallpaper_delegate_(std::move(set_wallpaper_delegate)) { 38 set_wallpaper_delegate_(std::move(set_wallpaper_delegate)),
39 activity_resolver_(activity_resolver) {
37 DCHECK(thread_checker_.CalledOnValidThread()); 40 DCHECK(thread_checker_.CalledOnValidThread());
38 arc_bridge_service()->AddObserver(this); 41 arc_bridge_service()->AddObserver(this);
39 } 42 }
40 43
41 ArcIntentHelperBridge::~ArcIntentHelperBridge() { 44 ArcIntentHelperBridge::~ArcIntentHelperBridge() {
42 DCHECK(thread_checker_.CalledOnValidThread()); 45 DCHECK(thread_checker_.CalledOnValidThread());
43 arc_bridge_service()->RemoveObserver(this); 46 arc_bridge_service()->RemoveObserver(this);
44 } 47 }
45 48
46 void ArcIntentHelperBridge::OnIntentHelperInstanceReady() { 49 void ArcIntentHelperBridge::OnIntentHelperInstanceReady() {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 mojo::Array<mojom::UrlHandlerInfoPtr> handlers) { 111 mojo::Array<mojom::UrlHandlerInfoPtr> handlers) {
109 mojo::Array<mojom::UrlHandlerInfoPtr> handlers_filtered; 112 mojo::Array<mojom::UrlHandlerInfoPtr> handlers_filtered;
110 for (auto& handler : handlers) { 113 for (auto& handler : handlers) {
111 if (IsIntentHelperPackage(handler->package_name.get())) 114 if (IsIntentHelperPackage(handler->package_name.get()))
112 continue; 115 continue;
113 handlers_filtered.push_back(std::move(handler)); 116 handlers_filtered.push_back(std::move(handler));
114 } 117 }
115 return handlers_filtered; 118 return handlers_filtered;
116 } 119 }
117 120
121 void ArcIntentHelperBridge::OnIntentFiltersUpdated(
122 mojo::Array<mojom::IntentFilterPtr> filters) {
123 DCHECK(thread_checker_.CalledOnValidThread());
124 activity_resolver_->UpdateIntentFilters(filters);
Yusuke Sato 2016/06/17 23:14:32 How about changing this to activity_resolver_->U
zentaro 2016/06/17 23:37:35 Done.
125 }
126
118 } // namespace arc 127 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698