| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_ALTERNATE_NAV_URL_FETCHER_H_ | 5 #ifndef CHROME_BROWSER_ALTERNATE_NAV_URL_FETCHER_H_ |
| 6 #define CHROME_BROWSER_ALTERNATE_NAV_URL_FETCHER_H_ | 6 #define CHROME_BROWSER_ALTERNATE_NAV_URL_FETCHER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 State state() const { return state_; } | 52 State state() const { return state_; } |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 // content::NotificationObserver | 55 // content::NotificationObserver |
| 56 virtual void Observe(int type, | 56 virtual void Observe(int type, |
| 57 const content::NotificationSource& source, | 57 const content::NotificationSource& source, |
| 58 const content::NotificationDetails& details) OVERRIDE; | 58 const content::NotificationDetails& details) OVERRIDE; |
| 59 | 59 |
| 60 // content::URLFetcherDelegate | 60 // content::URLFetcherDelegate |
| 61 virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; | 61 virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE; |
| 62 | 62 |
| 63 // Sets |controller_| to the supplied pointer and begins fetching | 63 // Sets |controller_| to the supplied pointer and begins fetching |
| 64 // |alternate_nav_url_|. | 64 // |alternate_nav_url_|. |
| 65 void StartFetch(NavigationController* controller); | 65 void StartFetch(NavigationController* controller); |
| 66 | 66 |
| 67 // Sets |state_| to either SUCCEEDED or FAILED depending on the result of the | 67 // Sets |state_| to either SUCCEEDED or FAILED depending on the result of the |
| 68 // fetch. | 68 // fetch. |
| 69 void SetStatusFromURLFetch(const GURL& url, | 69 void SetStatusFromURLFetch(const GURL& url, |
| 70 const net::URLRequestStatus& status, | 70 const net::URLRequestStatus& status, |
| 71 int response_code); | 71 int response_code); |
| 72 | 72 |
| 73 // Displays the infobar if all conditions are met (the page has loaded and | 73 // Displays the infobar if all conditions are met (the page has loaded and |
| 74 // the fetch of the alternate URL succeeded). Unless we're still waiting on | 74 // the fetch of the alternate URL succeeded). Unless we're still waiting on |
| 75 // one of the above conditions to finish, this will also delete us, as whether | 75 // one of the above conditions to finish, this will also delete us, as whether |
| 76 // or not we show an infobar, there is no reason to live further. | 76 // or not we show an infobar, there is no reason to live further. |
| 77 void ShowInfobarIfPossible(); | 77 void ShowInfobarIfPossible(); |
| 78 | 78 |
| 79 GURL alternate_nav_url_; | 79 GURL alternate_nav_url_; |
| 80 scoped_ptr<URLFetcher> fetcher_; | 80 scoped_ptr<content::URLFetcher> fetcher_; |
| 81 NavigationController* controller_; | 81 NavigationController* controller_; |
| 82 State state_; | 82 State state_; |
| 83 bool navigated_to_entry_; | 83 bool navigated_to_entry_; |
| 84 | 84 |
| 85 content::NotificationRegistrar registrar_; | 85 content::NotificationRegistrar registrar_; |
| 86 | 86 |
| 87 DISALLOW_COPY_AND_ASSIGN(AlternateNavURLFetcher); | 87 DISALLOW_COPY_AND_ASSIGN(AlternateNavURLFetcher); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 #endif // CHROME_BROWSER_ALTERNATE_NAV_URL_FETCHER_H_ | 90 #endif // CHROME_BROWSER_ALTERNATE_NAV_URL_FETCHER_H_ |
| OLD | NEW |