| 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_MANAGED_MODE_MANAGED_MODE_NAVIGATION_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_NAVIGATION_OBSERVER_H_ | 6 #define CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_NAVIGATION_OBSERVER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "content/public/browser/web_contents_observer.h" | 11 #include "content/public/browser/web_contents_observer.h" |
| 12 #include "content/public/browser/web_contents_user_data.h" | 12 #include "content/public/browser/web_contents_user_data.h" |
| 13 | 13 |
| 14 class InfoBarDelegate; | 14 class InfoBarDelegate; |
| 15 class ManagedModeURLFilter; | 15 class ManagedModeURLFilter; |
| 16 class ManagedUserService; | 16 class ManagedUserService; |
| 17 | 17 |
| 18 class ManagedModeNavigationObserver | 18 class ManagedModeNavigationObserver |
| 19 : public content::WebContentsObserver, | 19 : public content::WebContentsObserver, |
| 20 public content::WebContentsUserData<ManagedModeNavigationObserver> { | 20 public content::WebContentsUserData<ManagedModeNavigationObserver> { |
| 21 public: | 21 public: |
| 22 virtual ~ManagedModeNavigationObserver(); | 22 virtual ~ManagedModeNavigationObserver(); |
| 23 | 23 |
| 24 // Sets the specific infobar as dismissed. | 24 // Sets the specific infobar as dismissed. |
| 25 void WarnInfobarDismissed(); | 25 void WarnInfobarDismissed(); |
| 26 | 26 |
| 27 // Returns the elevation state for the corresponding WebContents. | |
| 28 bool is_elevated() const; | |
| 29 | |
| 30 // Set the elevation state for the corresponding WebContents. | |
| 31 void set_elevated(bool is_elevated); | |
| 32 | |
| 33 // Adds a special history entry for the visit attempt and shows the | 27 // Adds a special history entry for the visit attempt and shows the |
| 34 // interstitial. | 28 // interstitial. |
| 35 static void OnRequestBlocked(int render_process_host_id, | 29 static void OnRequestBlocked(int render_process_host_id, |
| 36 int render_view_id, | 30 int render_view_id, |
| 37 const GURL& url, | 31 const GURL& url, |
| 38 const base::Callback<void(bool)>& callback); | 32 const base::Callback<void(bool)>& callback); |
| 39 | 33 |
| 40 private: | 34 private: |
| 41 friend class content::WebContentsUserData<ManagedModeNavigationObserver>; | 35 friend class content::WebContentsUserData<ManagedModeNavigationObserver>; |
| 42 | 36 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 55 | 49 |
| 56 // Owned by the profile, so outlives us. | 50 // Owned by the profile, so outlives us. |
| 57 ManagedUserService* managed_user_service_; | 51 ManagedUserService* managed_user_service_; |
| 58 | 52 |
| 59 // Owned by ManagedUserService. | 53 // Owned by ManagedUserService. |
| 60 const ManagedModeURLFilter* url_filter_; | 54 const ManagedModeURLFilter* url_filter_; |
| 61 | 55 |
| 62 // Owned by the InfoBarService, which has the same lifetime as this object. | 56 // Owned by the InfoBarService, which has the same lifetime as this object. |
| 63 InfoBarDelegate* warn_infobar_delegate_; | 57 InfoBarDelegate* warn_infobar_delegate_; |
| 64 | 58 |
| 65 // The elevation state corresponding to the current WebContents. | |
| 66 // Will be set to true for non-managed users. | |
| 67 bool is_elevated_; | |
| 68 | |
| 69 DISALLOW_COPY_AND_ASSIGN(ManagedModeNavigationObserver); | 59 DISALLOW_COPY_AND_ASSIGN(ManagedModeNavigationObserver); |
| 70 }; | 60 }; |
| 71 | 61 |
| 72 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_NAVIGATION_OBSERVER_H_ | 62 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_NAVIGATION_OBSERVER_H_ |
| OLD | NEW |