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