Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Side by Side Diff: chrome/browser/managed_mode/managed_mode_navigation_observer.h

Issue 13533017: Fix managed mode allow/block flow (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename variable Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/managed_mode/managed_mode_navigation_observer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 }; 62 };
63 63
64 friend class content::WebContentsUserData<ManagedModeNavigationObserver>; 64 friend class content::WebContentsUserData<ManagedModeNavigationObserver>;
65 65
66 explicit ManagedModeNavigationObserver(content::WebContents* web_contents); 66 explicit ManagedModeNavigationObserver(content::WebContents* web_contents);
67 67
68 // Adding the temporary exception stops the ResourceThrottle from showing 68 // Adding the temporary exception stops the ResourceThrottle from showing
69 // an interstitial for this RenderView. This allows the user to navigate 69 // an interstitial for this RenderView. This allows the user to navigate
70 // around on the website after clicking preview. 70 // around on the website after clicking preview.
71 void AddTemporaryException(); 71 void AddTemporaryException();
72 // Updates the ResourceThrottle with the latest user navigation status.
73 void UpdateExceptionNavigationStatus();
74 void RemoveTemporaryException(); 72 void RemoveTemporaryException();
75 73
76 void AddURLToPatternList(const GURL& url); 74 void AddURLToPatternList(const GURL& url);
77 75
78 // content::WebContentsObserver implementation. 76 // content::WebContentsObserver implementation.
79 // An example regarding the order in which these events take place for 77 // An example regarding the order in which these events take place for
80 // google.com in our case is as follows: 78 // google.com in our case is as follows:
81 // 1. User types in google.com and clicks enter. 79 // 1. User types in google.com and clicks enter.
82 // -> NavigateToPendingEntry: http://google.com 80 // -> NavigateToPendingEntry: http://google.com
83 // -> DidStartProvisionalLoadForFrame http://google.com 81 // -> DidStartProvisionalLoadForFrame http://google.com
(...skipping 11 matching lines...) Expand all
95 const content::FrameNavigateParams& params) OVERRIDE; 93 const content::FrameNavigateParams& params) OVERRIDE;
96 virtual void ProvisionalChangeToMainFrameUrl( 94 virtual void ProvisionalChangeToMainFrameUrl(
97 const GURL& url, 95 const GURL& url,
98 content::RenderViewHost* render_view_host) OVERRIDE; 96 content::RenderViewHost* render_view_host) OVERRIDE;
99 virtual void DidCommitProvisionalLoadForFrame( 97 virtual void DidCommitProvisionalLoadForFrame(
100 int64 frame_id, 98 int64 frame_id,
101 bool is_main_frame, 99 bool is_main_frame,
102 const GURL& url, 100 const GURL& url,
103 content::PageTransition transition_type, 101 content::PageTransition transition_type,
104 content::RenderViewHost* render_view_host) OVERRIDE; 102 content::RenderViewHost* render_view_host) OVERRIDE;
105 virtual void DidGetUserGesture() OVERRIDE;
106 103
107 // Returns whether the user would stay in elevated state if he visits this 104 // Returns whether the user would stay in elevated state if he visits this
108 // URL. 105 // URL.
109 bool ShouldStayElevatedForURL(const GURL& url); 106 bool ShouldStayElevatedForURL(const GURL& url);
110 107
111 // Owned by the profile, so outlives us. 108 // Owned by the profile, so outlives us.
112 ManagedUserService* managed_user_service_; 109 ManagedUserService* managed_user_service_;
113 110
114 // Owned by ManagedUserService. 111 // Owned by ManagedUserService.
115 const ManagedModeURLFilter* url_filter_; 112 const ManagedModeURLFilter* url_filter_;
116 113
117 // Owned by the InfoBarService, which has the same lifetime as this object. 114 // Owned by the InfoBarService, which has the same lifetime as this object.
118 InfoBarDelegate* warn_infobar_delegate_; 115 InfoBarDelegate* warn_infobar_delegate_;
119 InfoBarDelegate* preview_infobar_delegate_; 116 InfoBarDelegate* preview_infobar_delegate_;
120 117
121 // Whether we received a user gesture.
122 // The goal is to allow automatic redirects (in order not to break the flow
123 // or show too many interstitials) while not allowing the user to navigate
124 // to blocked pages. We consider a redirect to be automatic if we did
125 // not get a user gesture.
126 bool got_user_gesture_;
127 ObserverState state_; 118 ObserverState state_;
128 std::set<GURL> navigated_urls_; 119 std::set<GURL> navigated_urls_;
129 GURL last_url_; 120 GURL last_url_;
130 121
131 // The elevation state corresponding to the current WebContents. 122 // The elevation state corresponding to the current WebContents.
132 // Will be set to true for non-managed users. 123 // Will be set to true for non-managed users.
133 bool is_elevated_; 124 bool is_elevated_;
134 125
135 int last_allowed_page_; 126 int last_allowed_page_;
136 127
128 // There are two starting points for a new navigation:
129 // 1. NavigateToPendingEntry when the omnibox is used to navigate to a URL or
130 // the user goes back or forward.
131 // 2. ProvisionalChangeToMainFrameURL when the user clicks on a link.
132 // The main problem is that ProvisionalChangeToMainFrameURL is called for
133 // redirects as well and we need a way to distinguish between the two
134 // scenarios. |finished_redirects_| helps us do that by tracking the cases
135 // when the user did not click on a URL.
136 bool finished_redirects_;
137
137 DISALLOW_COPY_AND_ASSIGN(ManagedModeNavigationObserver); 138 DISALLOW_COPY_AND_ASSIGN(ManagedModeNavigationObserver);
138 }; 139 };
139 140
140 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_NAVIGATION_OBSERVER_H_ 141 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_NAVIGATION_OBSERVER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/managed_mode/managed_mode_navigation_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698