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 #ifndef CHROME_BROWSER_UI_FIND_BAR_FIND_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_UI_FIND_BAR_FIND_TAB_HELPER_H_ |
6 #define CHROME_BROWSER_UI_FIND_BAR_FIND_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_UI_FIND_BAR_FIND_TAB_HELPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 9 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
10 #include "chrome/browser/ui/find_bar/find_notification_details.h" | 10 #include "chrome/browser/ui/find_bar/find_notification_details.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 string16 find_text() const { return find_text_; } | 51 string16 find_text() const { return find_text_; } |
52 | 52 |
53 // Accessor for the previous search we issued. | 53 // Accessor for the previous search we issued. |
54 string16 previous_find_text() const { return previous_find_text_; } | 54 string16 previous_find_text() const { return previous_find_text_; } |
55 | 55 |
56 // Accessor for find_result_. | 56 // Accessor for find_result_. |
57 const FindNotificationDetails& find_result() const { | 57 const FindNotificationDetails& find_result() const { |
58 return last_search_result_; | 58 return last_search_result_; |
59 } | 59 } |
60 | 60 |
61 // TabContentsObserver overrides. | 61 void HandleFindReply(int request_id, |
62 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 62 int number_of_matches, |
| 63 const gfx::Rect& selection_rect, |
| 64 int active_match_ordinal, |
| 65 bool final_update); |
63 | 66 |
64 private: | 67 private: |
65 void OnFindReply(int request_id, | |
66 int number_of_matches, | |
67 const gfx::Rect& selection_rect, | |
68 int active_match_ordinal, | |
69 bool final_update); | |
70 | |
71 // Each time a search request comes in we assign it an id before passing it | 68 // Each time a search request comes in we assign it an id before passing it |
72 // over the IPC so that when the results come in we can evaluate whether we | 69 // over the IPC so that when the results come in we can evaluate whether we |
73 // still care about the results of the search (in some cases we don't because | 70 // still care about the results of the search (in some cases we don't because |
74 // the user has issued a new search). | 71 // the user has issued a new search). |
75 static int find_request_id_counter_; | 72 static int find_request_id_counter_; |
76 | 73 |
77 // True if the Find UI is active for this Tab. | 74 // True if the Find UI is active for this Tab. |
78 bool find_ui_active_; | 75 bool find_ui_active_; |
79 | 76 |
80 // True if a Find operation was aborted. This can happen if the Find box is | 77 // True if a Find operation was aborted. This can happen if the Find box is |
(...skipping 19 matching lines...) Expand all Loading... |
100 | 97 |
101 // The last find result. This object contains details about the number of | 98 // The last find result. This object contains details about the number of |
102 // matches, the find selection rectangle, etc. The UI can access this | 99 // matches, the find selection rectangle, etc. The UI can access this |
103 // information to build its presentation. | 100 // information to build its presentation. |
104 FindNotificationDetails last_search_result_; | 101 FindNotificationDetails last_search_result_; |
105 | 102 |
106 DISALLOW_COPY_AND_ASSIGN(FindTabHelper); | 103 DISALLOW_COPY_AND_ASSIGN(FindTabHelper); |
107 }; | 104 }; |
108 | 105 |
109 #endif // CHROME_BROWSER_UI_FIND_BAR_FIND_TAB_HELPER_H_ | 106 #endif // CHROME_BROWSER_UI_FIND_BAR_FIND_TAB_HELPER_H_ |
OLD | NEW |