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

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

Issue 2498223002: arc: enable use_new_wrapper_types for intent_helper.mojom (Closed)
Patch Set: rebase Created 4 years, 1 month 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>
9 8
10 #include "ash/common/shell_delegate.h" 9 #include "ash/common/shell_delegate.h"
11 #include "ash/common/wallpaper/wallpaper_controller.h" 10 #include "ash/common/wallpaper/wallpaper_controller.h"
12 #include "ash/common/wm_shell.h" 11 #include "ash/common/wm_shell.h"
13 #include "ash/public/interfaces/new_window.mojom.h" 12 #include "ash/public/interfaces/new_window.mojom.h"
14 #include "ash/shell.h" 13 #include "ash/shell.h"
15 #include "base/command_line.h" 14 #include "base/command_line.h"
16 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
17 #include "components/arc/arc_bridge_service.h" 16 #include "components/arc/arc_bridge_service.h"
18 #include "components/arc/intent_helper/activity_icon_loader.h" 17 #include "components/arc/intent_helper/activity_icon_loader.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 arc_bridge_service()->intent_helper()->GetInstanceForMethod("Init"); 50 arc_bridge_service()->intent_helper()->GetInstanceForMethod("Init");
52 DCHECK(instance); 51 DCHECK(instance);
53 instance->Init(binding_.CreateInterfacePtrAndBind()); 52 instance->Init(binding_.CreateInterfacePtrAndBind());
54 } 53 }
55 54
56 void ArcIntentHelperBridge::OnInstanceClosed() { 55 void ArcIntentHelperBridge::OnInstanceClosed() {
57 DCHECK(thread_checker_.CalledOnValidThread()); 56 DCHECK(thread_checker_.CalledOnValidThread());
58 ash::Shell::GetInstance()->set_link_handler_model_factory(nullptr); 57 ash::Shell::GetInstance()->set_link_handler_model_factory(nullptr);
59 } 58 }
60 59
61 void ArcIntentHelperBridge::OnIconInvalidated( 60 void ArcIntentHelperBridge::OnIconInvalidated(const std::string& package_name) {
62 const mojo::String& package_name) {
63 DCHECK(thread_checker_.CalledOnValidThread()); 61 DCHECK(thread_checker_.CalledOnValidThread());
64 icon_loader_->InvalidateIcons(package_name); 62 icon_loader_->InvalidateIcons(package_name);
65 } 63 }
66 64
67 void ArcIntentHelperBridge::OnOpenDownloads() { 65 void ArcIntentHelperBridge::OnOpenDownloads() {
68 DCHECK(thread_checker_.CalledOnValidThread()); 66 DCHECK(thread_checker_.CalledOnValidThread());
69 // TODO(607411): If the FileManager is not yet open this will open to 67 // TODO(607411): If the FileManager is not yet open this will open to
70 // downloads by default, which is what we want. However if it is open it will 68 // downloads by default, which is what we want. However if it is open it will
71 // simply be brought to the forgeground without forcibly being navigated to 69 // simply be brought to the forgeground without forcibly being navigated to
72 // downloads, which is probably not ideal. 70 // downloads, which is probably not ideal.
73 ash::WmShell::Get()->new_window_client()->OpenFileManager(); 71 ash::WmShell::Get()->new_window_client()->OpenFileManager();
74 } 72 }
75 73
76 void ArcIntentHelperBridge::OnOpenUrl(const mojo::String& url) { 74 void ArcIntentHelperBridge::OnOpenUrl(const std::string& url) {
77 DCHECK(thread_checker_.CalledOnValidThread()); 75 DCHECK(thread_checker_.CalledOnValidThread());
78 GURL gurl(url.get()); 76 ash::WmShell::Get()->delegate()->OpenUrlFromArc(GURL(url));
79 ash::WmShell::Get()->delegate()->OpenUrlFromArc(gurl);
80 } 77 }
81 78
82 void ArcIntentHelperBridge::OpenWallpaperPicker() { 79 void ArcIntentHelperBridge::OpenWallpaperPicker() {
83 DCHECK(thread_checker_.CalledOnValidThread()); 80 DCHECK(thread_checker_.CalledOnValidThread());
84 ash::WmShell::Get()->wallpaper_controller()->OpenSetWallpaperPage(); 81 ash::WmShell::Get()->wallpaper_controller()->OpenSetWallpaperPage();
85 } 82 }
86 83
87 void ArcIntentHelperBridge::SetWallpaperDeprecated( 84 void ArcIntentHelperBridge::SetWallpaperDeprecated(
88 mojo::Array<uint8_t> jpeg_data) { 85 const std::vector<uint8_t>& jpeg_data) {
89 DCHECK(thread_checker_.CalledOnValidThread()); 86 DCHECK(thread_checker_.CalledOnValidThread());
90 LOG(ERROR) << "IntentHelper.SetWallpaper is deprecated"; 87 LOG(ERROR) << "IntentHelper.SetWallpaper is deprecated";
91 } 88 }
92 89
93 std::unique_ptr<ash::LinkHandlerModel> ArcIntentHelperBridge::CreateModel( 90 std::unique_ptr<ash::LinkHandlerModel> ArcIntentHelperBridge::CreateModel(
94 const GURL& url) { 91 const GURL& url) {
95 DCHECK(thread_checker_.CalledOnValidThread()); 92 DCHECK(thread_checker_.CalledOnValidThread());
96 std::unique_ptr<LinkHandlerModelImpl> impl( 93 std::unique_ptr<LinkHandlerModelImpl> impl(
97 new LinkHandlerModelImpl(icon_loader_)); 94 new LinkHandlerModelImpl(icon_loader_));
98 if (!impl->Init(url)) 95 if (!impl->Init(url))
99 return nullptr; 96 return nullptr;
100 return std::move(impl); 97 return std::move(impl);
101 } 98 }
102 99
103 // static 100 // static
104 bool ArcIntentHelperBridge::IsIntentHelperPackage( 101 bool ArcIntentHelperBridge::IsIntentHelperPackage(
105 const std::string& package_name) { 102 const std::string& package_name) {
106 return package_name == kArcIntentHelperPackageName; 103 return package_name == kArcIntentHelperPackageName;
107 } 104 }
108 105
109 // static 106 // static
110 mojo::Array<mojom::IntentHandlerInfoPtr> 107 std::vector<mojom::IntentHandlerInfoPtr>
111 ArcIntentHelperBridge::FilterOutIntentHelper( 108 ArcIntentHelperBridge::FilterOutIntentHelper(
112 mojo::Array<mojom::IntentHandlerInfoPtr> handlers) { 109 std::vector<mojom::IntentHandlerInfoPtr> handlers) {
113 mojo::Array<mojom::IntentHandlerInfoPtr> handlers_filtered; 110 std::vector<mojom::IntentHandlerInfoPtr> handlers_filtered;
114 for (auto& handler : handlers) { 111 for (auto& handler : handlers) {
115 if (IsIntentHelperPackage(handler->package_name.get())) 112 if (IsIntentHelperPackage(handler->package_name))
116 continue; 113 continue;
117 handlers_filtered.push_back(std::move(handler)); 114 handlers_filtered.push_back(std::move(handler));
118 } 115 }
119 return handlers_filtered; 116 return handlers_filtered;
120 } 117 }
121 118
122 // static 119 // static
123 mojom::IntentHelperInstance* 120 mojom::IntentHelperInstance*
124 ArcIntentHelperBridge::GetIntentHelperInstanceWithErrorCode( 121 ArcIntentHelperBridge::GetIntentHelperInstanceWithErrorCode(
125 const std::string& method_name_for_logging, 122 const std::string& method_name_for_logging,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 155
159 // static 156 // static
160 mojom::IntentHelperInstance* ArcIntentHelperBridge::GetIntentHelperInstance( 157 mojom::IntentHelperInstance* ArcIntentHelperBridge::GetIntentHelperInstance(
161 const std::string& method_name_for_logging, 158 const std::string& method_name_for_logging,
162 uint32_t min_instance_version) { 159 uint32_t min_instance_version) {
163 return GetIntentHelperInstanceWithErrorCode(method_name_for_logging, 160 return GetIntentHelperInstanceWithErrorCode(method_name_for_logging,
164 min_instance_version, nullptr); 161 min_instance_version, nullptr);
165 } 162 }
166 163
167 void ArcIntentHelperBridge::OnIntentFiltersUpdated( 164 void ArcIntentHelperBridge::OnIntentFiltersUpdated(
168 mojo::Array<mojom::IntentFilterPtr> filters) { 165 std::vector<mojom::IntentFilterPtr> filters) {
169 DCHECK(thread_checker_.CalledOnValidThread()); 166 DCHECK(thread_checker_.CalledOnValidThread());
170 activity_resolver_->UpdateIntentFilters(std::move(filters)); 167 activity_resolver_->UpdateIntentFilters(std::move(filters));
171 } 168 }
172 169
173 } // namespace arc 170 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698