| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_SUPERVISED_USER_SUPERVISED_USER_NAVIGATION_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_NAVIGATION_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_NAVIGATION_OBSERVER_H_ | 6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_NAVIGATION_OBSERVER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "chrome/browser/supervised_user/supervised_user_service_observer.h" | 11 #include "chrome/browser/supervised_user/supervised_user_service_observer.h" |
| 12 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" | 12 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" |
| 13 #include "chrome/browser/supervised_user/supervised_users.h" | 13 #include "chrome/browser/supervised_user/supervised_users.h" |
| 14 #include "components/sessions/core/serialized_navigation_entry.h" | 14 #include "components/sessions/core/serialized_navigation_entry.h" |
| 15 #include "components/supervised_user_error_page/supervised_user_error_page.h" | 15 #include "components/supervised_user_error_page/supervised_user_error_page.h" |
| 16 #include "content/public/browser/resource_request_info.h" | |
| 17 #include "content/public/browser/web_contents_observer.h" | 16 #include "content/public/browser/web_contents_observer.h" |
| 18 #include "content/public/browser/web_contents_user_data.h" | 17 #include "content/public/browser/web_contents_user_data.h" |
| 19 | 18 |
| 20 class SupervisedUserService; | 19 class SupervisedUserService; |
| 21 | 20 |
| 22 namespace content { | 21 namespace content { |
| 23 class NavigationHandle; | 22 class NavigationHandle; |
| 24 class WebContents; | 23 class WebContents; |
| 25 } | 24 } |
| 26 | 25 |
| 27 class SupervisedUserNavigationObserver | 26 class SupervisedUserNavigationObserver |
| 28 : public content::WebContentsUserData<SupervisedUserNavigationObserver>, | 27 : public content::WebContentsUserData<SupervisedUserNavigationObserver>, |
| 29 public content::WebContentsObserver, | 28 public content::WebContentsObserver, |
| 30 public SupervisedUserServiceObserver { | 29 public SupervisedUserServiceObserver { |
| 31 public: | 30 public: |
| 32 ~SupervisedUserNavigationObserver() override; | 31 ~SupervisedUserNavigationObserver() override; |
| 33 | 32 |
| 34 const std::vector<std::unique_ptr<const sessions::SerializedNavigationEntry>>& | 33 const std::vector<std::unique_ptr<const sessions::SerializedNavigationEntry>>& |
| 35 blocked_navigations() const { | 34 blocked_navigations() const { |
| 36 return blocked_navigations_; | 35 return blocked_navigations_; |
| 37 } | 36 } |
| 38 | 37 |
| 39 // Called when a network request to |url| is blocked. | 38 // Called when a network request to |url| is blocked. |
| 40 static void OnRequestBlocked( | 39 static void OnRequestBlocked( |
| 41 const content::ResourceRequestInfo::WebContentsGetter& | 40 content::WebContents* web_contents, |
| 42 web_contents_getter, | |
| 43 const GURL& url, | 41 const GURL& url, |
| 44 supervised_user_error_page::FilteringBehaviorReason reason, | 42 supervised_user_error_page::FilteringBehaviorReason reason, |
| 45 const base::Callback<void(bool)>& callback); | 43 const base::Callback<void(bool)>& callback); |
| 46 | 44 |
| 47 // WebContentsObserver implementation. | 45 // WebContentsObserver implementation. |
| 48 void DidFinishNavigation( | 46 void DidFinishNavigation( |
| 49 content::NavigationHandle* navigation_handle) override; | 47 content::NavigationHandle* navigation_handle) override; |
| 50 | 48 |
| 51 // SupervisedUserServiceObserver implementation. | 49 // SupervisedUserServiceObserver implementation. |
| 52 void OnURLFilterChanged() override; | 50 void OnURLFilterChanged() override; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 72 | 70 |
| 73 std::vector<std::unique_ptr<const sessions::SerializedNavigationEntry>> | 71 std::vector<std::unique_ptr<const sessions::SerializedNavigationEntry>> |
| 74 blocked_navigations_; | 72 blocked_navigations_; |
| 75 | 73 |
| 76 base::WeakPtrFactory<SupervisedUserNavigationObserver> weak_ptr_factory_; | 74 base::WeakPtrFactory<SupervisedUserNavigationObserver> weak_ptr_factory_; |
| 77 | 75 |
| 78 DISALLOW_COPY_AND_ASSIGN(SupervisedUserNavigationObserver); | 76 DISALLOW_COPY_AND_ASSIGN(SupervisedUserNavigationObserver); |
| 79 }; | 77 }; |
| 80 | 78 |
| 81 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_NAVIGATION_OBSERVER_H_ | 79 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_NAVIGATION_OBSERVER_H_ |
| OLD | NEW |