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

Side by Side Diff: chrome/browser/chromeos/arc/arc_navigation_throttle.cc

Issue 2368673002: arc: Rename UrlHandlerInfo to IntentHandlerInfo. (Closed)
Patch Set: Created 4 years, 3 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 "chrome/browser/chromeos/arc/arc_navigation_throttle.h" 5 #include "chrome/browser/chromeos/arc/arc_navigation_throttle.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 return content::NavigationThrottle::PROCEED; 127 return content::NavigationThrottle::PROCEED;
128 bridge_instance->RequestUrlHandlerList( 128 bridge_instance->RequestUrlHandlerList(
129 url.spec(), base::Bind(&ArcNavigationThrottle::OnAppCandidatesReceived, 129 url.spec(), base::Bind(&ArcNavigationThrottle::OnAppCandidatesReceived,
130 weak_ptr_factory_.GetWeakPtr())); 130 weak_ptr_factory_.GetWeakPtr()));
131 return content::NavigationThrottle::DEFER; 131 return content::NavigationThrottle::DEFER;
132 } 132 }
133 133
134 // We received the array of app candidates to handle this URL (even the Chrome 134 // We received the array of app candidates to handle this URL (even the Chrome
135 // app is included). 135 // app is included).
136 void ArcNavigationThrottle::OnAppCandidatesReceived( 136 void ArcNavigationThrottle::OnAppCandidatesReceived(
137 mojo::Array<mojom::UrlHandlerInfoPtr> handlers) { 137 mojo::Array<mojom::IntentHandlerInfoPtr> handlers) {
138 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 138 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
139 if (handlers.empty() || 139 if (handlers.empty() ||
140 (handlers.size() == 1 && ArcIntentHelperBridge::IsIntentHelperPackage( 140 (handlers.size() == 1 && ArcIntentHelperBridge::IsIntentHelperPackage(
141 handlers[0]->package_name))) { 141 handlers[0]->package_name))) {
142 // This scenario shouldn't be accesed as ArcNavigationThrottle is created 142 // This scenario shouldn't be accesed as ArcNavigationThrottle is created
143 // iff there are ARC apps which can actually handle the given URL. 143 // iff there are ARC apps which can actually handle the given URL.
144 DVLOG(1) << "There are no app candidates for this URL: " 144 DVLOG(1) << "There are no app candidates for this URL: "
145 << navigation_handle()->GetURL().spec(); 145 << navigation_handle()->GetURL().spec();
146 navigation_handle()->Resume(); 146 navigation_handle()->Resume();
147 return; 147 return;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 for (const auto& handler : handlers) { 189 for (const auto& handler : handlers) {
190 activities.emplace_back(handler->package_name, handler->activity_name); 190 activities.emplace_back(handler->package_name, handler->activity_name);
191 } 191 }
192 icon_loader->GetActivityIcons( 192 icon_loader->GetActivityIcons(
193 activities, 193 activities,
194 base::Bind(&ArcNavigationThrottle::OnAppIconsReceived, 194 base::Bind(&ArcNavigationThrottle::OnAppIconsReceived,
195 weak_ptr_factory_.GetWeakPtr(), base::Passed(&handlers))); 195 weak_ptr_factory_.GetWeakPtr(), base::Passed(&handlers)));
196 } 196 }
197 197
198 void ArcNavigationThrottle::OnAppIconsReceived( 198 void ArcNavigationThrottle::OnAppIconsReceived(
199 mojo::Array<mojom::UrlHandlerInfoPtr> handlers, 199 mojo::Array<mojom::IntentHandlerInfoPtr> handlers,
200 std::unique_ptr<ActivityIconLoader::ActivityToIconsMap> icons) { 200 std::unique_ptr<ActivityIconLoader::ActivityToIconsMap> icons) {
201 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 201 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
202 std::vector<NameAndIcon> app_info; 202 std::vector<NameAndIcon> app_info;
203 203
204 for (const auto& handler : handlers) { 204 for (const auto& handler : handlers) {
205 gfx::Image icon; 205 gfx::Image icon;
206 const ActivityIconLoader::ActivityName activity(handler->package_name, 206 const ActivityIconLoader::ActivityName activity(handler->package_name,
207 handler->activity_name); 207 handler->activity_name);
208 const auto it = icons->find(activity); 208 const auto it = icons->find(activity);
209 209
210 app_info.emplace_back( 210 app_info.emplace_back(
211 handler->name, it != icons->end() ? it->second.icon20 : gfx::Image()); 211 handler->name, it != icons->end() ? it->second.icon20 : gfx::Image());
212 } 212 }
213 213
214 show_intent_picker_callback_.Run( 214 show_intent_picker_callback_.Run(
215 navigation_handle()->GetWebContents(), app_info, 215 navigation_handle()->GetWebContents(), app_info,
216 base::Bind(&ArcNavigationThrottle::OnIntentPickerClosed, 216 base::Bind(&ArcNavigationThrottle::OnIntentPickerClosed,
217 weak_ptr_factory_.GetWeakPtr(), base::Passed(&handlers))); 217 weak_ptr_factory_.GetWeakPtr(), base::Passed(&handlers)));
218 } 218 }
219 219
220 void ArcNavigationThrottle::OnIntentPickerClosed( 220 void ArcNavigationThrottle::OnIntentPickerClosed(
221 mojo::Array<mojom::UrlHandlerInfoPtr> handlers, 221 mojo::Array<mojom::IntentHandlerInfoPtr> handlers,
222 size_t selected_app_index, 222 size_t selected_app_index,
223 CloseReason close_reason) { 223 CloseReason close_reason) {
224 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 224 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
225 const GURL& url = navigation_handle()->GetURL(); 225 const GURL& url = navigation_handle()->GetURL();
226 content::NavigationHandle* handle = navigation_handle(); 226 content::NavigationHandle* handle = navigation_handle();
227 227
228 previous_user_action_ = close_reason; 228 previous_user_action_ = close_reason;
229 229
230 mojom::IntentHelperInstance* bridge = 230 mojom::IntentHelperInstance* bridge =
231 arc::ArcIntentHelperBridge::GetIntentHelperInstance(kMinInstanceVersion); 231 arc::ArcIntentHelperBridge::GetIntentHelperInstance(kMinInstanceVersion);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 } 274 }
275 275
276 // static 276 // static
277 bool ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( 277 bool ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting(
278 const GURL& previous_url, 278 const GURL& previous_url,
279 const GURL& current_url) { 279 const GURL& current_url) {
280 return ShouldOverrideUrlLoading(previous_url, current_url); 280 return ShouldOverrideUrlLoading(previous_url, current_url);
281 } 281 }
282 282
283 } // namespace arc 283 } // namespace arc
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/arc/arc_navigation_throttle.h ('k') | chrome/browser/chromeos/file_manager/arc_file_tasks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698