OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/browser/net/url_fetcher.h" | 10 #include "chrome/browser/net/url_fetcher.h" |
11 #include "chrome/browser/tab_contents/infobar_delegate.h" | 11 #include "chrome/browser/tab_contents/infobar_delegate.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 const std::string& data); | 55 const std::string& data); |
56 | 56 |
57 // LinkInfoBarDelegate | 57 // LinkInfoBarDelegate |
58 virtual std::wstring GetMessageTextWithOffset(size_t* link_offset) const; | 58 virtual std::wstring GetMessageTextWithOffset(size_t* link_offset) const; |
59 virtual std::wstring GetLinkText() const; | 59 virtual std::wstring GetLinkText() const; |
60 virtual SkBitmap* GetIcon() const; | 60 virtual SkBitmap* GetIcon() const; |
61 virtual bool LinkClicked(WindowOpenDisposition disposition); | 61 virtual bool LinkClicked(WindowOpenDisposition disposition); |
62 virtual void InfoBarClosed(); | 62 virtual void InfoBarClosed(); |
63 | 63 |
64 private: | 64 private: |
| 65 // Sets |state_| to either SUCCEEDED or FAILED depending on the result of the |
| 66 // fetch. |
| 67 void SetStatusFromURLFetch(const GURL& url, |
| 68 const URLRequestStatus& status, |
| 69 int response_code); |
| 70 |
65 // Displays the infobar if all conditions are met (the page has loaded and | 71 // Displays the infobar if all conditions are met (the page has loaded and |
66 // the fetch of the alternate URL succeeded). | 72 // the fetch of the alternate URL succeeded). |
67 void ShowInfobarIfPossible(); | 73 void ShowInfobarIfPossible(); |
68 | 74 |
69 GURL alternate_nav_url_; | 75 GURL alternate_nav_url_; |
70 scoped_ptr<URLFetcher> fetcher_; | 76 scoped_ptr<URLFetcher> fetcher_; |
71 NavigationController* controller_; | 77 NavigationController* controller_; |
72 State state_; | 78 State state_; |
73 bool navigated_to_entry_; | 79 bool navigated_to_entry_; |
74 | 80 |
75 // The TabContents the InfoBarDelegate was added to. | 81 // The TabContents the InfoBarDelegate was added to. |
76 TabContents* infobar_contents_; | 82 TabContents* infobar_contents_; |
77 | 83 |
78 NotificationRegistrar registrar_; | 84 NotificationRegistrar registrar_; |
79 | 85 |
80 DISALLOW_COPY_AND_ASSIGN(AlternateNavURLFetcher); | 86 DISALLOW_COPY_AND_ASSIGN(AlternateNavURLFetcher); |
81 }; | 87 }; |
82 | 88 |
83 #endif // CHROME_BROWSER_ALTERNATE_NAV_URL_FETCHER_H_ | 89 #endif // CHROME_BROWSER_ALTERNATE_NAV_URL_FETCHER_H_ |
OLD | NEW |