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

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

Issue 2852693002: Remove DetermineIfPageSupportsInstant and all its plumbing (Closed)
Patch Set: rebase Created 3 years, 7 months 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 <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "chrome/common/instant.mojom.h" 14 #include "chrome/common/instant.mojom.h"
15 #include "chrome/common/search/instant_types.h" 15 #include "chrome/common/search/instant_types.h"
16 #include "chrome/common/search/ntp_logging_events.h" 16 #include "chrome/common/search/ntp_logging_events.h"
17 #include "components/ntp_tiles/tile_source.h" 17 #include "components/ntp_tiles/tile_source.h"
18 #include "components/ntp_tiles/tile_visual_type.h" 18 #include "components/ntp_tiles/tile_visual_type.h"
19 #include "components/omnibox/common/omnibox_focus_state.h" 19 #include "components/omnibox/common/omnibox_focus_state.h"
20 #include "content/public/browser/web_contents_binding_set.h" 20 #include "content/public/browser/web_contents_binding_set.h"
21 #include "content/public/browser/web_contents_observer.h" 21 #include "content/public/browser/web_contents_observer.h"
22 #include "ui/base/window_open_disposition.h"
23 22
24 class GURL; 23 class GURL;
25 24
26 namespace content { 25 namespace content {
27 class WebContents; 26 class WebContents;
28 } 27 }
29 28
30 class SearchIPCRouterTest; 29 class SearchIPCRouterTest;
31 30
32 // SearchIPCRouter is responsible for receiving and sending IPC messages between 31 // SearchIPCRouter is responsible for receiving and sending IPC messages between
33 // the browser and the Instant page. 32 // the browser and the Instant page.
34 class SearchIPCRouter : public content::WebContentsObserver, 33 class SearchIPCRouter : public content::WebContentsObserver,
35 public chrome::mojom::Instant { 34 public chrome::mojom::Instant {
36 public: 35 public:
37 // SearchIPCRouter calls its delegate in response to messages received from 36 // SearchIPCRouter calls its delegate in response to messages received from
38 // the page. 37 // the page.
39 class Delegate { 38 class Delegate {
40 public: 39 public:
41 // Called upon determination of Instant API support in response to the page 40 // Called upon determination of Instant API support in response to the page
42 // load event. 41 // load event.
42 // TODO(treib): Remove this. crbug.com/627747
43 virtual void OnInstantSupportDetermined(bool supports_instant) = 0; 43 virtual void OnInstantSupportDetermined(bool supports_instant) = 0;
44 44
45 // Called when the page wants the omnibox to be focused. |state| specifies 45 // Called when the page wants the omnibox to be focused. |state| specifies
46 // the omnibox focus state. 46 // the omnibox focus state.
47 virtual void FocusOmnibox(OmniboxFocusState state) = 0; 47 virtual void FocusOmnibox(OmniboxFocusState state) = 0;
48 48
49 // Called when the SearchBox wants to delete a Most Visited item. 49 // Called when the SearchBox wants to delete a Most Visited item.
50 virtual void OnDeleteMostVisitedItem(const GURL& url) = 0; 50 virtual void OnDeleteMostVisitedItem(const GURL& url) = 0;
51 51
52 // Called when the SearchBox wants to undo a Most Visited deletion. 52 // Called when the SearchBox wants to undo a Most Visited deletion.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 }; 129 };
130 130
131 SearchIPCRouter(content::WebContents* web_contents, 131 SearchIPCRouter(content::WebContents* web_contents,
132 Delegate* delegate, 132 Delegate* delegate,
133 std::unique_ptr<Policy> policy); 133 std::unique_ptr<Policy> policy);
134 ~SearchIPCRouter() override; 134 ~SearchIPCRouter() override;
135 135
136 // Tells the SearchIPCRouter that a new page in an Instant process committed. 136 // Tells the SearchIPCRouter that a new page in an Instant process committed.
137 void OnNavigationEntryCommitted(); 137 void OnNavigationEntryCommitted();
138 138
139 // Tells the renderer to determine if the page supports the Instant API, which
140 // results in a call to OnInstantSupportDetermined() when the reply is
141 // received.
142 void DetermineIfPageSupportsInstant();
143
144 // Tells the renderer about the result of the Chrome identity check. 139 // Tells the renderer about the result of the Chrome identity check.
145 void SendChromeIdentityCheckResult(const base::string16& identity, 140 void SendChromeIdentityCheckResult(const base::string16& identity,
146 bool identity_match); 141 bool identity_match);
147 142
148 // Tells the renderer whether the user syncs history. 143 // Tells the renderer whether the user syncs history.
149 void SendHistorySyncCheckResult(bool sync_history); 144 void SendHistorySyncCheckResult(bool sync_history);
150 145
151 // Tells the page the suggestion to be prefetched if any. 146 // Tells the page the suggestion to be prefetched if any.
152 void SetSuggestionToPrefetch(const InstantSuggestion& suggestion); 147 void SetSuggestionToPrefetch(const InstantSuggestion& suggestion);
153 148
(...skipping 14 matching lines...) Expand all
168 void Submit(const base::string16& text, 163 void Submit(const base::string16& text,
169 const EmbeddedSearchRequestParams& params); 164 const EmbeddedSearchRequestParams& params);
170 165
171 // Called when the tab corresponding to |this| instance is activated. 166 // Called when the tab corresponding to |this| instance is activated.
172 void OnTabActivated(); 167 void OnTabActivated();
173 168
174 // Called when the tab corresponding to |this| instance is deactivated. 169 // Called when the tab corresponding to |this| instance is deactivated.
175 void OnTabDeactivated(); 170 void OnTabDeactivated();
176 171
177 // chrome::mojom::Instant: 172 // chrome::mojom::Instant:
178 void InstantSupportDetermined(int page_seq_no,
179 bool supports_instant) override;
180 void FocusOmnibox(int page_id, OmniboxFocusState state) override; 173 void FocusOmnibox(int page_id, OmniboxFocusState state) override;
181 void DeleteMostVisitedItem(int page_seq_no, const GURL& url) override; 174 void DeleteMostVisitedItem(int page_seq_no, const GURL& url) override;
182 void UndoMostVisitedDeletion(int page_seq_no, const GURL& url) override; 175 void UndoMostVisitedDeletion(int page_seq_no, const GURL& url) override;
183 void UndoAllMostVisitedDeletions(int page_seq_no) override; 176 void UndoAllMostVisitedDeletions(int page_seq_no) override;
184 void LogEvent(int page_seq_no, 177 void LogEvent(int page_seq_no,
185 NTPLoggingEventType event, 178 NTPLoggingEventType event,
186 base::TimeDelta time) override; 179 base::TimeDelta time) override;
187 void LogMostVisitedImpression(int page_seq_no, 180 void LogMostVisitedImpression(int page_seq_no,
188 int position, 181 int position,
189 ntp_tiles::TileSource tile_source, 182 ntp_tiles::TileSource tile_source,
(...skipping 10 matching lines...) Expand all
200 193
201 void set_search_box_client_factory_for_testing( 194 void set_search_box_client_factory_for_testing(
202 std::unique_ptr<SearchBoxClientFactory> factory) { 195 std::unique_ptr<SearchBoxClientFactory> factory) {
203 search_box_client_factory_ = std::move(factory); 196 search_box_client_factory_ = std::move(factory);
204 } 197 }
205 198
206 private: 199 private:
207 friend class SearchIPCRouterPolicyTest; 200 friend class SearchIPCRouterPolicyTest;
208 friend class SearchIPCRouterTest; 201 friend class SearchIPCRouterTest;
209 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, 202 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest,
210 DetermineIfPageSupportsInstant_Local);
211 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest,
212 DetermineIfPageSupportsInstant_NonLocal);
213 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest,
214 PageURLDoesntBelongToInstantRenderer); 203 PageURLDoesntBelongToInstantRenderer);
215 FRIEND_TEST_ALL_PREFIXES(SearchIPCRouterTest, 204 FRIEND_TEST_ALL_PREFIXES(SearchIPCRouterTest,
216 IgnoreMessageIfThePageIsNotActive); 205 IgnoreMessageIfThePageIsNotActive);
217 FRIEND_TEST_ALL_PREFIXES(SearchIPCRouterTest, HandleTabChangedEvents); 206 FRIEND_TEST_ALL_PREFIXES(SearchIPCRouterTest, HandleTabChangedEvents);
218 207
219 // Used by unit tests to set a fake delegate. 208 // Used by unit tests to set a fake delegate.
220 void set_delegate_for_testing(Delegate* delegate); 209 void set_delegate_for_testing(Delegate* delegate);
221 210
222 // Used by unit tests. 211 // Used by unit tests.
223 void set_policy_for_testing(std::unique_ptr<Policy> policy); 212 void set_policy_for_testing(std::unique_ptr<Policy> policy);
(...skipping 22 matching lines...) Expand all
246 // the moment, but this could be extended to a map of connected frames, if 235 // the moment, but this could be extended to a map of connected frames, if
247 // desired. 236 // desired.
248 mojo::AssociatedBinding<chrome::mojom::Instant> binding_; 237 mojo::AssociatedBinding<chrome::mojom::Instant> binding_;
249 238
250 std::unique_ptr<SearchBoxClientFactory> search_box_client_factory_; 239 std::unique_ptr<SearchBoxClientFactory> search_box_client_factory_;
251 240
252 DISALLOW_COPY_AND_ASSIGN(SearchIPCRouter); 241 DISALLOW_COPY_AND_ASSIGN(SearchIPCRouter);
253 }; 242 };
254 243
255 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_IPC_ROUTER_H_ 244 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_IPC_ROUTER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/instant_tab_unittest.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