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

Unified Diff: chrome/browser/ui/search_engines/search_engine_tab_helper.cc

Issue 2746293005: Migrated ChromeViewHostMsg_PageHasOSDD to Mojo. (Closed)
Patch Set: Merged with another Mojo CL. Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/search_engines/search_engine_tab_helper.h ('k') | chrome/common/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/search_engines/search_engine_tab_helper.cc
diff --git a/chrome/browser/ui/search_engines/search_engine_tab_helper.cc b/chrome/browser/ui/search_engines/search_engine_tab_helper.cc
index e9c8fd0adb29205dfb1cdceb62ef99d742019327..7c2612313d1f82481198ac1d9c02228c3404245b 100644
--- a/chrome/browser/ui/search_engines/search_engine_tab_helper.cc
+++ b/chrome/browser/ui/search_engines/search_engine_tab_helper.cc
@@ -72,8 +72,7 @@ base::string16 GenerateKeywordFromNavigationEntry(
void AssociateURLFetcherWithWebContents(content::WebContents* web_contents,
net::URLFetcher* url_fetcher) {
content::AssociateURLFetcherWithRenderFrame(
- url_fetcher,
- url::Origin(web_contents->GetURL()),
+ url_fetcher, url::Origin(web_contents->GetURL()),
web_contents->GetRenderProcessHost()->GetID(),
web_contents->GetMainFrame()->GetRoutingID());
}
@@ -88,34 +87,24 @@ void SearchEngineTabHelper::DidFinishNavigation(
GenerateKeywordIfNecessary(handle);
}
-bool SearchEngineTabHelper::OnMessageReceived(const IPC::Message& message) {
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(SearchEngineTabHelper, message)
- IPC_MESSAGE_HANDLER(ChromeViewHostMsg_PageHasOSDD, OnPageHasOSDD)
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
-
- return handled;
-}
-
-bool SearchEngineTabHelper::OnMessageReceived(
- const IPC::Message& message,
- content::RenderFrameHost* render_frame_host) {
- return OnMessageReceived(message);
-}
-
SearchEngineTabHelper::SearchEngineTabHelper(WebContents* web_contents)
- : content::WebContentsObserver(web_contents) {
+ : content::WebContentsObserver(web_contents),
+ osdd_handler_bindings_(web_contents, this) {
DCHECK(web_contents);
}
-void SearchEngineTabHelper::OnPageHasOSDD(
+void SearchEngineTabHelper::PageHasOpenSearchDescriptionDocument(
const GURL& page_url,
const GURL& osdd_url) {
// Checks to see if we should generate a keyword based on the OSDD, and if
// necessary uses TemplateURLFetcher to download the OSDD and create a
// keyword.
+ // Only accept messages from the main frame.
+ if (osdd_handler_bindings_.GetCurrentTargetFrame() !=
+ web_contents()->GetMainFrame())
+ return;
+
// Make sure that the page is the current page and other basic checks.
// When |page_url| has file: scheme, this method doesn't work because of
// http://b/issue?id=863583. For that reason, this doesn't check and allow
« no previous file with comments | « chrome/browser/ui/search_engines/search_engine_tab_helper.h ('k') | chrome/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698