OLD | NEW |
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" |
11 #include "content/browser/renderer_host/render_view_host.h" | 11 #include "content/browser/renderer_host/render_view_host.h" |
12 #include "content/browser/tab_contents/tab_contents.h" | 12 #include "content/browser/tab_contents/tab_contents.h" |
| 13 #include "chrome/common/chrome_notification_types.h" |
13 #include "content/common/notification_service.h" | 14 #include "content/common/notification_service.h" |
14 #include "content/common/view_messages.h" | 15 #include "content/common/view_messages.h" |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h" |
16 | 17 |
17 using WebKit::WebFindOptions; | 18 using WebKit::WebFindOptions; |
18 | 19 |
19 // static | 20 // static |
20 int FindTabHelper::find_request_id_counter_ = -1; | 21 int FindTabHelper::find_request_id_counter_ = -1; |
21 | 22 |
22 FindTabHelper::FindTabHelper(TabContents* tab_contents) | 23 FindTabHelper::FindTabHelper(TabContents* tab_contents) |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 gfx::Rect selection = selection_rect; | 147 gfx::Rect selection = selection_rect; |
147 if (selection.IsEmpty()) | 148 if (selection.IsEmpty()) |
148 selection = last_search_result_.selection_rect(); | 149 selection = last_search_result_.selection_rect(); |
149 | 150 |
150 // Notify the UI, automation and any other observers that a find result was | 151 // Notify the UI, automation and any other observers that a find result was |
151 // found. | 152 // found. |
152 last_search_result_ = FindNotificationDetails( | 153 last_search_result_ = FindNotificationDetails( |
153 request_id, number_of_matches, selection, active_match_ordinal, | 154 request_id, number_of_matches, selection, active_match_ordinal, |
154 final_update); | 155 final_update); |
155 NotificationService::current()->Notify( | 156 NotificationService::current()->Notify( |
156 NotificationType::FIND_RESULT_AVAILABLE, | 157 chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, |
157 Source<TabContents>(tab_contents()), | 158 Source<TabContents>(tab_contents()), |
158 Details<FindNotificationDetails>(&last_search_result_)); | 159 Details<FindNotificationDetails>(&last_search_result_)); |
159 } | 160 } |
160 | 161 |
161 // Send a notification to the renderer that we are ready to receive more | 162 // Send a notification to the renderer that we are ready to receive more |
162 // results from the scoping effort of the Find operation. The FindInPage | 163 // results from the scoping effort of the Find operation. The FindInPage |
163 // scoping is asynchronous and periodically sends results back up to the | 164 // scoping is asynchronous and periodically sends results back up to the |
164 // browser using IPC. In an effort to not spam the browser we have the | 165 // browser using IPC. In an effort to not spam the browser we have the |
165 // browser send an ACK for each FindReply message and have the renderer | 166 // browser send an ACK for each FindReply message and have the renderer |
166 // queue up the latest status message while waiting for this ACK. | 167 // queue up the latest status message while waiting for this ACK. |
167 Send(new ViewMsg_FindReplyACK(routing_id())); | 168 Send(new ViewMsg_FindReplyACK(routing_id())); |
168 } | 169 } |
OLD | NEW |