| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_IPC_ROUTER_H_ | 5 #ifndef CHROME_BROWSER_UI_SEARCH_SEARCH_IPC_ROUTER_H_ |
| 6 #define CHROME_BROWSER_UI_SEARCH_SEARCH_IPC_ROUTER_H_ | 6 #define CHROME_BROWSER_UI_SEARCH_SEARCH_IPC_ROUTER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // SearchIPCRouter calls these functions before sending/receiving messages | 93 // SearchIPCRouter calls these functions before sending/receiving messages |
| 94 // to/from the page. | 94 // to/from the page. |
| 95 virtual bool ShouldProcessFocusOmnibox(bool is_active_tab) = 0; | 95 virtual bool ShouldProcessFocusOmnibox(bool is_active_tab) = 0; |
| 96 virtual bool ShouldProcessDeleteMostVisitedItem() = 0; | 96 virtual bool ShouldProcessDeleteMostVisitedItem() = 0; |
| 97 virtual bool ShouldProcessUndoMostVisitedDeletion() = 0; | 97 virtual bool ShouldProcessUndoMostVisitedDeletion() = 0; |
| 98 virtual bool ShouldProcessUndoAllMostVisitedDeletions() = 0; | 98 virtual bool ShouldProcessUndoAllMostVisitedDeletions() = 0; |
| 99 virtual bool ShouldProcessLogEvent() = 0; | 99 virtual bool ShouldProcessLogEvent() = 0; |
| 100 virtual bool ShouldProcessPasteIntoOmnibox(bool is_active_tab) = 0; | 100 virtual bool ShouldProcessPasteIntoOmnibox(bool is_active_tab) = 0; |
| 101 virtual bool ShouldProcessChromeIdentityCheck() = 0; | 101 virtual bool ShouldProcessChromeIdentityCheck() = 0; |
| 102 virtual bool ShouldProcessHistorySyncCheck() = 0; | 102 virtual bool ShouldProcessHistorySyncCheck() = 0; |
| 103 virtual bool ShouldSendSetDisplayInstantResults() = 0; | |
| 104 virtual bool ShouldSendSetSuggestionToPrefetch() = 0; | 103 virtual bool ShouldSendSetSuggestionToPrefetch() = 0; |
| 105 virtual bool ShouldSendSetInputInProgress(bool is_active_tab) = 0; | 104 virtual bool ShouldSendSetInputInProgress(bool is_active_tab) = 0; |
| 106 virtual bool ShouldSendOmniboxFocusChanged() = 0; | 105 virtual bool ShouldSendOmniboxFocusChanged() = 0; |
| 107 virtual bool ShouldSendMostVisitedItems() = 0; | 106 virtual bool ShouldSendMostVisitedItems() = 0; |
| 108 virtual bool ShouldSendThemeBackgroundInfo() = 0; | 107 virtual bool ShouldSendThemeBackgroundInfo() = 0; |
| 109 virtual bool ShouldSubmitQuery() = 0; | 108 virtual bool ShouldSubmitQuery() = 0; |
| 110 }; | 109 }; |
| 111 | 110 |
| 112 SearchIPCRouter(content::WebContents* web_contents, | 111 SearchIPCRouter(content::WebContents* web_contents, |
| 113 Delegate* delegate, | 112 Delegate* delegate, |
| 114 std::unique_ptr<Policy> policy); | 113 std::unique_ptr<Policy> policy); |
| 115 ~SearchIPCRouter() override; | 114 ~SearchIPCRouter() override; |
| 116 | 115 |
| 117 // Tells the SearchIPCRouter that a new page in an Instant process committed. | 116 // Tells the SearchIPCRouter that a new page in an Instant process committed. |
| 118 void OnNavigationEntryCommitted(); | 117 void OnNavigationEntryCommitted(); |
| 119 | 118 |
| 120 // Tells the renderer to determine if the page supports the Instant API, which | 119 // Tells the renderer to determine if the page supports the Instant API, which |
| 121 // results in a call to OnInstantSupportDetermined() when the reply is | 120 // results in a call to OnInstantSupportDetermined() when the reply is |
| 122 // received. | 121 // received. |
| 123 void DetermineIfPageSupportsInstant(); | 122 void DetermineIfPageSupportsInstant(); |
| 124 | 123 |
| 125 // Tells the renderer about the result of the Chrome identity check. | 124 // Tells the renderer about the result of the Chrome identity check. |
| 126 void SendChromeIdentityCheckResult(const base::string16& identity, | 125 void SendChromeIdentityCheckResult(const base::string16& identity, |
| 127 bool identity_match); | 126 bool identity_match); |
| 128 | 127 |
| 129 // Tells the renderer whether the user syncs history. | 128 // Tells the renderer whether the user syncs history. |
| 130 void SendHistorySyncCheckResult(bool sync_history); | 129 void SendHistorySyncCheckResult(bool sync_history); |
| 131 | 130 |
| 132 // Tells the renderer whether to display the Instant results. | |
| 133 void SetDisplayInstantResults(); | |
| 134 | |
| 135 // Tells the page the suggestion to be prefetched if any. | 131 // Tells the page the suggestion to be prefetched if any. |
| 136 void SetSuggestionToPrefetch(const InstantSuggestion& suggestion); | 132 void SetSuggestionToPrefetch(const InstantSuggestion& suggestion); |
| 137 | 133 |
| 138 // Tells the page that user input started or stopped. | 134 // Tells the page that user input started or stopped. |
| 139 void SetInputInProgress(bool input_in_progress); | 135 void SetInputInProgress(bool input_in_progress); |
| 140 | 136 |
| 141 // Tells the page that the omnibox focus has changed. | 137 // Tells the page that the omnibox focus has changed. |
| 142 void OmniboxFocusChanged(OmniboxFocusState state, | 138 void OmniboxFocusChanged(OmniboxFocusState state, |
| 143 OmniboxFocusChangeReason reason); | 139 OmniboxFocusChangeReason reason); |
| 144 | 140 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 162 friend class SearchIPCRouterPolicyTest; | 158 friend class SearchIPCRouterPolicyTest; |
| 163 friend class SearchIPCRouterTest; | 159 friend class SearchIPCRouterTest; |
| 164 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, | 160 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, |
| 165 DetermineIfPageSupportsInstant_Local); | 161 DetermineIfPageSupportsInstant_Local); |
| 166 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, | 162 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, |
| 167 DetermineIfPageSupportsInstant_NonLocal); | 163 DetermineIfPageSupportsInstant_NonLocal); |
| 168 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, | 164 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, |
| 169 PageURLDoesntBelongToInstantRenderer); | 165 PageURLDoesntBelongToInstantRenderer); |
| 170 FRIEND_TEST_ALL_PREFIXES(SearchIPCRouterTest, | 166 FRIEND_TEST_ALL_PREFIXES(SearchIPCRouterTest, |
| 171 IgnoreMessageIfThePageIsNotActive); | 167 IgnoreMessageIfThePageIsNotActive); |
| 172 FRIEND_TEST_ALL_PREFIXES(SearchIPCRouterTest, | |
| 173 DoNotSendSetDisplayInstantResultsMsg); | |
| 174 FRIEND_TEST_ALL_PREFIXES(SearchIPCRouterTest, HandleTabChangedEvents); | 168 FRIEND_TEST_ALL_PREFIXES(SearchIPCRouterTest, HandleTabChangedEvents); |
| 175 | 169 |
| 176 // Overridden from contents::WebContentsObserver: | 170 // Overridden from contents::WebContentsObserver: |
| 177 bool OnMessageReceived(const IPC::Message& message) override; | 171 bool OnMessageReceived(const IPC::Message& message) override; |
| 178 | 172 |
| 179 void OnInstantSupportDetermined(int page_seq_no, bool supports_instant) const; | 173 void OnInstantSupportDetermined(int page_seq_no, bool supports_instant) const; |
| 180 void OnFocusOmnibox(int page_id, OmniboxFocusState state) const; | 174 void OnFocusOmnibox(int page_id, OmniboxFocusState state) const; |
| 181 void OnDeleteMostVisitedItem(int page_seq_no, const GURL& url) const; | 175 void OnDeleteMostVisitedItem(int page_seq_no, const GURL& url) const; |
| 182 void OnUndoMostVisitedDeletion(int page_seq_no, const GURL& url) const; | 176 void OnUndoMostVisitedDeletion(int page_seq_no, const GURL& url) const; |
| 183 void OnUndoAllMostVisitedDeletions(int page_seq_no) const; | 177 void OnUndoAllMostVisitedDeletions(int page_seq_no) const; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 // SearchIPCRouter to ensure that delayed IPC replies are ignored. | 209 // SearchIPCRouter to ensure that delayed IPC replies are ignored. |
| 216 int commit_counter_; | 210 int commit_counter_; |
| 217 | 211 |
| 218 // Set to true, when the tab corresponding to |this| instance is active. | 212 // Set to true, when the tab corresponding to |this| instance is active. |
| 219 bool is_active_tab_; | 213 bool is_active_tab_; |
| 220 | 214 |
| 221 DISALLOW_COPY_AND_ASSIGN(SearchIPCRouter); | 215 DISALLOW_COPY_AND_ASSIGN(SearchIPCRouter); |
| 222 }; | 216 }; |
| 223 | 217 |
| 224 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_IPC_ROUTER_H_ | 218 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_IPC_ROUTER_H_ |
| OLD | NEW |