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::ShouldProcessFocusOmnibox(bool is_active_tab) { | 25 bool SearchIPCRouterPolicyImpl::ShouldProcessFocusOmnibox(bool is_active_tab) { |
26 return is_active_tab && !is_incognito_ && search::IsInstantNTP(web_contents_); | 26 return is_active_tab && !is_incognito_ && search::IsInstantNTP(web_contents_); |
27 } | 27 } |
28 | 28 |
29 bool SearchIPCRouterPolicyImpl::ShouldProcessNavigateToURL(bool is_active_tab) { | |
30 return is_active_tab && !is_incognito_ && search::IsInstantNTP(web_contents_); | |
31 } | |
32 | |
33 bool SearchIPCRouterPolicyImpl::ShouldProcessDeleteMostVisitedItem() { | 29 bool SearchIPCRouterPolicyImpl::ShouldProcessDeleteMostVisitedItem() { |
34 return !is_incognito_ && search::IsInstantNTP(web_contents_); | 30 return !is_incognito_ && search::IsInstantNTP(web_contents_); |
35 } | 31 } |
36 | 32 |
37 bool SearchIPCRouterPolicyImpl::ShouldProcessUndoMostVisitedDeletion() { | 33 bool SearchIPCRouterPolicyImpl::ShouldProcessUndoMostVisitedDeletion() { |
38 return !is_incognito_ && search::IsInstantNTP(web_contents_); | 34 return !is_incognito_ && search::IsInstantNTP(web_contents_); |
39 } | 35 } |
40 | 36 |
41 bool SearchIPCRouterPolicyImpl::ShouldProcessUndoAllMostVisitedDeletions() { | 37 bool SearchIPCRouterPolicyImpl::ShouldProcessUndoAllMostVisitedDeletions() { |
42 return !is_incognito_ && search::IsInstantNTP(web_contents_); | 38 return !is_incognito_ && search::IsInstantNTP(web_contents_); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 return !is_incognito_ && search::IsInstantNTP(web_contents_); | 80 return !is_incognito_ && search::IsInstantNTP(web_contents_); |
85 } | 81 } |
86 | 82 |
87 bool SearchIPCRouterPolicyImpl::ShouldSendThemeBackgroundInfo() { | 83 bool SearchIPCRouterPolicyImpl::ShouldSendThemeBackgroundInfo() { |
88 return !is_incognito_ && search::IsInstantNTP(web_contents_); | 84 return !is_incognito_ && search::IsInstantNTP(web_contents_); |
89 } | 85 } |
90 | 86 |
91 bool SearchIPCRouterPolicyImpl::ShouldSubmitQuery() { | 87 bool SearchIPCRouterPolicyImpl::ShouldSubmitQuery() { |
92 return true; | 88 return true; |
93 } | 89 } |
OLD | NEW |