OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_NAVIGATION_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_NAVIGATION_OBSERVER_H_ |
6 #define CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_NAVIGATION_OBSERVER_H_ | 6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_NAVIGATION_OBSERVER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/managed_mode/managed_users.h" | 13 #include "chrome/browser/supervised_user/supervised_users.h" |
14 #include "content/public/browser/web_contents_observer.h" | 14 #include "content/public/browser/web_contents_observer.h" |
15 #include "content/public/browser/web_contents_user_data.h" | 15 #include "content/public/browser/web_contents_user_data.h" |
16 | 16 |
17 class ManagedModeURLFilter; | 17 class SupervisedUserService; |
18 class ManagedUserService; | 18 class SupervisedUserURLFilter; |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 class NavigationEntry; | 21 class NavigationEntry; |
22 } | 22 } |
23 | 23 |
24 namespace infobars { | 24 namespace infobars { |
25 class InfoBar; | 25 class InfoBar; |
26 } | 26 } |
27 | 27 |
28 class ManagedModeNavigationObserver | 28 class SupervisedUserNavigationObserver |
29 : public content::WebContentsObserver, | 29 : public content::WebContentsObserver, |
30 public content::WebContentsUserData<ManagedModeNavigationObserver> { | 30 public content::WebContentsUserData<SupervisedUserNavigationObserver> { |
31 public: | 31 public: |
32 virtual ~ManagedModeNavigationObserver(); | 32 virtual ~SupervisedUserNavigationObserver(); |
33 | 33 |
34 // Sets the specific infobar as dismissed. | 34 // Sets the specific infobar as dismissed. |
35 void WarnInfoBarDismissed(); | 35 void WarnInfoBarDismissed(); |
36 | 36 |
37 const std::vector<const content::NavigationEntry*>* | 37 const std::vector<const content::NavigationEntry*>* |
38 blocked_navigations() const { | 38 blocked_navigations() const { |
39 return &blocked_navigations_.get(); | 39 return &blocked_navigations_.get(); |
40 } | 40 } |
41 | 41 |
42 // Called when a network request to |url| is blocked. | 42 // Called when a network request to |url| is blocked. |
43 static void OnRequestBlocked(int render_process_host_id, | 43 static void OnRequestBlocked(int render_process_host_id, |
44 int render_view_id, | 44 int render_view_id, |
45 const GURL& url, | 45 const GURL& url, |
46 const base::Callback<void(bool)>& callback); | 46 const base::Callback<void(bool)>& callback); |
47 | 47 |
48 private: | 48 private: |
49 friend class content::WebContentsUserData<ManagedModeNavigationObserver>; | 49 friend class content::WebContentsUserData<SupervisedUserNavigationObserver>; |
50 | 50 |
51 explicit ManagedModeNavigationObserver(content::WebContents* web_contents); | 51 explicit SupervisedUserNavigationObserver(content::WebContents* web_contents); |
52 | 52 |
53 // content::WebContentsObserver implementation. | 53 // content::WebContentsObserver implementation. |
54 virtual void ProvisionalChangeToMainFrameUrl( | 54 virtual void ProvisionalChangeToMainFrameUrl( |
55 const GURL& url, | 55 const GURL& url, |
56 content::RenderFrameHost* render_frame_host) OVERRIDE; | 56 content::RenderFrameHost* render_frame_host) OVERRIDE; |
57 virtual void DidCommitProvisionalLoadForFrame( | 57 virtual void DidCommitProvisionalLoadForFrame( |
58 int64 frame_id, | 58 int64 frame_id, |
59 const base::string16& frame_unique_name, | 59 const base::string16& frame_unique_name, |
60 bool is_main_frame, | 60 bool is_main_frame, |
61 const GURL& url, | 61 const GURL& url, |
62 content::PageTransition transition_type, | 62 content::PageTransition transition_type, |
63 content::RenderViewHost* render_view_host) OVERRIDE; | 63 content::RenderViewHost* render_view_host) OVERRIDE; |
64 | 64 |
65 void OnRequestBlockedInternal(const GURL& url); | 65 void OnRequestBlockedInternal(const GURL& url); |
66 | 66 |
67 // Owned by the profile, so outlives us. | 67 // Owned by the profile, so outlives us. |
68 ManagedUserService* managed_user_service_; | 68 SupervisedUserService* supervised_user_service_; |
69 | 69 |
70 // Owned by ManagedUserService. | 70 // Owned by SupervisedUserService. |
71 const ManagedModeURLFilter* url_filter_; | 71 const SupervisedUserURLFilter* url_filter_; |
72 | 72 |
73 // Owned by the InfoBarService, which has the same lifetime as this object. | 73 // Owned by the InfoBarService, which has the same lifetime as this object. |
74 infobars::InfoBar* warn_infobar_; | 74 infobars::InfoBar* warn_infobar_; |
75 | 75 |
76 ScopedVector<const content::NavigationEntry> blocked_navigations_; | 76 ScopedVector<const content::NavigationEntry> blocked_navigations_; |
77 | 77 |
78 DISALLOW_COPY_AND_ASSIGN(ManagedModeNavigationObserver); | 78 DISALLOW_COPY_AND_ASSIGN(SupervisedUserNavigationObserver); |
79 }; | 79 }; |
80 | 80 |
81 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_NAVIGATION_OBSERVER_H_ | 81 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_NAVIGATION_OBSERVER_H_ |
OLD | NEW |