OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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_UI_SEARCH_INSTANT_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 virtual InstantTab* instant_tab() const; | 109 virtual InstantTab* instant_tab() const; |
110 | 110 |
111 virtual Profile* profile() const; | 111 virtual Profile* profile() const; |
112 | 112 |
113 private: | 113 private: |
114 friend class InstantExtendedManualTest; | 114 friend class InstantExtendedManualTest; |
115 friend class InstantTestBase; | 115 friend class InstantTestBase; |
116 | 116 |
117 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ExtendedModeIsOn); | 117 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ExtendedModeIsOn); |
118 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, MostVisited); | 118 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, MostVisited); |
| 119 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, NTPIsPreloaded); |
| 120 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPIsUsedInNewTab); |
| 121 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPIsUsedInSameTab); |
| 122 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPForWrongProvider); |
| 123 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPRenderProcessGone); |
| 124 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, |
| 125 PreloadedNTPDoesntSupportInstant); |
119 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ProcessIsolation); | 126 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ProcessIsolation); |
120 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, UnrelatedSiteInstance); | 127 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, UnrelatedSiteInstance); |
121 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OnDefaultSearchProviderChanged); | 128 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OnDefaultSearchProviderChanged); |
| 129 FRIEND_TEST_ALL_PREFIXES(InstantExtendedNetworkTest, |
| 130 NTPReactsToNetworkChanges); |
122 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, | 131 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, |
123 AcceptingURLSearchDoesNotNavigate); | 132 AcceptingURLSearchDoesNotNavigate); |
124 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, AcceptingJSSearchDoesNotRunJS); | 133 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, AcceptingJSSearchDoesNotRunJS); |
125 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, | 134 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, |
126 ReloadSearchAfterBackReloadsCorrectQuery); | 135 ReloadSearchAfterBackReloadsCorrectQuery); |
127 FRIEND_TEST_ALL_PREFIXES(InstantExtendedFirstTabTest, | 136 FRIEND_TEST_ALL_PREFIXES(InstantExtendedFirstTabTest, |
128 RedirectToLocalOnLoadFailure); | 137 RedirectToLocalOnLoadFailure); |
129 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, KeyboardTogglesVoiceSearch); | 138 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, KeyboardTogglesVoiceSearch); |
130 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, HomeButtonAffectsMargin); | 139 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, HomeButtonAffectsMargin); |
131 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, SearchReusesInstantTab); | 140 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, SearchReusesInstantTab); |
132 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, | 141 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, |
133 SearchDoesntReuseInstantTabWithoutSupport); | 142 SearchDoesntReuseInstantTabWithoutSupport); |
134 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, | 143 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, |
135 TypedSearchURLDoesntReuseInstantTab); | 144 TypedSearchURLDoesntReuseInstantTab); |
136 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, | 145 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, |
137 DispatchMVChangeEventWhileNavigatingBackToNTP); | 146 DispatchMVChangeEventWhileNavigatingBackToNTP); |
138 | 147 |
139 // Overridden from InstantPage::Delegate: | 148 // Overridden from InstantPage::Delegate: |
140 // TODO(shishir): We assume that the WebContent's current RenderViewHost is | 149 // TODO(shishir): We assume that the WebContent's current RenderViewHost is |
141 // the RenderViewHost being created which is not always true. Fix this. | 150 // the RenderViewHost being created which is not always true. Fix this. |
142 virtual void InstantSupportDetermined( | 151 virtual void InstantSupportDetermined( |
143 const content::WebContents* contents, | 152 const content::WebContents* contents, |
144 bool supports_instant) OVERRIDE; | 153 bool supports_instant) OVERRIDE; |
145 virtual void InstantPageAboutToNavigateMainFrame( | 154 virtual void InstantPageAboutToNavigateMainFrame( |
146 const content::WebContents* contents, | 155 const content::WebContents* contents, |
147 const GURL& url) OVERRIDE; | 156 const GURL& url) OVERRIDE; |
| 157 virtual void InstantPageLoadFailed(content::WebContents* contents) OVERRIDE; |
148 | 158 |
149 // Helper function to navigate the given contents to the local fallback | 159 // Helper function to navigate the given contents to the local fallback |
150 // Instant URL and trim the history correctly. | 160 // Instant URL and trim the history correctly. |
151 void RedirectToLocalNTP(content::WebContents* contents); | 161 void RedirectToLocalNTP(content::WebContents* contents); |
152 | 162 |
153 // Helper for OmniboxFocusChanged. Commit or discard the overlay. | 163 // Helper for OmniboxFocusChanged. Commit or discard the overlay. |
154 void OmniboxLostFocus(gfx::NativeView view_gaining_focus); | 164 void OmniboxLostFocus(gfx::NativeView view_gaining_focus); |
155 | 165 |
156 // If the active tab is an Instant search results page, sets |instant_tab_| to | 166 // If the active tab is an Instant search results page, sets |instant_tab_| to |
157 // point to it. Else, deletes any existing |instant_tab_|. | 167 // point to it. Else, deletes any existing |instant_tab_|. |
(...skipping 27 matching lines...) Expand all Loading... |
185 // its suggestions with the omnibox. | 195 // its suggestions with the omnibox. |
186 gfx::Rect omnibox_bounds_; | 196 gfx::Rect omnibox_bounds_; |
187 | 197 |
188 // List of events and their timestamps, useful in debugging Instant behaviour. | 198 // List of events and their timestamps, useful in debugging Instant behaviour. |
189 mutable std::list<std::pair<int64, std::string> > debug_events_; | 199 mutable std::list<std::pair<int64, std::string> > debug_events_; |
190 | 200 |
191 DISALLOW_COPY_AND_ASSIGN(InstantController); | 201 DISALLOW_COPY_AND_ASSIGN(InstantController); |
192 }; | 202 }; |
193 | 203 |
194 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ | 204 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ |
OLD | NEW |