OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/supervised_user/supervised_user_navigation_observer.h" | 5 #include "chrome/browser/supervised_user/supervised_user_navigation_observer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "chrome/browser/history/history_service_factory.h" | 10 #include "chrome/browser/history/history_service_factory.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // Show the interstitial. | 62 // Show the interstitial. |
63 const bool initial_page_load = true; | 63 const bool initial_page_load = true; |
64 SupervisedUserInterstitial::Show(web_contents, url, reason, initial_page_load, | 64 SupervisedUserInterstitial::Show(web_contents, url, reason, initial_page_load, |
65 callback); | 65 callback); |
66 } | 66 } |
67 | 67 |
68 void SupervisedUserNavigationObserver::DidFinishNavigation( | 68 void SupervisedUserNavigationObserver::DidFinishNavigation( |
69 content::NavigationHandle* navigation_handle) { | 69 content::NavigationHandle* navigation_handle) { |
70 // Only filter same page navigations (eg. pushState/popState); others will | 70 // Only filter same page navigations (eg. pushState/popState); others will |
71 // have been filtered by the ResourceThrottle. | 71 // have been filtered by the ResourceThrottle. |
72 if (!navigation_handle->IsSamePage()) | 72 if (!navigation_handle->IsSameDocument()) |
73 return; | 73 return; |
74 | 74 |
75 if (!navigation_handle->IsInMainFrame()) | 75 if (!navigation_handle->IsInMainFrame()) |
76 return; | 76 return; |
77 | 77 |
78 url_filter_->GetFilteringBehaviorForURLWithAsyncChecks( | 78 url_filter_->GetFilteringBehaviorForURLWithAsyncChecks( |
79 web_contents()->GetLastCommittedURL(), | 79 web_contents()->GetLastCommittedURL(), |
80 base::Bind(&SupervisedUserNavigationObserver::URLFilterCheckCallback, | 80 base::Bind(&SupervisedUserNavigationObserver::URLFilterCheckCallback, |
81 weak_ptr_factory_.GetWeakPtr(), | 81 weak_ptr_factory_.GetWeakPtr(), |
82 navigation_handle->GetURL())); | 82 navigation_handle->GetURL())); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 if (url != web_contents()->GetLastCommittedURL()) | 129 if (url != web_contents()->GetLastCommittedURL()) |
130 return; | 130 return; |
131 | 131 |
132 const bool initial_page_load = false; | 132 const bool initial_page_load = false; |
133 if (behavior == SupervisedUserURLFilter::FilteringBehavior::BLOCK) { | 133 if (behavior == SupervisedUserURLFilter::FilteringBehavior::BLOCK) { |
134 SupervisedUserInterstitial::Show(web_contents(), url, reason, | 134 SupervisedUserInterstitial::Show(web_contents(), url, reason, |
135 initial_page_load, | 135 initial_page_load, |
136 base::Callback<void(bool)>()); | 136 base::Callback<void(bool)>()); |
137 } | 137 } |
138 } | 138 } |
OLD | NEW |