| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <utility> | 13 #include <utility> |
| 14 | 14 |
| 15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "chrome/browser/ui/search/instant_tab.h" | 17 #include "chrome/browser/ui/search/instant_tab.h" |
| 18 #include "chrome/browser/ui/search/search_model.h" | 18 #include "chrome/browser/ui/search/search_model.h" |
| 19 #include "chrome/common/search/search_types.h" | 19 #include "chrome/common/search/search_types.h" |
| 20 | 20 |
| 21 class BrowserInstantController; | 21 class BrowserInstantController; |
| 22 class GURL; | |
| 23 class InstantService; | 22 class InstantService; |
| 24 | 23 |
| 25 namespace content { | 24 namespace content { |
| 26 class WebContents; | 25 class WebContents; |
| 27 } | 26 } |
| 28 | 27 |
| 29 // InstantController drives Chrome Instant, i.e., the browser implementation of | 28 // InstantController drives Chrome Instant, i.e., the browser implementation of |
| 30 // the Embedded Search API (see http://dev.chromium.org/embeddedsearch). | 29 // the Embedded Search API (see http://dev.chromium.org/embeddedsearch). |
| 31 // | 30 // |
| 32 // In extended mode, InstantController maintains and coordinates an InstantTab. | 31 // InstantController maintains and coordinates an InstantTab. |
| 33 // An InstantTab instance points to the currently active tab, if it supports the | 32 // An InstantTab instance points to the currently active tab, if it supports the |
| 34 // Embedded Search API. InstantTab is backed by a WebContents and it does not | 33 // Embedded Search API. InstantTab is backed by a WebContents and it does not |
| 35 // own that WebContents. | 34 // own that WebContents. |
| 36 // | 35 // |
| 37 // InstantController is owned by Browser via BrowserInstantController. | 36 // InstantController is owned by Browser via BrowserInstantController. |
| 38 class InstantController : public InstantTab::Delegate { | 37 class InstantController : public InstantTab::Delegate { |
| 39 public: | 38 public: |
| 40 explicit InstantController(BrowserInstantController* browser); | 39 explicit InstantController(BrowserInstantController* browser); |
| 41 ~InstantController() override; | 40 ~InstantController() override; |
| 42 | 41 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 54 | 53 |
| 55 // See comments for |debug_events_| below. | 54 // See comments for |debug_events_| below. |
| 56 const std::list<std::pair<int64_t, std::string>>& debug_events() { | 55 const std::list<std::pair<int64_t, std::string>>& debug_events() { |
| 57 return debug_events_; | 56 return debug_events_; |
| 58 } | 57 } |
| 59 | 58 |
| 60 private: | 59 private: |
| 61 friend class InstantExtendedManualTest; | 60 friend class InstantExtendedManualTest; |
| 62 friend class InstantTestBase; | 61 friend class InstantTestBase; |
| 63 | 62 |
| 64 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ExtendedModeIsOn); | |
| 65 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, MostVisited); | |
| 66 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ProcessIsolation); | |
| 67 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, UnrelatedSiteInstance); | |
| 68 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OnDefaultSearchProviderChanged); | |
| 69 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, | |
| 70 AcceptingURLSearchDoesNotNavigate); | |
| 71 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, AcceptingJSSearchDoesNotRunJS); | |
| 72 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, | |
| 73 ReloadSearchAfterBackReloadsCorrectQuery); | |
| 74 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, KeyboardTogglesVoiceSearch); | |
| 75 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, HomeButtonAffectsMargin); | |
| 76 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, SearchReusesInstantTab); | |
| 77 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, | 63 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, |
| 78 SearchDoesntReuseInstantTabWithoutSupport); | 64 SearchDoesntReuseInstantTabWithoutSupport); |
| 79 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, | 65 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, |
| 80 TypedSearchURLDoesntReuseInstantTab); | 66 TypedSearchURLDoesntReuseInstantTab); |
| 81 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, | 67 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, |
| 82 DispatchMVChangeEventWhileNavigatingBackToNTP); | 68 DispatchMVChangeEventWhileNavigatingBackToNTP); |
| 83 | 69 |
| 84 // Overridden from InstantTab::Delegate: | 70 // Overridden from InstantTab::Delegate: |
| 85 // TODO(shishir): We assume that the WebContent's current RenderViewHost is | 71 // TODO(shishir): We assume that the WebContent's current RenderViewHost is |
| 86 // the RenderViewHost being created which is not always true. Fix this. | 72 // the RenderViewHost being created which is not always true. Fix this. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 109 // The search model mode for the active tab. | 95 // The search model mode for the active tab. |
| 110 SearchMode search_mode_; | 96 SearchMode search_mode_; |
| 111 | 97 |
| 112 // List of events and their timestamps, useful in debugging Instant behaviour. | 98 // List of events and their timestamps, useful in debugging Instant behaviour. |
| 113 mutable std::list<std::pair<int64_t, std::string>> debug_events_; | 99 mutable std::list<std::pair<int64_t, std::string>> debug_events_; |
| 114 | 100 |
| 115 DISALLOW_COPY_AND_ASSIGN(InstantController); | 101 DISALLOW_COPY_AND_ASSIGN(InstantController); |
| 116 }; | 102 }; |
| 117 | 103 |
| 118 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ | 104 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ |
| OLD | NEW |