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

Side by Side 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, 2 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
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/renderer/searchbox/search_bouncer.h"
6
7 #include "chrome/common/render_messages.h"
8 #include "chrome/common/search_urls.h"
9 #include "content/public/renderer/render_process_observer.h"
10 #include "ipc/ipc_message_macros.h"
11
12 SearchBouncer::SearchBouncer() {
13 }
14
15 SearchBouncer::~SearchBouncer() {
16 }
17
18 bool SearchBouncer::ShouldFork(const GURL& url) const {
19 if (!url.is_valid())
20 return false;
21 for (std::vector<GURL>::const_iterator it = search_urls_.begin();
22 it != search_urls_.end(); ++it) {
23 if (search::MatchesOriginAndPath(url, *it)) {
24 return true;
25 }
26 }
27 return IsNewTabPage(url);
28 }
29
30 bool SearchBouncer::IsNewTabPage(const GURL& url) const {
31 return url.is_valid() && url == new_tab_page_url_;
32 }
33
34 bool SearchBouncer::OnControlMessageReceived(const IPC::Message& message) {
35 bool handled = true;
36 IPC_BEGIN_MESSAGE_MAP(SearchBouncer, message)
37 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetSearchURLs, OnSetSearchURLs)
38 IPC_MESSAGE_UNHANDLED(handled = false)
39 IPC_END_MESSAGE_MAP()
40
41 return handled;
42 }
43
44 void SearchBouncer::OnSetSearchURLs(
45 std::vector<GURL> search_urls,
46 GURL new_tab_page_url) {
47 search_urls_ = search_urls;
48 new_tab_page_url_ = new_tab_page_url;
49 }
OLDNEW
« 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