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

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

Issue 2165193002: [arc-intents] Adjust link-click detection code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo Created 4 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/metrics/histogram_macros.h" 12 #include "base/metrics/histogram_macros.h"
13 #include "components/arc/arc_bridge_service.h" 13 #include "components/arc/arc_bridge_service.h"
14 #include "components/arc/arc_service_manager.h" 14 #include "components/arc/arc_service_manager.h"
15 #include "components/arc/intent_helper/arc_intent_helper_bridge.h" 15 #include "components/arc/intent_helper/arc_intent_helper_bridge.h"
16 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
17 #include "content/public/browser/navigation_handle.h" 17 #include "content/public/browser/navigation_handle.h"
18 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 18 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
19 #include "ui/base/page_transition_types.h"
19 20
20 namespace arc { 21 namespace arc {
21 22
22 namespace { 23 namespace {
23 24
24 constexpr int kMinInstanceVersion = 7; 25 constexpr int kMinInstanceVersion = 7;
25 26
26 scoped_refptr<ActivityIconLoader> GetIconLoader() { 27 scoped_refptr<ActivityIconLoader> GetIconLoader() {
27 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 28 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
28 ArcServiceManager* arc_service_manager = ArcServiceManager::Get(); 29 ArcServiceManager* arc_service_manager = ArcServiceManager::Get();
(...skipping 27 matching lines...) Expand all
56 const ShowDisambigDialogCallback& show_disambig_dialog_cb) 57 const ShowDisambigDialogCallback& show_disambig_dialog_cb)
57 : content::NavigationThrottle(navigation_handle), 58 : content::NavigationThrottle(navigation_handle),
58 show_disambig_dialog_callback_(show_disambig_dialog_cb), 59 show_disambig_dialog_callback_(show_disambig_dialog_cb),
59 weak_ptr_factory_(this) {} 60 weak_ptr_factory_(this) {}
60 61
61 ArcNavigationThrottle::~ArcNavigationThrottle() = default; 62 ArcNavigationThrottle::~ArcNavigationThrottle() = default;
62 63
63 content::NavigationThrottle::ThrottleCheckResult 64 content::NavigationThrottle::ThrottleCheckResult
64 ArcNavigationThrottle::WillStartRequest() { 65 ArcNavigationThrottle::WillStartRequest() {
65 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 66 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
66 if (!navigation_handle()->HasUserGesture()) 67 if (navigation_handle()->GetPageTransition() != ui::PAGE_TRANSITION_LINK)
Luis Héctor Chávez 2016/07/21 18:08:36 Brace elision is only valid if there is just one s
Ben Kwa 2016/07/21 23:07:01 Done. Thanks for the catch.
68 // If this navigation event wasn't spawned by the user clicking on a link.
67 return content::NavigationThrottle::PROCEED; 69 return content::NavigationThrottle::PROCEED;
68 70
69 if (!ShouldOverrideUrlLoading(navigation_handle())) 71 if (!ShouldOverrideUrlLoading(navigation_handle()))
70 return content::NavigationThrottle::PROCEED; 72 return content::NavigationThrottle::PROCEED;
71 73
72 const GURL& url = navigation_handle()->GetURL(); 74 const GURL& url = navigation_handle()->GetURL();
73 mojom::IntentHelperInstance* bridge_instance = GetIntentHelper(); 75 mojom::IntentHelperInstance* bridge_instance = GetIntentHelper();
74 if (!bridge_instance) 76 if (!bridge_instance)
75 return content::NavigationThrottle::PROCEED; 77 return content::NavigationThrottle::PROCEED;
76 bridge_instance->RequestUrlHandlerList( 78 bridge_instance->RequestUrlHandlerList(
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 bool ArcNavigationThrottle::ShouldOverrideUrlLoading( 227 bool ArcNavigationThrottle::ShouldOverrideUrlLoading(
226 content::NavigationHandle* navigation_handle) { 228 content::NavigationHandle* navigation_handle) {
227 GURL previous_url = navigation_handle->GetReferrer().url; 229 GURL previous_url = navigation_handle->GetReferrer().url;
228 GURL current_url = navigation_handle->GetURL(); 230 GURL current_url = navigation_handle->GetURL();
229 return !net::registry_controlled_domains::SameDomainOrHost( 231 return !net::registry_controlled_domains::SameDomainOrHost(
230 current_url, previous_url, 232 current_url, previous_url,
231 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); 233 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES);
232 } 234 }
233 235
234 } // namespace arc 236 } // namespace arc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698