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

Side by Side Diff: chrome/browser/supervised_user/supervised_user_navigation_throttle.cc

Issue 2795993002: SupervisedUserNavigationThrottle: create only for supervised profiles (Closed)
Patch Set: review Created 3 years, 8 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 | chrome/browser/supervised_user/supervised_user_navigation_throttle_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/supervised_user/supervised_user_navigation_throttle_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698