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" |
(...skipping 22 matching lines...) Expand all Loading... | |
33 bool CanTemporarilyNavigateHost(const GURL& url); | 33 bool CanTemporarilyNavigateHost(const GURL& url); |
34 | 34 |
35 // Clears the state recorded in the observer. | 35 // Clears the state recorded in the observer. |
36 void ClearObserverState(); | 36 void ClearObserverState(); |
37 | 37 |
38 // Whitelists exact URLs for redirects and host patterns for the final URL. | 38 // Whitelists exact URLs for redirects and host patterns for the final URL. |
39 // If the URL uses HTTPS, whitelists only the host on HTTPS. Clears the | 39 // If the URL uses HTTPS, whitelists only the host on HTTPS. Clears the |
40 // observer state after adding the URLs. | 40 // observer state after adding the URLs. |
41 void AddSavedURLsToWhitelistAndClearState(); | 41 void AddSavedURLsToWhitelistAndClearState(); |
42 | 42 |
43 // Returns the elevation state for the corresponding WebContents. | |
44 bool is_elevated() const; | |
45 | |
46 // Set the elevation state for the corresponding WebContents. | |
47 void SetElevated(bool is_elevated); | |
Bernhard Bauer
2013/03/20 15:08:30
If this method only changes the flag, it's okay (a
Adrian Kuegel
2013/03/20 15:51:16
Done.
| |
48 | |
43 private: | 49 private: |
44 // An observer can be in one of the following states: | 50 // An observer can be in one of the following states: |
45 // - RECORDING_URLS_BEFORE_PREVIEW: This is the initial state when the user | 51 // - RECORDING_URLS_BEFORE_PREVIEW: This is the initial state when the user |
46 // navigates to a new page. In this state the navigated URLs that should be | 52 // navigates to a new page. In this state the navigated URLs that should be |
47 // blocked are recorded. The Observer moves to the next state when an | 53 // blocked are recorded. The Observer moves to the next state when an |
48 // interstitial was shown and the user clicked "Preview" on the interstitial. | 54 // interstitial was shown and the user clicked "Preview" on the interstitial. |
49 // - RECORDING_URLS_AFTER_PREVIEW: URLs that should be blocked are | 55 // - RECORDING_URLS_AFTER_PREVIEW: URLs that should be blocked are |
50 // still recorded while the page redirects. The Observer moves to the next | 56 // still recorded while the page redirects. The Observer moves to the next |
51 // state after the page finished redirecting (DidNavigateMainFrame gets | 57 // state after the page finished redirecting (DidNavigateMainFrame gets |
52 // called). | 58 // called). |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
119 // Whether we received a user gesture. | 125 // Whether we received a user gesture. |
120 // The goal is to allow automatic redirects (in order not to break the flow | 126 // The goal is to allow automatic redirects (in order not to break the flow |
121 // or show too many interstitials) while not allowing the user to navigate | 127 // or show too many interstitials) while not allowing the user to navigate |
122 // to blocked pages. We consider a redirect to be automatic if we did | 128 // to blocked pages. We consider a redirect to be automatic if we did |
123 // not get a user gesture. | 129 // not get a user gesture. |
124 bool got_user_gesture_; | 130 bool got_user_gesture_; |
125 ObserverState state_; | 131 ObserverState state_; |
126 std::set<GURL> navigated_urls_; | 132 std::set<GURL> navigated_urls_; |
127 GURL last_url_; | 133 GURL last_url_; |
128 | 134 |
135 // The elevation state corresponding to the current WebContents. | |
136 // Will be set to true for non-managed users. | |
137 bool is_elevated_; | |
138 | |
129 int last_allowed_page_; | 139 int last_allowed_page_; |
130 | 140 |
131 DISALLOW_COPY_AND_ASSIGN(ManagedModeNavigationObserver); | 141 DISALLOW_COPY_AND_ASSIGN(ManagedModeNavigationObserver); |
132 }; | 142 }; |
133 | 143 |
134 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_NAVIGATION_OBSERVER_H_ | 144 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_NAVIGATION_OBSERVER_H_ |
OLD | NEW |