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 #include "chrome/browser/ui/search/search_ipc_router_policy_impl.h" | 5 #include "chrome/browser/ui/search/search_ipc_router_policy_impl.h" |
6 | 6 |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/search/search.h" | 8 #include "chrome/browser/search/search.h" |
9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
10 | 10 |
11 SearchIPCRouterPolicyImpl::SearchIPCRouterPolicyImpl( | 11 SearchIPCRouterPolicyImpl::SearchIPCRouterPolicyImpl( |
12 const content::WebContents* web_contents) | 12 const content::WebContents* web_contents) |
13 : web_contents_(web_contents), | 13 : web_contents_(web_contents), |
14 is_incognito_(true) { | 14 is_incognito_(true) { |
15 DCHECK(web_contents); | 15 DCHECK(web_contents); |
16 | 16 |
17 Profile* profile = | 17 Profile* profile = |
18 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); | 18 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); |
19 if (profile) | 19 if (profile) |
20 is_incognito_ = profile->IsOffTheRecord(); | 20 is_incognito_ = profile->IsOffTheRecord(); |
21 } | 21 } |
22 | 22 |
23 SearchIPCRouterPolicyImpl::~SearchIPCRouterPolicyImpl() {} | 23 SearchIPCRouterPolicyImpl::~SearchIPCRouterPolicyImpl() {} |
24 | 24 |
25 bool SearchIPCRouterPolicyImpl::ShouldProcessSetVoiceSearchSupport() { | 25 bool SearchIPCRouterPolicyImpl::ShouldProcessSetVoiceSearchSupport() { |
26 return true; | 26 return true; |
27 } | 27 } |
28 | 28 |
29 bool SearchIPCRouterPolicyImpl::ShouldProcessFocusOmnibox(bool is_active_tab) { | 29 bool SearchIPCRouterPolicyImpl::ShouldProcessFocusOmnibox(bool is_active_tab) { |
30 return is_active_tab && !is_incognito_ && chrome::IsInstantNTP(web_contents_); | 30 return is_active_tab && !is_incognito_ && search::IsInstantNTP(web_contents_); |
31 } | 31 } |
32 | 32 |
33 bool SearchIPCRouterPolicyImpl::ShouldProcessNavigateToURL(bool is_active_tab) { | 33 bool SearchIPCRouterPolicyImpl::ShouldProcessNavigateToURL(bool is_active_tab) { |
34 return is_active_tab && !is_incognito_ && chrome::IsInstantNTP(web_contents_); | 34 return is_active_tab && !is_incognito_ && search::IsInstantNTP(web_contents_); |
35 } | 35 } |
36 | 36 |
37 bool SearchIPCRouterPolicyImpl::ShouldProcessDeleteMostVisitedItem() { | 37 bool SearchIPCRouterPolicyImpl::ShouldProcessDeleteMostVisitedItem() { |
38 return !is_incognito_ && chrome::IsInstantNTP(web_contents_); | 38 return !is_incognito_ && search::IsInstantNTP(web_contents_); |
39 } | 39 } |
40 | 40 |
41 bool SearchIPCRouterPolicyImpl::ShouldProcessUndoMostVisitedDeletion() { | 41 bool SearchIPCRouterPolicyImpl::ShouldProcessUndoMostVisitedDeletion() { |
42 return !is_incognito_ && chrome::IsInstantNTP(web_contents_); | 42 return !is_incognito_ && search::IsInstantNTP(web_contents_); |
43 } | 43 } |
44 | 44 |
45 bool SearchIPCRouterPolicyImpl::ShouldProcessUndoAllMostVisitedDeletions() { | 45 bool SearchIPCRouterPolicyImpl::ShouldProcessUndoAllMostVisitedDeletions() { |
46 return !is_incognito_ && chrome::IsInstantNTP(web_contents_); | 46 return !is_incognito_ && search::IsInstantNTP(web_contents_); |
47 } | 47 } |
48 | 48 |
49 bool SearchIPCRouterPolicyImpl::ShouldProcessLogEvent() { | 49 bool SearchIPCRouterPolicyImpl::ShouldProcessLogEvent() { |
50 return !is_incognito_ && chrome::IsInstantNTP(web_contents_); | 50 return !is_incognito_ && search::IsInstantNTP(web_contents_); |
51 } | 51 } |
52 | 52 |
53 bool SearchIPCRouterPolicyImpl::ShouldProcessPasteIntoOmnibox( | 53 bool SearchIPCRouterPolicyImpl::ShouldProcessPasteIntoOmnibox( |
54 bool is_active_tab) { | 54 bool is_active_tab) { |
55 return is_active_tab && !is_incognito_ && chrome::IsInstantNTP(web_contents_); | 55 return is_active_tab && !is_incognito_ && search::IsInstantNTP(web_contents_); |
56 } | 56 } |
57 | 57 |
58 bool SearchIPCRouterPolicyImpl::ShouldProcessChromeIdentityCheck() { | 58 bool SearchIPCRouterPolicyImpl::ShouldProcessChromeIdentityCheck() { |
59 return !is_incognito_ && chrome::IsInstantNTP(web_contents_); | 59 return !is_incognito_ && search::IsInstantNTP(web_contents_); |
60 } | 60 } |
61 | 61 |
62 bool SearchIPCRouterPolicyImpl::ShouldProcessHistorySyncCheck() { | 62 bool SearchIPCRouterPolicyImpl::ShouldProcessHistorySyncCheck() { |
63 return !is_incognito_ && chrome::IsInstantNTP(web_contents_); | 63 return !is_incognito_ && search::IsInstantNTP(web_contents_); |
64 } | 64 } |
65 | 65 |
66 bool SearchIPCRouterPolicyImpl::ShouldSendSetPromoInformation() { | 66 bool SearchIPCRouterPolicyImpl::ShouldSendSetPromoInformation() { |
67 return !is_incognito_ && chrome::IsInstantNTP(web_contents_); | 67 return !is_incognito_ && search::IsInstantNTP(web_contents_); |
68 } | 68 } |
69 | 69 |
70 bool SearchIPCRouterPolicyImpl::ShouldSendSetDisplayInstantResults() { | 70 bool SearchIPCRouterPolicyImpl::ShouldSendSetDisplayInstantResults() { |
71 return !is_incognito_; | 71 return !is_incognito_; |
72 } | 72 } |
73 | 73 |
74 bool SearchIPCRouterPolicyImpl::ShouldSendSetSuggestionToPrefetch() { | 74 bool SearchIPCRouterPolicyImpl::ShouldSendSetSuggestionToPrefetch() { |
75 return !is_incognito_; | 75 return !is_incognito_; |
76 } | 76 } |
77 | 77 |
78 bool SearchIPCRouterPolicyImpl::ShouldSendSetOmniboxStartMargin() { | 78 bool SearchIPCRouterPolicyImpl::ShouldSendSetOmniboxStartMargin() { |
79 return true; | 79 return true; |
80 } | 80 } |
81 | 81 |
82 bool SearchIPCRouterPolicyImpl::ShouldSendSetInputInProgress( | 82 bool SearchIPCRouterPolicyImpl::ShouldSendSetInputInProgress( |
83 bool is_active_tab) { | 83 bool is_active_tab) { |
84 return is_active_tab && !is_incognito_; | 84 return is_active_tab && !is_incognito_; |
85 } | 85 } |
86 | 86 |
87 bool SearchIPCRouterPolicyImpl::ShouldSendOmniboxFocusChanged() { | 87 bool SearchIPCRouterPolicyImpl::ShouldSendOmniboxFocusChanged() { |
88 return !is_incognito_; | 88 return !is_incognito_; |
89 } | 89 } |
90 | 90 |
91 bool SearchIPCRouterPolicyImpl::ShouldSendMostVisitedItems() { | 91 bool SearchIPCRouterPolicyImpl::ShouldSendMostVisitedItems() { |
92 return !is_incognito_ && chrome::IsInstantNTP(web_contents_); | 92 return !is_incognito_ && search::IsInstantNTP(web_contents_); |
93 } | 93 } |
94 | 94 |
95 bool SearchIPCRouterPolicyImpl::ShouldSendThemeBackgroundInfo() { | 95 bool SearchIPCRouterPolicyImpl::ShouldSendThemeBackgroundInfo() { |
96 return !is_incognito_ && chrome::IsInstantNTP(web_contents_); | 96 return !is_incognito_ && search::IsInstantNTP(web_contents_); |
97 } | 97 } |
98 | 98 |
99 bool SearchIPCRouterPolicyImpl::ShouldSendToggleVoiceSearch() { | 99 bool SearchIPCRouterPolicyImpl::ShouldSendToggleVoiceSearch() { |
100 return true; | 100 return true; |
101 } | 101 } |
102 | 102 |
103 bool SearchIPCRouterPolicyImpl::ShouldSubmitQuery() { | 103 bool SearchIPCRouterPolicyImpl::ShouldSubmitQuery() { |
104 return true; | 104 return true; |
105 } | 105 } |
OLD | NEW |