| 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 23 matching lines...) Expand all Loading... |
| 34 class Delegate { | 34 class Delegate { |
| 35 public: | 35 public: |
| 36 // Called upon determination of Instant API support in response to the page | 36 // Called upon determination of Instant API support in response to the page |
| 37 // load event. | 37 // load event. |
| 38 virtual void OnInstantSupportDetermined(bool supports_instant) = 0; | 38 virtual void OnInstantSupportDetermined(bool supports_instant) = 0; |
| 39 | 39 |
| 40 // Called when the page wants the omnibox to be focused. |state| specifies | 40 // Called when the page wants the omnibox to be focused. |state| specifies |
| 41 // the omnibox focus state. | 41 // the omnibox focus state. |
| 42 virtual void FocusOmnibox(OmniboxFocusState state) = 0; | 42 virtual void FocusOmnibox(OmniboxFocusState state) = 0; |
| 43 | 43 |
| 44 // Called when the page wants to navigate to |url|. Usually used by the | |
| 45 // page to navigate to privileged destinations (e.g. chrome:// URLs) or to | |
| 46 // navigate to URLs that are hidden from the page using Restricted IDs (rid | |
| 47 // in the API). | |
| 48 virtual void NavigateToURL(const GURL& url, | |
| 49 WindowOpenDisposition disposition) = 0; | |
| 50 | |
| 51 // Called when the SearchBox wants to delete a Most Visited item. | 44 // Called when the SearchBox wants to delete a Most Visited item. |
| 52 virtual void OnDeleteMostVisitedItem(const GURL& url) = 0; | 45 virtual void OnDeleteMostVisitedItem(const GURL& url) = 0; |
| 53 | 46 |
| 54 // Called when the SearchBox wants to undo a Most Visited deletion. | 47 // Called when the SearchBox wants to undo a Most Visited deletion. |
| 55 virtual void OnUndoMostVisitedDeletion(const GURL& url) = 0; | 48 virtual void OnUndoMostVisitedDeletion(const GURL& url) = 0; |
| 56 | 49 |
| 57 // Called when the SearchBox wants to undo all Most Visited deletions. | 50 // Called when the SearchBox wants to undo all Most Visited deletions. |
| 58 virtual void OnUndoAllMostVisitedDeletions() = 0; | 51 virtual void OnUndoAllMostVisitedDeletions() = 0; |
| 59 | 52 |
| 60 // Called to signal that an event has occurred on the New Tab Page at a | 53 // Called to signal that an event has occurred on the New Tab Page at a |
| (...skipping 30 matching lines...) Expand all Loading... |
| 91 // An interface to be implemented by consumers of SearchIPCRouter objects to | 84 // An interface to be implemented by consumers of SearchIPCRouter objects to |
| 92 // decide whether to process the message received from the page, and vice | 85 // decide whether to process the message received from the page, and vice |
| 93 // versa (decide whether to send messages to the page). | 86 // versa (decide whether to send messages to the page). |
| 94 class Policy { | 87 class Policy { |
| 95 public: | 88 public: |
| 96 virtual ~Policy() {} | 89 virtual ~Policy() {} |
| 97 | 90 |
| 98 // SearchIPCRouter calls these functions before sending/receiving messages | 91 // SearchIPCRouter calls these functions before sending/receiving messages |
| 99 // to/from the page. | 92 // to/from the page. |
| 100 virtual bool ShouldProcessFocusOmnibox(bool is_active_tab) = 0; | 93 virtual bool ShouldProcessFocusOmnibox(bool is_active_tab) = 0; |
| 101 virtual bool ShouldProcessNavigateToURL(bool is_active_tab) = 0; | |
| 102 virtual bool ShouldProcessDeleteMostVisitedItem() = 0; | 94 virtual bool ShouldProcessDeleteMostVisitedItem() = 0; |
| 103 virtual bool ShouldProcessUndoMostVisitedDeletion() = 0; | 95 virtual bool ShouldProcessUndoMostVisitedDeletion() = 0; |
| 104 virtual bool ShouldProcessUndoAllMostVisitedDeletions() = 0; | 96 virtual bool ShouldProcessUndoAllMostVisitedDeletions() = 0; |
| 105 virtual bool ShouldProcessLogEvent() = 0; | 97 virtual bool ShouldProcessLogEvent() = 0; |
| 106 virtual bool ShouldProcessPasteIntoOmnibox(bool is_active_tab) = 0; | 98 virtual bool ShouldProcessPasteIntoOmnibox(bool is_active_tab) = 0; |
| 107 virtual bool ShouldProcessChromeIdentityCheck() = 0; | 99 virtual bool ShouldProcessChromeIdentityCheck() = 0; |
| 108 virtual bool ShouldProcessHistorySyncCheck() = 0; | 100 virtual bool ShouldProcessHistorySyncCheck() = 0; |
| 109 virtual bool ShouldSendSetPromoInformation() = 0; | 101 virtual bool ShouldSendSetPromoInformation() = 0; |
| 110 virtual bool ShouldSendSetDisplayInstantResults() = 0; | 102 virtual bool ShouldSendSetDisplayInstantResults() = 0; |
| 111 virtual bool ShouldSendSetSuggestionToPrefetch() = 0; | 103 virtual bool ShouldSendSetSuggestionToPrefetch() = 0; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 IgnoreMessageIfThePageIsNotActive); | 173 IgnoreMessageIfThePageIsNotActive); |
| 182 FRIEND_TEST_ALL_PREFIXES(SearchIPCRouterTest, | 174 FRIEND_TEST_ALL_PREFIXES(SearchIPCRouterTest, |
| 183 DoNotSendSetDisplayInstantResultsMsg); | 175 DoNotSendSetDisplayInstantResultsMsg); |
| 184 FRIEND_TEST_ALL_PREFIXES(SearchIPCRouterTest, HandleTabChangedEvents); | 176 FRIEND_TEST_ALL_PREFIXES(SearchIPCRouterTest, HandleTabChangedEvents); |
| 185 | 177 |
| 186 // Overridden from contents::WebContentsObserver: | 178 // Overridden from contents::WebContentsObserver: |
| 187 bool OnMessageReceived(const IPC::Message& message) override; | 179 bool OnMessageReceived(const IPC::Message& message) override; |
| 188 | 180 |
| 189 void OnInstantSupportDetermined(int page_seq_no, bool supports_instant) const; | 181 void OnInstantSupportDetermined(int page_seq_no, bool supports_instant) const; |
| 190 void OnFocusOmnibox(int page_id, OmniboxFocusState state) const; | 182 void OnFocusOmnibox(int page_id, OmniboxFocusState state) const; |
| 191 void OnSearchBoxNavigate(int page_id, | |
| 192 const GURL& url, | |
| 193 WindowOpenDisposition disposition) const; | |
| 194 void OnDeleteMostVisitedItem(int page_seq_no, const GURL& url) const; | 183 void OnDeleteMostVisitedItem(int page_seq_no, const GURL& url) const; |
| 195 void OnUndoMostVisitedDeletion(int page_seq_no, const GURL& url) const; | 184 void OnUndoMostVisitedDeletion(int page_seq_no, const GURL& url) const; |
| 196 void OnUndoAllMostVisitedDeletions(int page_seq_no) const; | 185 void OnUndoAllMostVisitedDeletions(int page_seq_no) const; |
| 197 void OnLogEvent(int page_seq_no, | 186 void OnLogEvent(int page_seq_no, |
| 198 NTPLoggingEventType event, | 187 NTPLoggingEventType event, |
| 199 base::TimeDelta time) const; | 188 base::TimeDelta time) const; |
| 200 void OnLogMostVisitedImpression(int page_seq_no, | 189 void OnLogMostVisitedImpression(int page_seq_no, |
| 201 int position, | 190 int position, |
| 202 const base::string16& provider) const; | 191 const base::string16& provider) const; |
| 203 void OnLogMostVisitedNavigation(int page_seq_no, | 192 void OnLogMostVisitedNavigation(int page_seq_no, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 228 // SearchIPCRouter to ensure that delayed IPC replies are ignored. | 217 // SearchIPCRouter to ensure that delayed IPC replies are ignored. |
| 229 int commit_counter_; | 218 int commit_counter_; |
| 230 | 219 |
| 231 // Set to true, when the tab corresponding to |this| instance is active. | 220 // Set to true, when the tab corresponding to |this| instance is active. |
| 232 bool is_active_tab_; | 221 bool is_active_tab_; |
| 233 | 222 |
| 234 DISALLOW_COPY_AND_ASSIGN(SearchIPCRouter); | 223 DISALLOW_COPY_AND_ASSIGN(SearchIPCRouter); |
| 235 }; | 224 }; |
| 236 | 225 |
| 237 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_IPC_ROUTER_H_ | 226 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_IPC_ROUTER_H_ |
| OLD | NEW |