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

Unified Diff: chrome/renderer/searchbox/search_bouncer.cc

Issue 23455047: InstantExtended: Send search URLs to renderers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More browsertest fixes Created 7 years, 3 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/renderer/searchbox/search_bouncer.h ('k') | chrome/renderer/searchbox/search_bouncer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/searchbox/search_bouncer.cc
diff --git a/chrome/renderer/searchbox/search_bouncer.cc b/chrome/renderer/searchbox/search_bouncer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8b9227b9ffb17d897ef31989dd8e028625322828
--- /dev/null
+++ b/chrome/renderer/searchbox/search_bouncer.cc
@@ -0,0 +1,49 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/renderer/searchbox/search_bouncer.h"
+
+#include "chrome/common/render_messages.h"
+#include "chrome/common/search_urls.h"
+#include "content/public/renderer/render_process_observer.h"
+#include "ipc/ipc_message_macros.h"
+
+SearchBouncer::SearchBouncer() {
+}
+
+SearchBouncer::~SearchBouncer() {
+}
+
+bool SearchBouncer::ShouldFork(const GURL& url) const {
+ if (!url.is_valid())
+ return false;
+ for (std::vector<GURL>::const_iterator it = search_urls_.begin();
+ it != search_urls_.end(); ++it) {
+ if (search::MatchesOriginAndPath(url, *it)) {
+ return true;
+ }
+ }
+ return IsNewTabPage(url);
+}
+
+bool SearchBouncer::IsNewTabPage(const GURL& url) const {
+ return url.is_valid() && url == new_tab_page_url_;
+}
+
+bool SearchBouncer::OnControlMessageReceived(const IPC::Message& message) {
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP(SearchBouncer, message)
+ IPC_MESSAGE_HANDLER(ChromeViewMsg_SetSearchURLs, OnSetSearchURLs)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP()
+
+ return handled;
+}
+
+void SearchBouncer::OnSetSearchURLs(
+ std::vector<GURL> search_urls,
+ GURL new_tab_page_url) {
+ search_urls_ = search_urls;
+ new_tab_page_url_ = new_tab_page_url;
+}
« no previous file with comments | « chrome/renderer/searchbox/search_bouncer.h ('k') | chrome/renderer/searchbox/search_bouncer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698