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

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

Issue 2485783002: PlzNavigate: send searchable form data to the browser side on form submission. (Closed)
Patch Set: rebase&resolve Created 4 years, 1 month 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
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 9304c7d91e77e1ea6b8741828cc68d2be024aca0..6ac56a4a2a3aa241b8751d45311af8d5d32b5754 100644
--- a/chrome/browser/ui/search_engines/search_engine_tab_helper.cc
+++ b/chrome/browser/ui/search_engines/search_engine_tab_helper.cc
@@ -18,10 +18,10 @@
#include "content/public/browser/favicon_status.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
+#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
-#include "content/public/common/frame_navigate_params.h"
#include "content/public/common/url_fetcher.h"
using content::NavigationController;
@@ -83,10 +83,9 @@ void AssociateURLFetcherWithWebContents(content::WebContents* web_contents,
SearchEngineTabHelper::~SearchEngineTabHelper() {
}
-void SearchEngineTabHelper::DidNavigateMainFrame(
- const content::LoadCommittedDetails& /*details*/,
- const content::FrameNavigateParams& params) {
- GenerateKeywordIfNecessary(params);
+void SearchEngineTabHelper::DidFinishNavigation(
+ content::NavigationHandle* handle) {
+ GenerateKeywordIfNecessary(handle);
}
bool SearchEngineTabHelper::OnMessageReceived(const IPC::Message& message) {
@@ -156,8 +155,8 @@ void SearchEngineTabHelper::OnPageHasOSDD(
}
void SearchEngineTabHelper::GenerateKeywordIfNecessary(
- const content::FrameNavigateParams& params) {
- if (!params.searchable_form_url.is_valid())
+ content::NavigationHandle* handle) {
+ if (!handle->IsInMainFrame() || !handle->GetSearchableFormURL().is_valid())
return;
Profile* profile =
@@ -190,7 +189,7 @@ void SearchEngineTabHelper::GenerateKeywordIfNecessary(
}
TemplateURL* current_url;
- GURL url = params.searchable_form_url;
+ GURL url = handle->GetSearchableFormURL();
if (!url_service->CanAddAutogeneratedKeyword(keyword, url, &current_url))
return;
@@ -215,9 +214,11 @@ void SearchEngineTabHelper::GenerateKeywordIfNecessary(
// latter.
// TODO(sky): Need a way to set the favicon that doesn't involve generating
// its url.
- data.favicon_url = current_favicon.is_valid() ?
- current_favicon : TemplateURL::GenerateFaviconURL(params.referrer.url);
+ data.favicon_url =
+ current_favicon.is_valid()
+ ? current_favicon
+ : TemplateURL::GenerateFaviconURL(handle->GetReferrer().url);
data.safe_for_autoreplace = true;
- data.input_encodings.push_back(params.searchable_form_encoding);
+ data.input_encodings.push_back(handle->GetSearchableFormEncoding());
url_service->Add(base::MakeUnique<TemplateURL>(data));
}
« no previous file with comments | « chrome/browser/ui/search_engines/search_engine_tab_helper.h ('k') | content/browser/frame_host/navigation_handle_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698