Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1553)

Side by Side Diff: chrome/browser/ui/search/search_ipc_router.h

Issue 1428423002: Remove setVoiceSearchSupported part of EmbeddedSearch SearchBox API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mac fix Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 18 matching lines...) Expand all
29 class SearchIPCRouter : public content::WebContentsObserver { 29 class SearchIPCRouter : public content::WebContentsObserver {
30 public: 30 public:
31 // SearchIPCRouter calls its delegate in response to messages received from 31 // SearchIPCRouter calls its delegate in response to messages received from
32 // the page. 32 // the page.
33 class Delegate { 33 class Delegate {
34 public: 34 public:
35 // Called upon determination of Instant API support in response to the page 35 // Called upon determination of Instant API support in response to the page
36 // load event. 36 // load event.
37 virtual void OnInstantSupportDetermined(bool supports_instant) = 0; 37 virtual void OnInstantSupportDetermined(bool supports_instant) = 0;
38 38
39 // Called upon determination of voice search API support.
40 virtual void OnSetVoiceSearchSupport(bool supports_voice_search) = 0;
41
42 // Called when the page wants the omnibox to be focused. |state| specifies 39 // Called when the page wants the omnibox to be focused. |state| specifies
43 // the omnibox focus state. 40 // the omnibox focus state.
44 virtual void FocusOmnibox(OmniboxFocusState state) = 0; 41 virtual void FocusOmnibox(OmniboxFocusState state) = 0;
45 42
46 // Called when the page wants to navigate to |url|. Usually used by the 43 // Called when the page wants to navigate to |url|. Usually used by the
47 // page to navigate to privileged destinations (e.g. chrome:// URLs) or to 44 // page to navigate to privileged destinations (e.g. chrome:// URLs) or to
48 // navigate to URLs that are hidden from the page using Restricted IDs (rid 45 // navigate to URLs that are hidden from the page using Restricted IDs (rid
49 // in the API). 46 // in the API).
50 virtual void NavigateToURL(const GURL& url, 47 virtual void NavigateToURL(const GURL& url,
51 WindowOpenDisposition disposition, 48 WindowOpenDisposition disposition,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 90
94 // An interface to be implemented by consumers of SearchIPCRouter objects to 91 // An interface to be implemented by consumers of SearchIPCRouter objects to
95 // decide whether to process the message received from the page, and vice 92 // decide whether to process the message received from the page, and vice
96 // versa (decide whether to send messages to the page). 93 // versa (decide whether to send messages to the page).
97 class Policy { 94 class Policy {
98 public: 95 public:
99 virtual ~Policy() {} 96 virtual ~Policy() {}
100 97
101 // SearchIPCRouter calls these functions before sending/receiving messages 98 // SearchIPCRouter calls these functions before sending/receiving messages
102 // to/from the page. 99 // to/from the page.
103 virtual bool ShouldProcessSetVoiceSearchSupport() = 0;
104 virtual bool ShouldProcessFocusOmnibox(bool is_active_tab) = 0; 100 virtual bool ShouldProcessFocusOmnibox(bool is_active_tab) = 0;
105 virtual bool ShouldProcessNavigateToURL(bool is_active_tab) = 0; 101 virtual bool ShouldProcessNavigateToURL(bool is_active_tab) = 0;
106 virtual bool ShouldProcessDeleteMostVisitedItem() = 0; 102 virtual bool ShouldProcessDeleteMostVisitedItem() = 0;
107 virtual bool ShouldProcessUndoMostVisitedDeletion() = 0; 103 virtual bool ShouldProcessUndoMostVisitedDeletion() = 0;
108 virtual bool ShouldProcessUndoAllMostVisitedDeletions() = 0; 104 virtual bool ShouldProcessUndoAllMostVisitedDeletions() = 0;
109 virtual bool ShouldProcessLogEvent() = 0; 105 virtual bool ShouldProcessLogEvent() = 0;
110 virtual bool ShouldProcessPasteIntoOmnibox(bool is_active_tab) = 0; 106 virtual bool ShouldProcessPasteIntoOmnibox(bool is_active_tab) = 0;
111 virtual bool ShouldProcessChromeIdentityCheck() = 0; 107 virtual bool ShouldProcessChromeIdentityCheck() = 0;
112 virtual bool ShouldProcessHistorySyncCheck() = 0; 108 virtual bool ShouldProcessHistorySyncCheck() = 0;
113 virtual bool ShouldSendSetPromoInformation() = 0; 109 virtual bool ShouldSendSetPromoInformation() = 0;
114 virtual bool ShouldSendSetDisplayInstantResults() = 0; 110 virtual bool ShouldSendSetDisplayInstantResults() = 0;
115 virtual bool ShouldSendSetSuggestionToPrefetch() = 0; 111 virtual bool ShouldSendSetSuggestionToPrefetch() = 0;
116 virtual bool ShouldSendSetOmniboxStartMargin() = 0; 112 virtual bool ShouldSendSetOmniboxStartMargin() = 0;
117 virtual bool ShouldSendSetInputInProgress(bool is_active_tab) = 0; 113 virtual bool ShouldSendSetInputInProgress(bool is_active_tab) = 0;
118 virtual bool ShouldSendOmniboxFocusChanged() = 0; 114 virtual bool ShouldSendOmniboxFocusChanged() = 0;
119 virtual bool ShouldSendMostVisitedItems() = 0; 115 virtual bool ShouldSendMostVisitedItems() = 0;
120 virtual bool ShouldSendThemeBackgroundInfo() = 0; 116 virtual bool ShouldSendThemeBackgroundInfo() = 0;
121 virtual bool ShouldSendToggleVoiceSearch() = 0;
122 virtual bool ShouldSubmitQuery() = 0; 117 virtual bool ShouldSubmitQuery() = 0;
123 }; 118 };
124 119
125 SearchIPCRouter(content::WebContents* web_contents, Delegate* delegate, 120 SearchIPCRouter(content::WebContents* web_contents, Delegate* delegate,
126 scoped_ptr<Policy> policy); 121 scoped_ptr<Policy> policy);
127 ~SearchIPCRouter() override; 122 ~SearchIPCRouter() override;
128 123
129 // Tells the SearchIPCRouter that a new page in an Instant process committed. 124 // Tells the SearchIPCRouter that a new page in an Instant process committed.
130 void OnNavigationEntryCommitted(); 125 void OnNavigationEntryCommitted();
131 126
(...skipping 28 matching lines...) Expand all
160 // Tells the page that the omnibox focus has changed. 155 // Tells the page that the omnibox focus has changed.
161 void OmniboxFocusChanged(OmniboxFocusState state, 156 void OmniboxFocusChanged(OmniboxFocusState state,
162 OmniboxFocusChangeReason reason); 157 OmniboxFocusChangeReason reason);
163 158
164 // Tells the renderer about the most visited items. 159 // Tells the renderer about the most visited items.
165 void SendMostVisitedItems(const std::vector<InstantMostVisitedItem>& items); 160 void SendMostVisitedItems(const std::vector<InstantMostVisitedItem>& items);
166 161
167 // Tells the renderer about the current theme background. 162 // Tells the renderer about the current theme background.
168 void SendThemeBackgroundInfo(const ThemeBackgroundInfo& theme_info); 163 void SendThemeBackgroundInfo(const ThemeBackgroundInfo& theme_info);
169 164
170 // Tells the page to toggle voice search.
171 void ToggleVoiceSearch();
172
173 // Tells the page that the user pressed Enter in the omnibox. 165 // Tells the page that the user pressed Enter in the omnibox.
174 void Submit(const base::string16& text, 166 void Submit(const base::string16& text,
175 const EmbeddedSearchRequestParams& params); 167 const EmbeddedSearchRequestParams& params);
176 168
177 // Called when the tab corresponding to |this| instance is activated. 169 // Called when the tab corresponding to |this| instance is activated.
178 void OnTabActivated(); 170 void OnTabActivated();
179 171
180 // Called when the tab corresponding to |this| instance is deactivated. 172 // Called when the tab corresponding to |this| instance is deactivated.
181 void OnTabDeactivated(); 173 void OnTabDeactivated();
182 174
183 private: 175 private:
184 friend class SearchIPCRouterPolicyTest; 176 friend class SearchIPCRouterPolicyTest;
185 friend class SearchIPCRouterTest; 177 friend class SearchIPCRouterTest;
186 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, 178 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest,
187 DetermineIfPageSupportsInstant_Local); 179 DetermineIfPageSupportsInstant_Local);
188 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, 180 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest,
189 DetermineIfPageSupportsInstant_NonLocal); 181 DetermineIfPageSupportsInstant_NonLocal);
190 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, 182 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest,
191 PageURLDoesntBelongToInstantRenderer); 183 PageURLDoesntBelongToInstantRenderer);
192 FRIEND_TEST_ALL_PREFIXES(SearchIPCRouterTest, 184 FRIEND_TEST_ALL_PREFIXES(SearchIPCRouterTest,
193 IgnoreMessageIfThePageIsNotActive); 185 IgnoreMessageIfThePageIsNotActive);
194 FRIEND_TEST_ALL_PREFIXES(SearchIPCRouterTest, 186 FRIEND_TEST_ALL_PREFIXES(SearchIPCRouterTest,
195 DoNotSendSetDisplayInstantResultsMsg); 187 DoNotSendSetDisplayInstantResultsMsg);
196 FRIEND_TEST_ALL_PREFIXES(SearchIPCRouterTest, HandleTabChangedEvents); 188 FRIEND_TEST_ALL_PREFIXES(SearchIPCRouterTest, HandleTabChangedEvents);
197 189
198 // Overridden from contents::WebContentsObserver: 190 // Overridden from contents::WebContentsObserver:
199 bool OnMessageReceived(const IPC::Message& message) override; 191 bool OnMessageReceived(const IPC::Message& message) override;
200 192
201 void OnInstantSupportDetermined(int page_seq_no, bool supports_instant) const; 193 void OnInstantSupportDetermined(int page_seq_no, bool supports_instant) const;
202 void OnVoiceSearchSupportDetermined(int page_id,
203 bool supports_voice_search) const;
204 void OnFocusOmnibox(int page_id, OmniboxFocusState state) const; 194 void OnFocusOmnibox(int page_id, OmniboxFocusState state) const;
205 void OnSearchBoxNavigate(int page_id, 195 void OnSearchBoxNavigate(int page_id,
206 const GURL& url, 196 const GURL& url,
207 WindowOpenDisposition disposition, 197 WindowOpenDisposition disposition,
208 bool is_most_visited_item_url) const; 198 bool is_most_visited_item_url) const;
209 void OnDeleteMostVisitedItem(int page_seq_no, const GURL& url) const; 199 void OnDeleteMostVisitedItem(int page_seq_no, const GURL& url) const;
210 void OnUndoMostVisitedDeletion(int page_seq_no, const GURL& url) const; 200 void OnUndoMostVisitedDeletion(int page_seq_no, const GURL& url) const;
211 void OnUndoAllMostVisitedDeletions(int page_seq_no) const; 201 void OnUndoAllMostVisitedDeletions(int page_seq_no) const;
212 void OnLogEvent(int page_seq_no, 202 void OnLogEvent(int page_seq_no,
213 NTPLoggingEventType event, 203 NTPLoggingEventType event,
(...skipping 29 matching lines...) Expand all
243 // SearchIPCRouter to ensure that delayed IPC replies are ignored. 233 // SearchIPCRouter to ensure that delayed IPC replies are ignored.
244 int commit_counter_; 234 int commit_counter_;
245 235
246 // Set to true, when the tab corresponding to |this| instance is active. 236 // Set to true, when the tab corresponding to |this| instance is active.
247 bool is_active_tab_; 237 bool is_active_tab_;
248 238
249 DISALLOW_COPY_AND_ASSIGN(SearchIPCRouter); 239 DISALLOW_COPY_AND_ASSIGN(SearchIPCRouter);
250 }; 240 };
251 241
252 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_IPC_ROUTER_H_ 242 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_IPC_ROUTER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/instant_extended_interactive_uitest.cc ('k') | chrome/browser/ui/search/search_ipc_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698