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