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

Side by Side Diff: chrome/browser/ui/find_bar/find_tab_helper.cc

Issue 7828025: Handle the ViewHostMsg_FindReply message which is sent by content(renderer) via the TabContentsDe... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/find_bar/find_tab_helper.h" 5 #include "chrome/browser/ui/find_bar/find_tab_helper.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/find_bar/find_bar_state.h" 10 #include "chrome/browser/ui/find_bar/find_bar_state.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 params.action = ViewMsg_StopFinding_Params::kActivateSelection; 117 params.action = ViewMsg_StopFinding_Params::kActivateSelection;
118 break; 118 break;
119 default: 119 default:
120 NOTREACHED(); 120 NOTREACHED();
121 params.action = ViewMsg_StopFinding_Params::kKeepSelection; 121 params.action = ViewMsg_StopFinding_Params::kKeepSelection;
122 } 122 }
123 tab_contents()->render_view_host()->Send(new ViewMsg_StopFinding( 123 tab_contents()->render_view_host()->Send(new ViewMsg_StopFinding(
124 tab_contents()->render_view_host()->routing_id(), params)); 124 tab_contents()->render_view_host()->routing_id(), params));
125 } 125 }
126 126
127 bool FindTabHelper::OnMessageReceived(const IPC::Message& message) { 127 void FindTabHelper::HandleFindReply(int request_id,
128 bool handled = true; 128 int number_of_matches,
129 IPC_BEGIN_MESSAGE_MAP(FindTabHelper, message) 129 const gfx::Rect& selection_rect,
130 IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply) 130 int active_match_ordinal,
131 IPC_MESSAGE_UNHANDLED(handled = false) 131 bool final_update) {
132 IPC_END_MESSAGE_MAP()
133 return handled;
134 }
135
136 void FindTabHelper::OnFindReply(int request_id,
137 int number_of_matches,
138 const gfx::Rect& selection_rect,
139 int active_match_ordinal,
140 bool final_update) {
141 // Ignore responses for requests that have been aborted. 132 // Ignore responses for requests that have been aborted.
142 // Ignore responses for requests other than the one we have most recently 133 // Ignore responses for requests other than the one we have most recently
143 // issued. That way we won't act on stale results when the user has 134 // issued. That way we won't act on stale results when the user has
144 // already typed in another query. 135 // already typed in another query.
145 if (!find_op_aborted_ && request_id == current_find_request_id_) { 136 if (!find_op_aborted_ && request_id == current_find_request_id_) {
146 if (number_of_matches == -1) 137 if (number_of_matches == -1)
147 number_of_matches = last_search_result_.number_of_matches(); 138 number_of_matches = last_search_result_.number_of_matches();
148 if (active_match_ordinal == -1) 139 if (active_match_ordinal == -1)
149 active_match_ordinal = last_search_result_.active_match_ordinal(); 140 active_match_ordinal = last_search_result_.active_match_ordinal();
150 141
(...skipping 13 matching lines...) Expand all
164 } 155 }
165 156
166 // Send a notification to the renderer that we are ready to receive more 157 // Send a notification to the renderer that we are ready to receive more
167 // results from the scoping effort of the Find operation. The FindInPage 158 // results from the scoping effort of the Find operation. The FindInPage
168 // scoping is asynchronous and periodically sends results back up to the 159 // scoping is asynchronous and periodically sends results back up to the
169 // browser using IPC. In an effort to not spam the browser we have the 160 // browser using IPC. In an effort to not spam the browser we have the
170 // browser send an ACK for each FindReply message and have the renderer 161 // browser send an ACK for each FindReply message and have the renderer
171 // queue up the latest status message while waiting for this ACK. 162 // queue up the latest status message while waiting for this ACK.
172 Send(new ViewMsg_FindReplyACK(routing_id())); 163 Send(new ViewMsg_FindReplyACK(routing_id()));
173 } 164 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/find_bar/find_tab_helper.h ('k') | content/browser/tab_contents/tab_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698