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