Add GCMChannelStatusSyncer to schedule requests and enable/disable GCM
[chromium-blink-merge.git] / chrome / browser / supervised_user / supervised_user_navigation_observer.h
bloba78c19c5f77a56d8c45acf43a46d6515f8330a8a
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 <set>
9 #include <vector>
11 #include "base/memory/scoped_vector.h"
12 #include "base/values.h"
13 #include "chrome/browser/supervised_user/supervised_users.h"
14 #include "content/public/browser/web_contents_observer.h"
15 #include "content/public/browser/web_contents_user_data.h"
17 class SupervisedUserService;
18 class SupervisedUserURLFilter;
20 namespace content {
21 class NavigationEntry;
24 namespace infobars {
25 class InfoBar;
28 class SupervisedUserNavigationObserver
29 : public content::WebContentsObserver,
30 public content::WebContentsUserData<SupervisedUserNavigationObserver> {
31 public:
32 virtual ~SupervisedUserNavigationObserver();
34 // Sets the specific infobar as dismissed.
35 void WarnInfoBarDismissed();
37 const std::vector<const content::NavigationEntry*>*
38 blocked_navigations() const {
39 return &blocked_navigations_.get();
42 // Called when a network request to |url| is blocked.
43 static void OnRequestBlocked(int render_process_host_id,
44 int render_view_id,
45 const GURL& url,
46 const base::Callback<void(bool)>& callback);
48 private:
49 friend class content::WebContentsUserData<SupervisedUserNavigationObserver>;
51 explicit SupervisedUserNavigationObserver(content::WebContents* web_contents);
53 // content::WebContentsObserver implementation.
54 virtual void DidCommitProvisionalLoadForFrame(
55 content::RenderFrameHost* render_frame_host,
56 const GURL& url,
57 content::PageTransition transition_type) OVERRIDE;
59 void OnRequestBlockedInternal(const GURL& url);
61 // Owned by the profile, so outlives us.
62 SupervisedUserService* supervised_user_service_;
64 // Owned by SupervisedUserService.
65 const SupervisedUserURLFilter* url_filter_;
67 // Owned by the InfoBarService, which has the same lifetime as this object.
68 infobars::InfoBar* warn_infobar_;
70 ScopedVector<const content::NavigationEntry> blocked_navigations_;
72 DISALLOW_COPY_AND_ASSIGN(SupervisedUserNavigationObserver);
75 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_NAVIGATION_OBSERVER_H_