| 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_throttle.h" | 5 #include "chrome/browser/supervised_user/supervised_user_navigation_throttle.h" | 
| 6 | 6 | 
| 7 #include "base/bind.h" | 7 #include "base/bind.h" | 
| 8 #include "base/location.h" | 8 #include "base/location.h" | 
| 9 #include "base/logging.h" | 9 #include "base/logging.h" | 
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" | 
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 115 } | 115 } | 
| 116 | 116 | 
| 117 }  // namespace | 117 }  // namespace | 
| 118 | 118 | 
| 119 // static | 119 // static | 
| 120 std::unique_ptr<SupervisedUserNavigationThrottle> | 120 std::unique_ptr<SupervisedUserNavigationThrottle> | 
| 121 SupervisedUserNavigationThrottle::MaybeCreateThrottleFor( | 121 SupervisedUserNavigationThrottle::MaybeCreateThrottleFor( | 
| 122     content::NavigationHandle* navigation_handle) { | 122     content::NavigationHandle* navigation_handle) { | 
| 123   if (!navigation_handle->IsInMainFrame()) | 123   if (!navigation_handle->IsInMainFrame()) | 
| 124     return nullptr; | 124     return nullptr; | 
|  | 125   Profile* profile = Profile::FromBrowserContext( | 
|  | 126       navigation_handle->GetWebContents()->GetBrowserContext()); | 
|  | 127   if (!profile->IsSupervised()) | 
|  | 128     return nullptr; | 
| 125   // Can't use base::MakeUnique because the constructor is private. | 129   // Can't use base::MakeUnique because the constructor is private. | 
| 126   return base::WrapUnique( | 130   return base::WrapUnique( | 
| 127       new SupervisedUserNavigationThrottle(navigation_handle)); | 131       new SupervisedUserNavigationThrottle(navigation_handle)); | 
| 128 } | 132 } | 
| 129 | 133 | 
| 130 SupervisedUserNavigationThrottle::SupervisedUserNavigationThrottle( | 134 SupervisedUserNavigationThrottle::SupervisedUserNavigationThrottle( | 
| 131     content::NavigationHandle* navigation_handle) | 135     content::NavigationHandle* navigation_handle) | 
| 132     : NavigationThrottle(navigation_handle), | 136     : NavigationThrottle(navigation_handle), | 
| 133       url_filter_( | 137       url_filter_( | 
| 134           SupervisedUserServiceFactory::GetForProfile( | 138           SupervisedUserServiceFactory::GetForProfile( | 
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 236   DCHECK(deferred_); | 240   DCHECK(deferred_); | 
| 237   deferred_ = false; | 241   deferred_ = false; | 
| 238   navigation_handle()->Resume(); | 242   navigation_handle()->Resume(); | 
| 239 } | 243 } | 
| 240 | 244 | 
| 241 void SupervisedUserNavigationThrottle::Cancel() { | 245 void SupervisedUserNavigationThrottle::Cancel() { | 
| 242   DCHECK(deferred_); | 246   DCHECK(deferred_); | 
| 243   deferred_ = false; | 247   deferred_ = false; | 
| 244   navigation_handle()->CancelDeferredNavigation(CANCEL); | 248   navigation_handle()->CancelDeferredNavigation(CANCEL); | 
| 245 } | 249 } | 
| OLD | NEW | 
|---|