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

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

Issue 2795993002: SupervisedUserNavigationThrottle: create only for supervised profiles (Closed)
Patch Set: simplify 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
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 else 113 else
114 UMA_HISTOGRAM_SPARSE_SLOWLY("ManagedUsers.FilteringResult", value); 114 UMA_HISTOGRAM_SPARSE_SLOWLY("ManagedUsers.FilteringResult", value);
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 Profile* profile = Profile::FromBrowserContext(
124 navigation_handle->GetWebContents()->GetBrowserContext());
125 if (!profile->IsSupervised() || !navigation_handle->IsInMainFrame())
Bernhard Bauer 2017/04/05 09:31:12 I would split these up into two separate checks.
Marc Treib 2017/04/05 11:43:33 Done.
124 return nullptr; 126 return nullptr;
125 // Can't use base::MakeUnique because the constructor is private. 127 // Can't use base::MakeUnique because the constructor is private.
126 return base::WrapUnique( 128 return base::WrapUnique(
127 new SupervisedUserNavigationThrottle(navigation_handle)); 129 new SupervisedUserNavigationThrottle(navigation_handle));
128 } 130 }
129 131
130 SupervisedUserNavigationThrottle::SupervisedUserNavigationThrottle( 132 SupervisedUserNavigationThrottle::SupervisedUserNavigationThrottle(
131 content::NavigationHandle* navigation_handle) 133 content::NavigationHandle* navigation_handle)
132 : NavigationThrottle(navigation_handle), 134 : NavigationThrottle(navigation_handle),
133 url_filter_( 135 url_filter_(
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 DCHECK(deferred_); 238 DCHECK(deferred_);
237 deferred_ = false; 239 deferred_ = false;
238 navigation_handle()->Resume(); 240 navigation_handle()->Resume();
239 } 241 }
240 242
241 void SupervisedUserNavigationThrottle::Cancel() { 243 void SupervisedUserNavigationThrottle::Cancel() {
242 DCHECK(deferred_); 244 DCHECK(deferred_);
243 deferred_ = false; 245 deferred_ = false;
244 navigation_handle()->CancelDeferredNavigation(CANCEL); 246 navigation_handle()->CancelDeferredNavigation(CANCEL);
245 } 247 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698