Chromium Code Reviews| 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_SEARCH_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_ |
| 6 #define CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | |
|
sfiera
2016/12/08 13:12:37
wut
Marc Treib
2016/12/08 13:15:28
I have no idea why this was here. :)
| |
| 11 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| 12 #include "base/macros.h" | 11 #include "base/macros.h" |
| 13 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 14 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 15 #include "chrome/browser/search/instant_service_observer.h" | 14 #include "chrome/browser/search/instant_service_observer.h" |
| 16 #include "chrome/browser/ui/search/search_ipc_router.h" | 15 #include "chrome/browser/ui/search/search_ipc_router.h" |
| 17 #include "chrome/browser/ui/search/search_model.h" | 16 #include "chrome/browser/ui/search/search_model.h" |
| 18 #include "chrome/common/search/instant_types.h" | 17 #include "chrome/common/search/instant_types.h" |
| 19 #include "chrome/common/search/ntp_logging_events.h" | 18 #include "chrome/common/search/ntp_logging_events.h" |
| 20 #include "components/ntp_tiles/ntp_tile_source.h" | 19 #include "components/ntp_tiles/ntp_tile_source.h" |
| 21 #include "components/omnibox/common/omnibox_focus_state.h" | 20 #include "components/omnibox/common/omnibox_focus_state.h" |
| 22 #include "content/public/browser/reload_type.h" | 21 #include "content/public/browser/reload_type.h" |
| 23 #include "content/public/browser/web_contents_observer.h" | 22 #include "content/public/browser/web_contents_observer.h" |
| 24 #include "content/public/browser/web_contents_user_data.h" | 23 #include "content/public/browser/web_contents_user_data.h" |
| 25 #include "ui/base/window_open_disposition.h" | |
| 26 | 24 |
| 27 namespace content { | 25 namespace content { |
| 28 class WebContents; | 26 class WebContents; |
| 29 struct LoadCommittedDetails; | 27 struct LoadCommittedDetails; |
| 30 } | 28 } |
| 31 | 29 |
| 32 class GURL; | 30 class GURL; |
| 33 class InstantService; | 31 class InstantService; |
| 34 class InstantTabTest; | 32 class InstantTabTest; |
| 35 class OmniboxView; | 33 class OmniboxView; |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 63 // |reason|. | 61 // |reason|. |
| 64 void OmniboxFocusChanged(OmniboxFocusState state, | 62 void OmniboxFocusChanged(OmniboxFocusState state, |
| 65 OmniboxFocusChangeReason reason); | 63 OmniboxFocusChangeReason reason); |
| 66 | 64 |
| 67 // Invoked when the active navigation entry is updated in some way that might | 65 // Invoked when the active navigation entry is updated in some way that might |
| 68 // affect the search mode. This is used by Instant when it "fixes up" the | 66 // affect the search mode. This is used by Instant when it "fixes up" the |
| 69 // virtual URL of the active entry. Regular navigations are captured through | 67 // virtual URL of the active entry. Regular navigations are captured through |
| 70 // the notification system and shouldn't call this method. | 68 // the notification system and shouldn't call this method. |
| 71 void NavigationEntryUpdated(); | 69 void NavigationEntryUpdated(); |
| 72 | 70 |
| 73 // Returns true if the page supports instant. If the instant support state is | |
| 74 // not determined or if the page does not support instant returns false. | |
| 75 bool SupportsInstant() const; | |
| 76 | |
| 77 // Sends the current SearchProvider suggestion to the Instant page if any. | 71 // Sends the current SearchProvider suggestion to the Instant page if any. |
| 78 void SetSuggestionToPrefetch(const InstantSuggestion& suggestion); | 72 void SetSuggestionToPrefetch(const InstantSuggestion& suggestion); |
| 79 | 73 |
| 80 // Tells the page that the user pressed Enter in the omnibox. | 74 // Tells the page that the user pressed Enter in the omnibox. |
| 81 void Submit(const base::string16& text, | 75 void Submit(const base::string16& text, |
| 82 const EmbeddedSearchRequestParams& params); | 76 const EmbeddedSearchRequestParams& params); |
| 83 | 77 |
| 84 // Called when the tab corresponding to |this| instance is activated. | 78 // Called when the tab corresponding to |this| instance is activated. |
| 85 void OnTabActivated(); | 79 void OnTabActivated(); |
| 86 | 80 |
| 87 // Called when the tab corresponding to |this| instance is deactivated. | 81 // Called when the tab corresponding to |this| instance is deactivated. |
| 88 void OnTabDeactivated(); | 82 void OnTabDeactivated(); |
| 89 | 83 |
| 90 void set_delegate(SearchTabHelperDelegate* delegate) { delegate_ = delegate; } | 84 void set_delegate(SearchTabHelperDelegate* delegate) { delegate_ = delegate; } |
| 91 | 85 |
| 92 private: | 86 private: |
| 93 friend class content::WebContentsUserData<SearchTabHelper>; | 87 friend class content::WebContentsUserData<SearchTabHelper>; |
| 94 friend class InstantTabTest; | |
| 95 friend class SearchIPCRouterPolicyTest; | 88 friend class SearchIPCRouterPolicyTest; |
| 96 friend class SearchIPCRouterTest; | 89 friend class SearchIPCRouterTest; |
| 97 friend class SearchTabHelperPrerenderTest; | |
| 98 | 90 |
| 99 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, | 91 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, |
| 100 DetermineIfPageSupportsInstant_Local); | 92 DetermineIfPageSupportsInstant_Local); |
| 101 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, | 93 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, |
| 102 DetermineIfPageSupportsInstant_NonLocal); | 94 DetermineIfPageSupportsInstant_NonLocal); |
| 103 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, | 95 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, |
| 104 PageURLDoesntBelongToInstantRenderer); | 96 PageURLDoesntBelongToInstantRenderer); |
| 105 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, | 97 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, |
| 106 OnChromeIdentityCheckMatch); | 98 OnChromeIdentityCheckMatch); |
| 107 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, | 99 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 | 192 |
| 201 // Delegate for notifying our owner about the SearchTabHelper state. Not owned | 193 // Delegate for notifying our owner about the SearchTabHelper state. Not owned |
| 202 // by us. | 194 // by us. |
| 203 // NULL on iOS and Android because they don't use the Instant framework. | 195 // NULL on iOS and Android because they don't use the Instant framework. |
| 204 SearchTabHelperDelegate* delegate_; | 196 SearchTabHelperDelegate* delegate_; |
| 205 | 197 |
| 206 DISALLOW_COPY_AND_ASSIGN(SearchTabHelper); | 198 DISALLOW_COPY_AND_ASSIGN(SearchTabHelper); |
| 207 }; | 199 }; |
| 208 | 200 |
| 209 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_ | 201 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_ |
| OLD | NEW |