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 <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "chrome/common/instant_types.h" | 14 #include "chrome/common/instant_types.h" |
15 #include "chrome/common/ntp_logging_events.h" | 15 #include "chrome/common/ntp_logging_events.h" |
16 #include "components/omnibox/common/omnibox_focus_state.h" | 16 #include "components/omnibox/common/omnibox_focus_state.h" |
17 #include "content/public/browser/web_contents_observer.h" | 17 #include "content/public/browser/web_contents_observer.h" |
18 #include "ui/base/window_open_disposition.h" | 18 #include "ui/base/window_open_disposition.h" |
19 | 19 |
20 class GURL; | 20 class GURL; |
21 | 21 |
22 namespace content { | 22 namespace content { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 virtual bool ShouldSendSetPromoInformation() = 0; | 109 virtual bool ShouldSendSetPromoInformation() = 0; |
110 virtual bool ShouldSendSetDisplayInstantResults() = 0; | 110 virtual bool ShouldSendSetDisplayInstantResults() = 0; |
111 virtual bool ShouldSendSetSuggestionToPrefetch() = 0; | 111 virtual bool ShouldSendSetSuggestionToPrefetch() = 0; |
112 virtual bool ShouldSendSetInputInProgress(bool is_active_tab) = 0; | 112 virtual bool ShouldSendSetInputInProgress(bool is_active_tab) = 0; |
113 virtual bool ShouldSendOmniboxFocusChanged() = 0; | 113 virtual bool ShouldSendOmniboxFocusChanged() = 0; |
114 virtual bool ShouldSendMostVisitedItems() = 0; | 114 virtual bool ShouldSendMostVisitedItems() = 0; |
115 virtual bool ShouldSendThemeBackgroundInfo() = 0; | 115 virtual bool ShouldSendThemeBackgroundInfo() = 0; |
116 virtual bool ShouldSubmitQuery() = 0; | 116 virtual bool ShouldSubmitQuery() = 0; |
117 }; | 117 }; |
118 | 118 |
119 SearchIPCRouter(content::WebContents* web_contents, Delegate* delegate, | 119 SearchIPCRouter(content::WebContents* web_contents, |
120 scoped_ptr<Policy> policy); | 120 Delegate* delegate, |
| 121 std::unique_ptr<Policy> policy); |
121 ~SearchIPCRouter() override; | 122 ~SearchIPCRouter() override; |
122 | 123 |
123 // 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. |
124 void OnNavigationEntryCommitted(); | 125 void OnNavigationEntryCommitted(); |
125 | 126 |
126 // Tells the renderer to determine if the page supports the Instant API, which | 127 // Tells the renderer to determine if the page supports the Instant API, which |
127 // results in a call to OnInstantSupportDetermined() when the reply is | 128 // results in a call to OnInstantSupportDetermined() when the reply is |
128 // received. | 129 // received. |
129 void DetermineIfPageSupportsInstant(); | 130 void DetermineIfPageSupportsInstant(); |
130 | 131 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 void OnPasteAndOpenDropDown(int page_seq_no, | 206 void OnPasteAndOpenDropDown(int page_seq_no, |
206 const base::string16& text) const; | 207 const base::string16& text) const; |
207 void OnChromeIdentityCheck(int page_seq_no, | 208 void OnChromeIdentityCheck(int page_seq_no, |
208 const base::string16& identity) const; | 209 const base::string16& identity) const; |
209 void OnHistorySyncCheck(int page_seq_no) const; | 210 void OnHistorySyncCheck(int page_seq_no) const; |
210 | 211 |
211 // Used by unit tests to set a fake delegate. | 212 // Used by unit tests to set a fake delegate. |
212 void set_delegate_for_testing(Delegate* delegate); | 213 void set_delegate_for_testing(Delegate* delegate); |
213 | 214 |
214 // Used by unit tests. | 215 // Used by unit tests. |
215 void set_policy_for_testing(scoped_ptr<Policy> policy); | 216 void set_policy_for_testing(std::unique_ptr<Policy> policy); |
216 | 217 |
217 // Used by unit tests. | 218 // Used by unit tests. |
218 Policy* policy_for_testing() const { return policy_.get(); } | 219 Policy* policy_for_testing() const { return policy_.get(); } |
219 | 220 |
220 // Used by unit tests. | 221 // Used by unit tests. |
221 int page_seq_no_for_testing() const { return commit_counter_; } | 222 int page_seq_no_for_testing() const { return commit_counter_; } |
222 | 223 |
223 Delegate* delegate_; | 224 Delegate* delegate_; |
224 scoped_ptr<Policy> policy_; | 225 std::unique_ptr<Policy> policy_; |
225 | 226 |
226 // Holds the number of main frame commits executed in this tab. Used by the | 227 // Holds the number of main frame commits executed in this tab. Used by the |
227 // SearchIPCRouter to ensure that delayed IPC replies are ignored. | 228 // SearchIPCRouter to ensure that delayed IPC replies are ignored. |
228 int commit_counter_; | 229 int commit_counter_; |
229 | 230 |
230 // Set to true, when the tab corresponding to |this| instance is active. | 231 // Set to true, when the tab corresponding to |this| instance is active. |
231 bool is_active_tab_; | 232 bool is_active_tab_; |
232 | 233 |
233 DISALLOW_COPY_AND_ASSIGN(SearchIPCRouter); | 234 DISALLOW_COPY_AND_ASSIGN(SearchIPCRouter); |
234 }; | 235 }; |
235 | 236 |
236 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_IPC_ROUTER_H_ | 237 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_IPC_ROUTER_H_ |
OLD | NEW |