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 | 17 |
17 class ManagedModeNavigationObserver | 18 class ManagedModeNavigationObserver |
18 : public content::WebContentsObserver, | 19 : public content::WebContentsObserver, |
19 public content::WebContentsUserData<ManagedModeNavigationObserver> { | 20 public content::WebContentsUserData<ManagedModeNavigationObserver> { |
20 public: | 21 public: |
21 virtual ~ManagedModeNavigationObserver(); | 22 virtual ~ManagedModeNavigationObserver(); |
22 | 23 |
23 // Sets the specific infobar as dismissed. | 24 // Sets the specific infobar as dismissed. |
24 void WarnInfobarDismissed(); | 25 void WarnInfobarDismissed(); |
25 void PreviewInfobarDismissed(); | 26 void PreviewInfobarDismissed(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 void RemoveTemporaryException(); | 69 void RemoveTemporaryException(); |
69 | 70 |
70 void AddURLToPatternList(const GURL& url); | 71 void AddURLToPatternList(const GURL& url); |
71 void AddURLAsLastPattern(const GURL& url); | 72 void AddURLAsLastPattern(const GURL& url); |
72 | 73 |
73 // content::WebContentsObserver implementation. | 74 // content::WebContentsObserver implementation. |
74 // An example regarding the order in which these events take place for | 75 // An example regarding the order in which these events take place for |
75 // google.com in our case is as follows: | 76 // google.com in our case is as follows: |
76 // 1. User types in google.com and clicks enter. | 77 // 1. User types in google.com and clicks enter. |
77 // -> NavigateToPendingEntry: http://google.com | 78 // -> NavigateToPendingEntry: http://google.com |
78 // -> DidStartProvisionalLoadForFrame http://google.com | |
79 // -> ProvisionalChangeToMainFrameUrl http://google.com | 79 // -> ProvisionalChangeToMainFrameUrl http://google.com |
80 // 2. Interstitial is shown to the user. User clicks "Preview". | 80 // 2. Interstitial is shown to the user. User clicks "Preview". |
81 // -> ProvisionalChangeToMainFrameUrl http://www.google.com (redirect) | 81 // -> ProvisionalChangeToMainFrameUrl http://www.google.com (redirect) |
82 // -> DidCommitProvisionalLoadForFrame http://www.google.com (redirect) | 82 // -> DidCommitProvisionalLoadForFrame http://www.google.com (redirect) |
83 // -> DidNavigateMainFrame http://www.google.com | 83 // -> DidNavigateMainFrame http://www.google.com |
84 // 3. Page is shown. | 84 // 3. Page is shown. |
85 virtual void NavigateToPendingEntry( | 85 virtual void NavigateToPendingEntry( |
86 const GURL& url, | 86 const GURL& url, |
87 content::NavigationController::ReloadType reload_type) OVERRIDE; | 87 content::NavigationController::ReloadType reload_type) OVERRIDE; |
88 virtual void DidNavigateMainFrame( | 88 virtual void DidNavigateMainFrame( |
89 const content::LoadCommittedDetails& details, | 89 const content::LoadCommittedDetails& details, |
90 const content::FrameNavigateParams& params) OVERRIDE; | 90 const content::FrameNavigateParams& params) OVERRIDE; |
91 virtual void DidStartProvisionalLoadForFrame( | |
Pam (message me for reviews)
2013/01/14 14:12:42
OK, but not really related to this change?
Bernhard Bauer
2013/01/15 14:24:44
Hm, fair enough. Removed.
| |
92 int64 frame_id, | |
93 int64 parent_frame_id, | |
94 bool is_main_frame, | |
95 const GURL& validated_url, | |
96 bool is_error_page, | |
97 bool is_iframe_srcdoc, | |
98 content::RenderViewHost* render_view_host) OVERRIDE; | |
99 virtual void ProvisionalChangeToMainFrameUrl( | 91 virtual void ProvisionalChangeToMainFrameUrl( |
100 const GURL& url, | 92 const GURL& url, |
101 content::RenderViewHost* render_view_host) OVERRIDE; | 93 content::RenderViewHost* render_view_host) OVERRIDE; |
102 virtual void DidCommitProvisionalLoadForFrame( | 94 virtual void DidCommitProvisionalLoadForFrame( |
103 int64 frame_id, | 95 int64 frame_id, |
104 bool is_main_frame, | 96 bool is_main_frame, |
105 const GURL& url, | 97 const GURL& url, |
106 content::PageTransition transition_type, | 98 content::PageTransition transition_type, |
107 content::RenderViewHost* render_view_host) OVERRIDE; | 99 content::RenderViewHost* render_view_host) OVERRIDE; |
108 | 100 |
109 // Owned by ManagedMode (which is a singleton and outlives us). | 101 // Owned by the profile, so outlives us. |
102 ManagedUserService* managed_user_service_; | |
103 | |
104 // Owned by ManagedUserService. | |
110 const ManagedModeURLFilter* url_filter_; | 105 const ManagedModeURLFilter* url_filter_; |
111 | 106 |
112 // Owned by the InfoBarService, which has the same lifetime as this object. | 107 // Owned by the InfoBarService, which has the same lifetime as this object. |
113 InfoBarDelegate* warn_infobar_delegate_; | 108 InfoBarDelegate* warn_infobar_delegate_; |
114 InfoBarDelegate* preview_infobar_delegate_; | 109 InfoBarDelegate* preview_infobar_delegate_; |
115 | 110 |
116 ObserverState state_; | 111 ObserverState state_; |
117 std::set<GURL> navigated_urls_; | 112 std::set<GURL> navigated_urls_; |
118 GURL last_url_; | 113 GURL last_url_; |
119 | 114 |
120 int last_allowed_page_; | 115 int last_allowed_page_; |
121 | 116 |
122 DISALLOW_COPY_AND_ASSIGN(ManagedModeNavigationObserver); | 117 DISALLOW_COPY_AND_ASSIGN(ManagedModeNavigationObserver); |
123 }; | 118 }; |
124 | 119 |
125 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_NAVIGATION_OBSERVER_H_ | 120 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_NAVIGATION_OBSERVER_H_ |
OLD | NEW |