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

Unified Diff: chrome/browser/tab_contents/tab_contents.cc

Issue 3142029: Remove sync handling of IsSearchProviderInstalled on the browser UI thread. (Closed)
Patch Set: Created 10 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/tab_contents.cc
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index b6ff1d6bf6dbe8ab01891d139b1fc51ecb2bfe48..720f7e9bbbdea5fb26b58fb1590ac888dd673364 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -2796,60 +2796,6 @@ void TabContents::PageHasOSDD(RenderViewHost* render_view_host,
autodetected);
}
-// Indicates if the two inputs have the same security origin.
-// |requested_origin| should only be a security origin (no path, etc.).
-// It is ok if |template_url| is NULL.
-static bool IsSameOrigin(const GURL& requested_origin,
- const TemplateURL* template_url) {
- DCHECK(requested_origin == requested_origin.GetOrigin());
- return template_url && requested_origin ==
- TemplateURLModel::GenerateSearchURL(template_url).GetOrigin();
-}
-
-ViewHostMsg_GetSearchProviderInstallState_Params
- TabContents::GetSearchProviderInstallState(const GURL& requested_host) {
- // Get the last committed entry since that is the page executing the
- // javascript as opposed to a page being navigated to. We don't want
- // to trust the page to tell us the url to avoid using potentially
- // compromised information.
- NavigationEntry* entry = controller_.GetLastCommittedEntry();
- GURL page_origin = entry ? entry->virtual_url().GetOrigin() : GURL();
- GURL requested_origin = requested_host.GetOrigin();
- // Do the security check before any others to avoid information leaks.
- if (page_origin != requested_origin)
- return ViewHostMsg_GetSearchProviderInstallState_Params::Denied();
-
- // In incognito mode, no search information is exposed. (This check must be
- // done after the security check or else a web site can detect that the
- // user is in incognito mode just by doing a cross origin request.)
- if (profile()->IsOffTheRecord())
- return ViewHostMsg_GetSearchProviderInstallState_Params::NotInstalled();
-
- TemplateURLModel* url_model = profile()->GetTemplateURLModel();
- if (!url_model)
- return ViewHostMsg_GetSearchProviderInstallState_Params::NotInstalled();
- if (!url_model->loaded())
- url_model->Load();
-
- // First check to see if the url is the default search provider.
- if (IsSameOrigin(requested_origin, url_model->GetDefaultSearchProvider())) {
- return ViewHostMsg_GetSearchProviderInstallState_Params::
- InstalledAsDefault();
- }
-
- // Is the url any search provider?
- std::vector<const TemplateURL*> urls = url_model->GetTemplateURLs();
- for (std::vector<const TemplateURL*>::iterator i = urls.begin();
- i != urls.end(); ++i) {
- const TemplateURL* template_url = (*i);
- if (IsSameOrigin(requested_origin, template_url)) {
- return ViewHostMsg_GetSearchProviderInstallState_Params::
- InstallButNotDefault();
- }
- }
- return ViewHostMsg_GetSearchProviderInstallState_Params::NotInstalled();
-}
-
GURL TabContents::GetAlternateErrorPageURL() const {
GURL url;
// Disable alternate error pages when in OffTheRecord/Incognito mode.
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698