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

Side by Side Diff: chrome/browser/instant/search.cc

Issue 12387026: Expose getSearchTerms to tab_model for Android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased again... Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/android/tab_model/tab_model.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/instant/search.h" 5 #include "chrome/browser/instant/search.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 const content::NavigationEntry* entry) { 181 const content::NavigationEntry* entry) {
182 if (!IsQueryExtractionEnabled()) 182 if (!IsQueryExtractionEnabled())
183 return string16(); 183 return string16();
184 184
185 // For security reasons, don't extract search terms if the page is not being 185 // For security reasons, don't extract search terms if the page is not being
186 // rendered in the privileged Instant renderer process. This is to protect 186 // rendered in the privileged Instant renderer process. This is to protect
187 // against a malicious page somehow scripting the search results page and 187 // against a malicious page somehow scripting the search results page and
188 // faking search terms in the URL. Random pages can't get into the Instant 188 // faking search terms in the URL. Random pages can't get into the Instant
189 // renderer and scripting doesn't work cross-process, so if the page is in 189 // renderer and scripting doesn't work cross-process, so if the page is in
190 // the Instant process, we know it isn't being exploited. 190 // the Instant process, we know it isn't being exploited.
191 // Since iOS and Android doesn't use the instant framework, these checks are
192 // disabled for the two platforms.
191 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); 193 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
194 #if !defined(OS_IOS) && !defined(OS_ANDROID)
192 if (!IsRenderedInInstantProcess(contents, profile)) 195 if (!IsRenderedInInstantProcess(contents, profile))
193 return string16(); 196 return string16();
194 197 #endif // !defined(OS_IOS) && !defined(OS_ANDROID)
195 // Check to see if search terms have already been extracted. 198 // Check to see if search terms have already been extracted.
196 string16 search_terms = GetSearchTermsFromNavigationEntry(entry); 199 string16 search_terms = GetSearchTermsFromNavigationEntry(entry);
197 if (!search_terms.empty()) 200 if (!search_terms.empty())
198 return search_terms; 201 return search_terms;
199 202
200 // Otherwise, extract from the URL. 203 // Otherwise, extract from the URL.
201 TemplateURL* template_url = GetDefaultSearchProviderTemplateURL(profile); 204 TemplateURL* template_url = GetDefaultSearchProviderTemplateURL(profile);
202 if (!template_url) 205 if (!template_url)
203 return string16(); 206 return string16();
204 207
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 GURL::Replacements replacements; 517 GURL::Replacements replacements;
515 replacements.SetSchemeStr(search_scheme); 518 replacements.SetSchemeStr(search_scheme);
516 replacements.SetHostStr(search_host); 519 replacements.SetHostStr(search_host);
517 replacements.SetPortStr(search_port); 520 replacements.SetPortStr(search_port);
518 replacements.SetPathStr(search_path); 521 replacements.SetPathStr(search_path);
519 return instant_url.ReplaceComponents(replacements); 522 return instant_url.ReplaceComponents(replacements);
520 } 523 }
521 524
522 } // namespace search 525 } // namespace search
523 } // namespace chrome 526 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/android/tab_model/tab_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698