Check USB device path access when prompting users to select a device.
[chromium-blink-merge.git] / chrome / browser / supervised_user / supervised_user_navigation_observer.h
blob227562aa91cea20e4cbd6357e17c60bbdeb1b071
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_user_url_filter.h"
14 #include "chrome/browser/supervised_user/supervised_users.h"
15 #include "content/public/browser/web_contents_observer.h"
16 #include "content/public/browser/web_contents_user_data.h"
18 class SupervisedUserService;
19 class SupervisedUserURLFilter;
21 namespace content {
22 class NavigationEntry;
25 namespace infobars {
26 class InfoBar;
29 class SupervisedUserNavigationObserver
30 : public content::WebContentsObserver,
31 public content::WebContentsUserData<SupervisedUserNavigationObserver> {
32 public:
33 ~SupervisedUserNavigationObserver() override;
35 // Sets the specific infobar as dismissed.
36 void WarnInfoBarDismissed();
38 const std::vector<const content::NavigationEntry*>*
39 blocked_navigations() const {
40 return &blocked_navigations_.get();
43 // Called when a network request to |url| is blocked.
44 static void OnRequestBlocked(
45 int render_process_host_id,
46 int render_view_id,
47 const GURL& url,
48 SupervisedUserURLFilter::FilteringBehaviorReason reason,
49 const base::Callback<void(bool)>& callback);
51 private:
52 friend class content::WebContentsUserData<SupervisedUserNavigationObserver>;
54 explicit SupervisedUserNavigationObserver(content::WebContents* web_contents);
56 // content::WebContentsObserver implementation.
57 void DidCommitProvisionalLoadForFrame(
58 content::RenderFrameHost* render_frame_host,
59 const GURL& url,
60 ui::PageTransition transition_type) override;
62 void OnRequestBlockedInternal(const GURL& url);
64 // Owned by the profile, so outlives us.
65 SupervisedUserService* supervised_user_service_;
67 // Owned by SupervisedUserService.
68 const SupervisedUserURLFilter* url_filter_;
70 // Owned by the InfoBarService, which has the same lifetime as this object.
71 infobars::InfoBar* warn_infobar_;
73 ScopedVector<const content::NavigationEntry> blocked_navigations_;
75 DISALLOW_COPY_AND_ASSIGN(SupervisedUserNavigationObserver);
78 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_NAVIGATION_OBSERVER_H_