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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_NAVIGATION_OBSERVER_H_
6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_NAVIGATION_OBSERVER_H_
10 #include "base/memory/scoped_vector.h"
11 #include "chrome/browser/supervised_user/supervised_user_url_filter.h"
12 #include "chrome/browser/supervised_user/supervised_users.h"
13 #include "content/public/browser/web_contents_user_data.h"
16 class NavigationEntry
;
20 class SupervisedUserNavigationObserver
21 : public content::WebContentsUserData
<SupervisedUserNavigationObserver
> {
23 ~SupervisedUserNavigationObserver() override
;
25 const std::vector
<const content::NavigationEntry
*>*
26 blocked_navigations() const {
27 return &blocked_navigations_
.get();
30 // Called when a network request to |url| is blocked.
31 static void OnRequestBlocked(
32 int render_process_host_id
,
35 SupervisedUserURLFilter::FilteringBehaviorReason reason
,
36 const base::Callback
<void(bool)>& callback
);
39 friend class content::WebContentsUserData
<SupervisedUserNavigationObserver
>;
41 explicit SupervisedUserNavigationObserver(content::WebContents
* web_contents
);
43 void OnRequestBlockedInternal(const GURL
& url
);
45 content::WebContents
* web_contents_
;
47 // Owned by SupervisedUserService.
48 const SupervisedUserURLFilter
* url_filter_
;
50 ScopedVector
<const content::NavigationEntry
> blocked_navigations_
;
52 DISALLOW_COPY_AND_ASSIGN(SupervisedUserNavigationObserver
);
55 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_NAVIGATION_OBSERVER_H_