| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 virtual bool ShouldSendMostVisitedItems() = 0; | 107 virtual bool ShouldSendMostVisitedItems() = 0; |
| 108 virtual bool ShouldSendThemeBackgroundInfo() = 0; | 108 virtual bool ShouldSendThemeBackgroundInfo() = 0; |
| 109 virtual bool ShouldSendToggleVoiceSearch() = 0; | 109 virtual bool ShouldSendToggleVoiceSearch() = 0; |
| 110 virtual bool ShouldSubmitQuery() = 0; | 110 virtual bool ShouldSubmitQuery() = 0; |
| 111 }; | 111 }; |
| 112 | 112 |
| 113 SearchIPCRouter(content::WebContents* web_contents, Delegate* delegate, | 113 SearchIPCRouter(content::WebContents* web_contents, Delegate* delegate, |
| 114 scoped_ptr<Policy> policy); | 114 scoped_ptr<Policy> policy); |
| 115 virtual ~SearchIPCRouter(); | 115 virtual ~SearchIPCRouter(); |
| 116 | 116 |
| 117 // Tells the SearchIPCRouter that a new page in an Instant process committed. |
| 118 void OnNavigationEntryCommitted(); |
| 119 |
| 117 // Tells the renderer to determine if the page supports the Instant API, which | 120 // Tells the renderer to determine if the page supports the Instant API, which |
| 118 // results in a call to OnInstantSupportDetermined() when the reply is | 121 // results in a call to OnInstantSupportDetermined() when the reply is |
| 119 // received. | 122 // received. |
| 120 void DetermineIfPageSupportsInstant(); | 123 void DetermineIfPageSupportsInstant(); |
| 121 | 124 |
| 122 // Tells the renderer about the result of the Chrome identity check. | 125 // Tells the renderer about the result of the Chrome identity check. |
| 123 void SendChromeIdentityCheckResult(const base::string16& identity, | 126 void SendChromeIdentityCheckResult(const base::string16& identity, |
| 124 bool identity_match); | 127 bool identity_match); |
| 125 | 128 |
| 126 // Tells the renderer information it needs to display promos. | 129 // Tells the renderer information it needs to display promos. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 PageURLDoesntBelongToInstantRenderer); | 175 PageURLDoesntBelongToInstantRenderer); |
| 173 FRIEND_TEST_ALL_PREFIXES(SearchIPCRouterTest, | 176 FRIEND_TEST_ALL_PREFIXES(SearchIPCRouterTest, |
| 174 IgnoreMessageIfThePageIsNotActive); | 177 IgnoreMessageIfThePageIsNotActive); |
| 175 FRIEND_TEST_ALL_PREFIXES(SearchIPCRouterTest, | 178 FRIEND_TEST_ALL_PREFIXES(SearchIPCRouterTest, |
| 176 DoNotSendSetDisplayInstantResultsMsg); | 179 DoNotSendSetDisplayInstantResultsMsg); |
| 177 FRIEND_TEST_ALL_PREFIXES(SearchIPCRouterTest, HandleTabChangedEvents); | 180 FRIEND_TEST_ALL_PREFIXES(SearchIPCRouterTest, HandleTabChangedEvents); |
| 178 | 181 |
| 179 // Overridden from contents::WebContentsObserver: | 182 // Overridden from contents::WebContentsObserver: |
| 180 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 183 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 181 | 184 |
| 182 void OnInstantSupportDetermined(int page_id, bool supports_instant) const; | 185 void OnInstantSupportDetermined(int page_seq_no, bool supports_instant) const; |
| 183 void OnVoiceSearchSupportDetermined(int page_id, | 186 void OnVoiceSearchSupportDetermined(int page_id, |
| 184 bool supports_voice_search) const; | 187 bool supports_voice_search) const; |
| 185 void OnFocusOmnibox(int page_id, OmniboxFocusState state) const; | 188 void OnFocusOmnibox(int page_id, OmniboxFocusState state) const; |
| 186 void OnSearchBoxNavigate(int page_id, | 189 void OnSearchBoxNavigate(int page_id, |
| 187 const GURL& url, | 190 const GURL& url, |
| 188 WindowOpenDisposition disposition, | 191 WindowOpenDisposition disposition, |
| 189 bool is_most_visited_item_url) const; | 192 bool is_most_visited_item_url) const; |
| 190 void OnDeleteMostVisitedItem(int page_id, const GURL& url) const; | 193 void OnDeleteMostVisitedItem(int page_seq_no, const GURL& url) const; |
| 191 void OnUndoMostVisitedDeletion(int page_id, const GURL& url) const; | 194 void OnUndoMostVisitedDeletion(int page_seq_no, const GURL& url) const; |
| 192 void OnUndoAllMostVisitedDeletions(int page_id) const; | 195 void OnUndoAllMostVisitedDeletions(int page_seq_no) const; |
| 193 void OnLogEvent(int page_id, NTPLoggingEventType event) const; | 196 void OnLogEvent(int page_seq_no, NTPLoggingEventType event) const; |
| 194 void OnLogMostVisitedImpression(int page_id, | 197 void OnLogMostVisitedImpression(int page_seq_no, |
| 195 int position, | 198 int position, |
| 196 const base::string16& provider) const; | 199 const base::string16& provider) const; |
| 197 void OnLogMostVisitedNavigation(int page_id, | 200 void OnLogMostVisitedNavigation(int page_seq_no, |
| 198 int position, | 201 int position, |
| 199 const base::string16& provider) const; | 202 const base::string16& provider) const; |
| 200 void OnPasteAndOpenDropDown(int page_id, const base::string16& text) const; | 203 void OnPasteAndOpenDropDown(int page_seq_no, |
| 201 void OnChromeIdentityCheck(int page_id, const base::string16& identity) const; | 204 const base::string16& text) const; |
| 205 void OnChromeIdentityCheck(int page_seq_no, |
| 206 const base::string16& identity) const; |
| 202 | 207 |
| 203 // Used by unit tests to set a fake delegate. | 208 // Used by unit tests to set a fake delegate. |
| 204 void set_delegate(Delegate* delegate); | 209 void set_delegate_for_testing(Delegate* delegate); |
| 205 | 210 |
| 206 // Used by unit tests. | 211 // Used by unit tests. |
| 207 void set_policy(scoped_ptr<Policy> policy); | 212 void set_policy_for_testing(scoped_ptr<Policy> policy); |
| 208 | 213 |
| 209 // Used by unit tests. | 214 // Used by unit tests. |
| 210 Policy* policy() const { return policy_.get(); } | 215 Policy* policy_for_testing() const { return policy_.get(); } |
| 216 |
| 217 // Used by unit tests. |
| 218 int page_seq_no_for_testing() const { return commit_counter_; } |
| 211 | 219 |
| 212 Delegate* delegate_; | 220 Delegate* delegate_; |
| 213 scoped_ptr<Policy> policy_; | 221 scoped_ptr<Policy> policy_; |
| 214 | 222 |
| 223 // Holds the number of main frame commits executed in this tab. Used by the |
| 224 // SearchIPCRouter to ensure that delayed IPC replies are ignored. |
| 225 int commit_counter_; |
| 226 |
| 215 // Set to true, when the tab corresponding to |this| instance is active. | 227 // Set to true, when the tab corresponding to |this| instance is active. |
| 216 bool is_active_tab_; | 228 bool is_active_tab_; |
| 217 | 229 |
| 218 DISALLOW_COPY_AND_ASSIGN(SearchIPCRouter); | 230 DISALLOW_COPY_AND_ASSIGN(SearchIPCRouter); |
| 219 }; | 231 }; |
| 220 | 232 |
| 221 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_IPC_ROUTER_H_ | 233 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_IPC_ROUTER_H_ |
| OLD | NEW |