ExtensionSyncService: listen for relevant changes instead of being explicitly called...
[chromium-blink-merge.git] / chrome / browser / supervised_user / supervised_user_navigation_observer.h
blobab79655de11ccecbcbe8d63c88df3a717c11a019
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_
8 #include <vector>
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"
15 namespace content {
16 class NavigationEntry;
17 class WebContents;
20 class SupervisedUserNavigationObserver
21 : public content::WebContentsUserData<SupervisedUserNavigationObserver> {
22 public:
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,
33 int render_view_id,
34 const GURL& url,
35 SupervisedUserURLFilter::FilteringBehaviorReason reason,
36 const base::Callback<void(bool)>& callback);
38 private:
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_