Chromium Code Reviews| 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_NAVIGATION_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_NAVIGATION_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_MANAGED_MODE_NAVIGATION_OBSERVER_H_ | 6 #define CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_NAVIGATION_OBSERVER_H_ |
| 7 | 7 |
| 8 #include "content/public/browser/web_contents_observer.h" | 8 #include "content/public/browser/web_contents_observer.h" |
| 9 #include "content/public/browser/web_contents_user_data.h" | 9 #include "content/public/browser/web_contents_user_data.h" |
| 10 | 10 |
| 11 class InfoBarDelegate; | 11 class InfoBarDelegate; |
| 12 class ManagedModeURLFilter; | 12 class ManagedModeURLFilter; |
| 13 | 13 |
| 14 class ManagedModeNavigationObserver | 14 class ManagedModeNavigationObserver |
| 15 : public content::WebContentsObserver, | 15 : public content::WebContentsObserver, |
| 16 public content::WebContentsUserData<ManagedModeNavigationObserver> { | 16 public content::WebContentsUserData<ManagedModeNavigationObserver> { |
| 17 public: | 17 public: |
| 18 virtual ~ManagedModeNavigationObserver(); | 18 virtual ~ManagedModeNavigationObserver(); |
| 19 | 19 |
| 20 void InfobarDismissed(); | 20 void WarnInfobarDismissed(); |
| 21 void PreviewInfobarDismissed(); | |
| 22 | |
| 23 // Adds the url to the list of navigated URLs if it was not already there. | |
| 24 void AddNavigatedURL(const GURL& url); | |
| 25 | |
| 26 // For the list of URLs that were navigated since the last Observer | |
| 27 // instantiation: | |
| 28 // * add the first N-1 to the whitelist such that only those URLs are | |
| 29 // allowed and not more general versions of them. | |
|
Bernhard Bauer
2012/11/16 15:04:46
I think this can be put a bit more succinctly by s
Sergiu
2012/11/26 14:48:08
Done.
| |
| 30 // * add only the host part of the last URL so that it allows all | |
| 31 // pages on that domain. If it's HTTPS do the same but only on the HTTPS | |
| 32 // protocol. | |
| 33 void AddURLList(); | |
|
Bernhard Bauer
2012/11/16 15:04:46
Add NavigatedURL and AddURLList are very similarly
Sergiu
2012/11/26 14:48:08
Done.
| |
| 21 | 34 |
| 22 private: | 35 private: |
| 23 friend class WebContentsUserData<ManagedModeNavigationObserver>; | 36 friend class WebContentsUserData<ManagedModeNavigationObserver>; |
| 24 | 37 |
| 25 explicit ManagedModeNavigationObserver(content::WebContents* web_contents); | 38 explicit ManagedModeNavigationObserver(content::WebContents* web_contents); |
| 26 | 39 |
| 27 // content::WebContentsObserver implementation. | 40 // content::WebContentsObserver implementation. |
| 28 virtual void NavigateToPendingEntry( | 41 virtual void NavigateToPendingEntry( |
| 29 const GURL& url, | 42 const GURL& url, |
| 30 content::NavigationController::ReloadType reload_type) OVERRIDE; | 43 content::NavigationController::ReloadType reload_type) OVERRIDE; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 45 virtual void DidCommitProvisionalLoadForFrame( | 58 virtual void DidCommitProvisionalLoadForFrame( |
| 46 int64 frame_id, | 59 int64 frame_id, |
| 47 bool is_main_frame, | 60 bool is_main_frame, |
| 48 const GURL& url, | 61 const GURL& url, |
| 49 content::PageTransition transition_type, | 62 content::PageTransition transition_type, |
| 50 content::RenderViewHost* render_view_host) OVERRIDE; | 63 content::RenderViewHost* render_view_host) OVERRIDE; |
| 51 | 64 |
| 52 // Owned by ManagedMode (which is a singleton and outlives us). | 65 // Owned by ManagedMode (which is a singleton and outlives us). |
| 53 const ManagedModeURLFilter* url_filter_; | 66 const ManagedModeURLFilter* url_filter_; |
| 54 | 67 |
| 55 InfoBarDelegate* infobar_delegate_; | 68 InfoBarDelegate* warn_infobar_delegate_; |
| 69 InfoBarDelegate* preview_infobar_delegate_; | |
| 70 std::vector<GURL> navigated_urls_; | |
| 71 bool after_interstitial_; | |
| 56 | 72 |
| 57 DISALLOW_COPY_AND_ASSIGN(ManagedModeNavigationObserver); | 73 DISALLOW_COPY_AND_ASSIGN(ManagedModeNavigationObserver); |
| 58 }; | 74 }; |
| 59 | 75 |
| 60 #endif // CHROME_BROWSER_MANAGED_MODE_NAVIGATION_OBSERVER_H_ | 76 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_NAVIGATION_OBSERVER_H_ |
| OLD | NEW |