| 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, |
| 194 MiddleClickOnSuggestionOpensInNewTab); |
| 192 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, NTPIsPreloaded); | 195 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, NTPIsPreloaded); |
| 193 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPIsUsedInNewTab); | 196 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPIsUsedInNewTab); |
| 194 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPIsUsedInSameTab); | 197 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPIsUsedInSameTab); |
| 195 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ProcessIsolation); | 198 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ProcessIsolation); |
| 196 | 199 |
| 197 // Overridden from InstantPage::Delegate: | 200 // Overridden from InstantPage::Delegate: |
| 198 // TODO(shishir): We assume that the WebContent's current RenderViewHost is | 201 // TODO(shishir): We assume that the WebContent's current RenderViewHost is |
| 199 // the RenderViewHost being created which is not always true. Fix this. | 202 // the RenderViewHost being created which is not always true. Fix this. |
| 200 virtual void InstantPageRenderViewCreated( | 203 virtual void InstantPageRenderViewCreated( |
| 201 const content::WebContents* contents) OVERRIDE; | 204 const content::WebContents* contents) OVERRIDE; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 214 const content::WebContents* contents, | 217 const content::WebContents* contents, |
| 215 InstantShownReason reason, | 218 InstantShownReason reason, |
| 216 int height, | 219 int height, |
| 217 InstantSizeUnits units) OVERRIDE; | 220 InstantSizeUnits units) OVERRIDE; |
| 218 virtual void StartCapturingKeyStrokes( | 221 virtual void StartCapturingKeyStrokes( |
| 219 const content::WebContents* contents) OVERRIDE; | 222 const content::WebContents* contents) OVERRIDE; |
| 220 virtual void StopCapturingKeyStrokes(content::WebContents* contents) OVERRIDE; | 223 virtual void StopCapturingKeyStrokes(content::WebContents* contents) OVERRIDE; |
| 221 virtual void NavigateToURL( | 224 virtual void NavigateToURL( |
| 222 const content::WebContents* contents, | 225 const content::WebContents* contents, |
| 223 const GURL& url, | 226 const GURL& url, |
| 224 content::PageTransition transition) OVERRIDE; | 227 content::PageTransition transition, |
| 228 WindowOpenDisposition disposition) OVERRIDE; |
| 225 | 229 |
| 226 // Helper for OmniboxFocusChanged. Commit or discard the preview. | 230 // Helper for OmniboxFocusChanged. Commit or discard the preview. |
| 227 void OmniboxLostFocus(gfx::NativeView view_gaining_focus); | 231 void OmniboxLostFocus(gfx::NativeView view_gaining_focus); |
| 228 | 232 |
| 229 // Creates a new NTP, using the instant_url property of the default | 233 // Creates a new NTP, using the instant_url property of the default |
| 230 // TemplateURL. | 234 // TemplateURL. |
| 231 void ResetNTP(); | 235 void ResetNTP(); |
| 232 | 236 |
| 233 // Ensures that |overlay_| uses the Instant URL returned by GetInstantURL(), | 237 // Ensures that |overlay_| uses the Instant URL returned by GetInstantURL(), |
| 234 // creating a new overlay if necessary. In extended mode, will fallback to | 238 // 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. | 393 // MODE_SEARCH_SUGGESTIONS, except in those cases where this is false. |
| 390 bool allow_preview_to_show_search_suggestions_; | 394 bool allow_preview_to_show_search_suggestions_; |
| 391 | 395 |
| 392 // List of events and their timestamps, useful in debugging Instant behaviour. | 396 // List of events and their timestamps, useful in debugging Instant behaviour. |
| 393 mutable std::list<std::pair<int64, std::string> > debug_events_; | 397 mutable std::list<std::pair<int64, std::string> > debug_events_; |
| 394 | 398 |
| 395 DISALLOW_COPY_AND_ASSIGN(InstantController); | 399 DISALLOW_COPY_AND_ASSIGN(InstantController); |
| 396 }; | 400 }; |
| 397 | 401 |
| 398 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ | 402 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ |
| OLD | NEW |