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_INSTANT_INSTANT_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ |
6 #define CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ | 6 #define CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 #include <utility> | 11 #include <utility> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/string16.h" | 17 #include "base/string16.h" |
18 #include "base/time.h" | 18 #include "base/time.h" |
19 #include "base/timer.h" | 19 #include "base/timer.h" |
20 #include "chrome/browser/instant/instant_commit_type.h" | 20 #include "chrome/browser/instant/instant_commit_type.h" |
21 #include "chrome/browser/instant/instant_model.h" | 21 #include "chrome/browser/instant/instant_model.h" |
22 #include "chrome/browser/instant/instant_page.h" | 22 #include "chrome/browser/instant/instant_page.h" |
23 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" | 23 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" |
24 #include "chrome/common/instant_types.h" | 24 #include "chrome/common/instant_types.h" |
25 #include "chrome/common/search_types.h" | 25 #include "chrome/common/search_types.h" |
26 #include "content/public/common/page_transition_types.h" | 26 #include "content/public/common/page_transition_types.h" |
27 #include "googleurl/src/gurl.h" | 27 #include "googleurl/src/gurl.h" |
28 #include "ui/base/window_open_disposition.h" | |
28 #include "ui/gfx/native_widget_types.h" | 29 #include "ui/gfx/native_widget_types.h" |
29 #include "ui/gfx/rect.h" | 30 #include "ui/gfx/rect.h" |
30 | 31 |
31 struct AutocompleteMatch; | 32 struct AutocompleteMatch; |
32 class AutocompleteProvider; | 33 class AutocompleteProvider; |
33 class InstantNTP; | 34 class InstantNTP; |
34 class InstantOverlay; | 35 class InstantOverlay; |
35 class InstantTab; | 36 class InstantTab; |
36 class TemplateURL; | 37 class TemplateURL; |
37 | 38 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 // happen through the InstantController interface. | 183 // happen through the InstantController interface. |
183 InstantModel* model() { return &model_; } | 184 InstantModel* model() { return &model_; } |
184 | 185 |
185 private: | 186 private: |
186 FRIEND_TEST_ALL_PREFIXES(InstantTest, OmniboxFocusLoadsInstant); | 187 FRIEND_TEST_ALL_PREFIXES(InstantTest, OmniboxFocusLoadsInstant); |
187 FRIEND_TEST_ALL_PREFIXES(InstantTest, SetWithTemplateURL); | 188 FRIEND_TEST_ALL_PREFIXES(InstantTest, SetWithTemplateURL); |
188 FRIEND_TEST_ALL_PREFIXES(InstantTest, NonInstantSearchProvider); | 189 FRIEND_TEST_ALL_PREFIXES(InstantTest, NonInstantSearchProvider); |
189 FRIEND_TEST_ALL_PREFIXES(InstantTest, InstantOverlayRefresh); | 190 FRIEND_TEST_ALL_PREFIXES(InstantTest, InstantOverlayRefresh); |
190 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ExtendedModeIsOn); | 191 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ExtendedModeIsOn); |
191 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OmniboxFocusLoadsInstant); | 192 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OmniboxFocusLoadsInstant); |
193 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, MiddleClickOnSuggestionOpensInNe wTab); | |
sreeram
2013/02/20 22:53:32
80-column limit.
dougw
2013/02/20 23:35:11
Done.
| |
192 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, NTPIsPreloaded); | 194 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, NTPIsPreloaded); |
193 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPIsUsedInNewTab); | 195 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPIsUsedInNewTab); |
194 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPIsUsedInSameTab); | 196 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPIsUsedInSameTab); |
195 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ProcessIsolation); | 197 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ProcessIsolation); |
196 | 198 |
197 // Overridden from InstantPage::Delegate: | 199 // Overridden from InstantPage::Delegate: |
198 // TODO(shishir): We assume that the WebContent's current RenderViewHost is | 200 // TODO(shishir): We assume that the WebContent's current RenderViewHost is |
199 // the RenderViewHost being created which is not always true. Fix this. | 201 // the RenderViewHost being created which is not always true. Fix this. |
200 virtual void InstantPageRenderViewCreated( | 202 virtual void InstantPageRenderViewCreated( |
201 const content::WebContents* contents) OVERRIDE; | 203 const content::WebContents* contents) OVERRIDE; |
(...skipping 12 matching lines...) Expand all Loading... | |
214 const content::WebContents* contents, | 216 const content::WebContents* contents, |
215 InstantShownReason reason, | 217 InstantShownReason reason, |
216 int height, | 218 int height, |
217 InstantSizeUnits units) OVERRIDE; | 219 InstantSizeUnits units) OVERRIDE; |
218 virtual void StartCapturingKeyStrokes( | 220 virtual void StartCapturingKeyStrokes( |
219 const content::WebContents* contents) OVERRIDE; | 221 const content::WebContents* contents) OVERRIDE; |
220 virtual void StopCapturingKeyStrokes(content::WebContents* contents) OVERRIDE; | 222 virtual void StopCapturingKeyStrokes(content::WebContents* contents) OVERRIDE; |
221 virtual void NavigateToURL( | 223 virtual void NavigateToURL( |
222 const content::WebContents* contents, | 224 const content::WebContents* contents, |
223 const GURL& url, | 225 const GURL& url, |
224 content::PageTransition transition) OVERRIDE; | 226 content::PageTransition transition, |
227 WindowOpenDisposition disposition) OVERRIDE; | |
225 | 228 |
226 // Helper for OmniboxFocusChanged. Commit or discard the preview. | 229 // Helper for OmniboxFocusChanged. Commit or discard the preview. |
227 void OmniboxLostFocus(gfx::NativeView view_gaining_focus); | 230 void OmniboxLostFocus(gfx::NativeView view_gaining_focus); |
228 | 231 |
229 // Creates a new NTP, using the instant_url property of the default | 232 // Creates a new NTP, using the instant_url property of the default |
230 // TemplateURL. | 233 // TemplateURL. |
231 void ResetNTP(); | 234 void ResetNTP(); |
232 | 235 |
233 // Ensures that |overlay_| uses the Instant URL returned by GetInstantURL(), | 236 // Ensures that |overlay_| uses the Instant URL returned by GetInstantURL(), |
234 // creating a new overlay if necessary. In extended mode, will fallback to | 237 // creating a new overlay if necessary. In extended mode, will fallback to |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
389 // MODE_SEARCH_SUGGESTIONS, except in those cases where this is false. | 392 // MODE_SEARCH_SUGGESTIONS, except in those cases where this is false. |
390 bool allow_preview_to_show_search_suggestions_; | 393 bool allow_preview_to_show_search_suggestions_; |
391 | 394 |
392 // List of events and their timestamps, useful in debugging Instant behaviour. | 395 // List of events and their timestamps, useful in debugging Instant behaviour. |
393 mutable std::list<std::pair<int64, std::string> > debug_events_; | 396 mutable std::list<std::pair<int64, std::string> > debug_events_; |
394 | 397 |
395 DISALLOW_COPY_AND_ASSIGN(InstantController); | 398 DISALLOW_COPY_AND_ASSIGN(InstantController); |
396 }; | 399 }; |
397 | 400 |
398 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ | 401 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ |
OLD | NEW |