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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/search/search_ipc_router_policy_impl.h"
7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/search/search.h"
9 #include "content/public/browser/web_contents.h"
11 SearchIPCRouterPolicyImpl::SearchIPCRouterPolicyImpl(
12 const content::WebContents
* web_contents
)
13 : web_contents_(web_contents
),
18 Profile::FromBrowserContext(web_contents_
->GetBrowserContext());
20 is_incognito_
= profile
->IsOffTheRecord();
23 SearchIPCRouterPolicyImpl::~SearchIPCRouterPolicyImpl() {}
25 bool SearchIPCRouterPolicyImpl::ShouldProcessSetVoiceSearchSupport() {
29 bool SearchIPCRouterPolicyImpl::ShouldProcessFocusOmnibox(bool is_active_tab
) {
30 return is_active_tab
&& !is_incognito_
&& search::IsInstantNTP(web_contents_
);
33 bool SearchIPCRouterPolicyImpl::ShouldProcessNavigateToURL(bool is_active_tab
) {
34 return is_active_tab
&& !is_incognito_
&& search::IsInstantNTP(web_contents_
);
37 bool SearchIPCRouterPolicyImpl::ShouldProcessDeleteMostVisitedItem() {
38 return !is_incognito_
&& search::IsInstantNTP(web_contents_
);
41 bool SearchIPCRouterPolicyImpl::ShouldProcessUndoMostVisitedDeletion() {
42 return !is_incognito_
&& search::IsInstantNTP(web_contents_
);
45 bool SearchIPCRouterPolicyImpl::ShouldProcessUndoAllMostVisitedDeletions() {
46 return !is_incognito_
&& search::IsInstantNTP(web_contents_
);
49 bool SearchIPCRouterPolicyImpl::ShouldProcessLogEvent() {
50 return !is_incognito_
&& search::IsInstantNTP(web_contents_
);
53 bool SearchIPCRouterPolicyImpl::ShouldProcessPasteIntoOmnibox(
55 return is_active_tab
&& !is_incognito_
&& search::IsInstantNTP(web_contents_
);
58 bool SearchIPCRouterPolicyImpl::ShouldProcessChromeIdentityCheck() {
59 return !is_incognito_
&& search::IsInstantNTP(web_contents_
);
62 bool SearchIPCRouterPolicyImpl::ShouldProcessHistorySyncCheck() {
63 return !is_incognito_
&& search::IsInstantNTP(web_contents_
);
66 bool SearchIPCRouterPolicyImpl::ShouldSendSetPromoInformation() {
67 return !is_incognito_
&& search::IsInstantNTP(web_contents_
);
70 bool SearchIPCRouterPolicyImpl::ShouldSendSetDisplayInstantResults() {
71 return !is_incognito_
;
74 bool SearchIPCRouterPolicyImpl::ShouldSendSetSuggestionToPrefetch() {
75 return !is_incognito_
;
78 bool SearchIPCRouterPolicyImpl::ShouldSendSetOmniboxStartMargin() {
82 bool SearchIPCRouterPolicyImpl::ShouldSendSetInputInProgress(
84 return is_active_tab
&& !is_incognito_
;
87 bool SearchIPCRouterPolicyImpl::ShouldSendOmniboxFocusChanged() {
88 return !is_incognito_
;
91 bool SearchIPCRouterPolicyImpl::ShouldSendMostVisitedItems() {
92 return !is_incognito_
&& search::IsInstantNTP(web_contents_
);
95 bool SearchIPCRouterPolicyImpl::ShouldSendThemeBackgroundInfo() {
96 return !is_incognito_
&& search::IsInstantNTP(web_contents_
);
99 bool SearchIPCRouterPolicyImpl::ShouldSendToggleVoiceSearch() {
103 bool SearchIPCRouterPolicyImpl::ShouldSubmitQuery() {