OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_TAB_HELPER_H_ |
6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_TAB_HELPER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "content/public/browser/web_contents_observer.h" | 10 #include "content/public/browser/web_contents_observer.h" |
11 #include "content/public/browser/web_contents_user_data.h" | 11 #include "content/public/browser/web_contents_user_data.h" |
12 #include "net/base/net_errors.h" | |
jianli
2016/06/04 00:27:20
Why is this needed?
dewittj
2016/06/06 16:53:15
Done.
| |
12 #include "url/gurl.h" | 13 #include "url/gurl.h" |
13 | 14 |
14 namespace content { | 15 namespace content { |
15 class WebContents; | 16 class WebContents; |
16 } | 17 } |
17 | 18 |
18 namespace offline_pages { | 19 namespace offline_pages { |
19 | 20 |
20 // Per-tab class to manage switch between online version and offline version. | 21 // Per-tab class to manage switch between online version and offline version. |
21 class OfflinePageTabHelper : | 22 class OfflinePageTabHelper : |
22 public content::WebContentsObserver, | 23 public content::WebContentsObserver, |
23 public content::WebContentsUserData<OfflinePageTabHelper> { | 24 public content::WebContentsUserData<OfflinePageTabHelper> { |
24 public: | 25 public: |
25 ~OfflinePageTabHelper() override; | 26 ~OfflinePageTabHelper() override; |
26 | 27 |
27 private: | 28 private: |
28 friend class content::WebContentsUserData<OfflinePageTabHelper>; | 29 friend class content::WebContentsUserData<OfflinePageTabHelper>; |
29 friend class OfflinePageTabHelperTest; | 30 friend class OfflinePageTabHelperTest; |
31 FRIEND_TEST_ALL_PREFIXES(OfflinePageTabHelperTest, | |
32 NewNavigationCancelsPendingRedirects); | |
30 | 33 |
31 explicit OfflinePageTabHelper(content::WebContents* web_contents); | 34 explicit OfflinePageTabHelper(content::WebContents* web_contents); |
32 | 35 |
33 // Overridden from content::WebContentsObserver: | 36 // Overridden from content::WebContentsObserver: |
34 void DidStartNavigation( | 37 void DidStartNavigation( |
35 content::NavigationHandle* navigation_handle) override; | 38 content::NavigationHandle* navigation_handle) override; |
36 void DidFinishNavigation( | 39 void DidFinishNavigation( |
37 content::NavigationHandle* navigation_handle) override; | 40 content::NavigationHandle* navigation_handle) override; |
38 | 41 |
42 void GotRedirectURLForSupportedErrorCode(ui::PageTransition transition, | |
43 const GURL& from_url, | |
44 const GURL& redirect_url); | |
45 void GotRedirectURLForStartedNavigation(const GURL& from_url, | |
46 const GURL& redirect_url); | |
47 | |
39 void Redirect(const GURL& from_url, const GURL& to_url); | 48 void Redirect(const GURL& from_url, const GURL& to_url); |
40 | 49 |
41 base::WeakPtrFactory<OfflinePageTabHelper> weak_ptr_factory_; | 50 base::WeakPtrFactory<OfflinePageTabHelper> weak_ptr_factory_; |
42 | 51 |
43 DISALLOW_COPY_AND_ASSIGN(OfflinePageTabHelper); | 52 DISALLOW_COPY_AND_ASSIGN(OfflinePageTabHelper); |
44 }; | 53 }; |
45 | 54 |
46 } // namespace offline_pages | 55 } // namespace offline_pages |
47 | 56 |
48 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_TAB_HELPER_H_ | 57 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_TAB_HELPER_H_ |
OLD | NEW |