BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / chrome / browser / supervised_user / supervised_user_navigation_observer.h
blob6149e616ce8ea4a58d99be63c1bf03d8f97e3c62
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_service_observer.h"
12 #include "chrome/browser/supervised_user/supervised_user_url_filter.h"
13 #include "chrome/browser/supervised_user/supervised_users.h"
14 #include "content/public/browser/web_contents_user_data.h"
16 class SupervisedUserService;
18 namespace content {
19 class NavigationEntry;
20 class WebContents;
23 class SupervisedUserNavigationObserver
24 : public content::WebContentsUserData<SupervisedUserNavigationObserver>,
25 public SupervisedUserServiceObserver {
26 public:
27 ~SupervisedUserNavigationObserver() override;
29 const std::vector<const content::NavigationEntry*>*
30 blocked_navigations() const {
31 return &blocked_navigations_.get();
34 // Called when a network request to |url| is blocked.
35 static void OnRequestBlocked(
36 int render_process_host_id,
37 int render_view_id,
38 const GURL& url,
39 SupervisedUserURLFilter::FilteringBehaviorReason reason,
40 const base::Callback<void(bool)>& callback);
42 // SupervisedUserServiceObserver implementation.
43 void OnURLFilterChanged() override;
45 void URLFilterCheckCallback(
46 const GURL& url,
47 SupervisedUserURLFilter::FilteringBehavior behavior,
48 SupervisedUserURLFilter::FilteringBehaviorReason reason,
49 bool uncertain);
51 private:
52 friend class content::WebContentsUserData<SupervisedUserNavigationObserver>;
54 explicit SupervisedUserNavigationObserver(content::WebContents* web_contents);
56 void OnRequestBlockedInternal(const GURL& url);
58 content::WebContents* web_contents_;
60 // Owned by SupervisedUserService.
61 const SupervisedUserURLFilter* url_filter_;
63 // Owned by SupervisedUserServiceFactory (lifetime of Profile).
64 SupervisedUserService* supervised_user_service_;
66 ScopedVector<const content::NavigationEntry> blocked_navigations_;
68 base::WeakPtrFactory<SupervisedUserNavigationObserver> weak_ptr_factory_;
70 DISALLOW_COPY_AND_ASSIGN(SupervisedUserNavigationObserver);
73 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_NAVIGATION_OBSERVER_H_