Chromium Code Reviews| 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 | 7 |
| 8 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 8 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
| 9 #include "chrome/browser/ui/find_bar/find_notification_details.h" | 9 #include "chrome/browser/ui/find_bar/find_notification_details.h" |
| 10 #include "content/public/browser/web_contents_observer.h" | 10 #include "content/public/browser/web_contents_observer.h" |
| 11 | 11 |
| 12 namespace gfx { | |
| 13 class RectF; | |
| 14 } | |
| 15 | |
| 12 // Per-tab find manager. Handles dealing with the life cycle of find sessions. | 16 // Per-tab find manager. Handles dealing with the life cycle of find sessions. |
| 13 class FindTabHelper : public content::WebContentsObserver { | 17 class FindTabHelper : public content::WebContentsObserver { |
| 14 public: | 18 public: |
| 15 explicit FindTabHelper(content::WebContents* web_contents); | 19 explicit FindTabHelper(content::WebContents* web_contents); |
| 16 virtual ~FindTabHelper(); | 20 virtual ~FindTabHelper(); |
| 17 | 21 |
| 18 // Starts the Find operation by calling StartFinding on the Tab. This function | 22 // Starts the Find operation by calling StartFinding on the Tab. This function |
| 19 // can be called from the outside as a result of hot-keys, so it uses the | 23 // can be called from the outside as a result of hot-keys, so it uses the |
| 20 // last remembered search string as specified with set_find_string(). This | 24 // last remembered search string as specified with set_find_string(). This |
| 21 // function does not block while a search is in progress. The controller will | 25 // function does not block while a search is in progress. The controller will |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 50 string16 find_text() const { return find_text_; } | 54 string16 find_text() const { return find_text_; } |
| 51 | 55 |
| 52 // Accessor for the previous search we issued. | 56 // Accessor for the previous search we issued. |
| 53 string16 previous_find_text() const { return previous_find_text_; } | 57 string16 previous_find_text() const { return previous_find_text_; } |
| 54 | 58 |
| 55 // Accessor for find_result_. | 59 // Accessor for find_result_. |
| 56 const FindNotificationDetails& find_result() const { | 60 const FindNotificationDetails& find_result() const { |
| 57 return last_search_result_; | 61 return last_search_result_; |
| 58 } | 62 } |
| 59 | 63 |
| 64 #if defined(OS_ANDROID) | |
| 65 // Selects and zooms to the find result nearest to the point (x,y) | |
| 66 // defined in find-in-page coordinates. | |
| 67 void ActivateNearestFindResult(float x, float y); | |
| 68 | |
| 69 // Asks the renderer to send the rects of the current find matches. | |
| 70 void RequestFindMatchRects(int current_version); | |
| 71 | |
| 72 void HandleGetFindMatchRectsReply(int version, | |
|
jam
2012/09/04 16:39:09
it seems very unnecessary that chrome_web_contents
Leandro GraciĆ” Gil
2012/09/04 18:25:50
This was done this way in order to get a symmetric
| |
| 73 const std::vector<gfx::RectF>& rects, | |
| 74 const gfx::RectF& active_rect); | |
| 75 #endif | |
| 76 | |
| 60 void HandleFindReply(int request_id, | 77 void HandleFindReply(int request_id, |
| 61 int number_of_matches, | 78 int number_of_matches, |
| 62 const gfx::Rect& selection_rect, | 79 const gfx::Rect& selection_rect, |
| 63 int active_match_ordinal, | 80 int active_match_ordinal, |
| 64 bool final_update); | 81 bool final_update); |
| 65 | 82 |
| 66 private: | 83 private: |
| 67 // Each time a search request comes in we assign it an id before passing it | 84 // Each time a search request comes in we assign it an id before passing it |
| 68 // over the IPC so that when the results come in we can evaluate whether we | 85 // over the IPC so that when the results come in we can evaluate whether we |
| 69 // still care about the results of the search (in some cases we don't because | 86 // still care about the results of the search (in some cases we don't because |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 96 | 113 |
| 97 // The last find result. This object contains details about the number of | 114 // The last find result. This object contains details about the number of |
| 98 // matches, the find selection rectangle, etc. The UI can access this | 115 // matches, the find selection rectangle, etc. The UI can access this |
| 99 // information to build its presentation. | 116 // information to build its presentation. |
| 100 FindNotificationDetails last_search_result_; | 117 FindNotificationDetails last_search_result_; |
| 101 | 118 |
| 102 DISALLOW_COPY_AND_ASSIGN(FindTabHelper); | 119 DISALLOW_COPY_AND_ASSIGN(FindTabHelper); |
| 103 }; | 120 }; |
| 104 | 121 |
| 105 #endif // CHROME_BROWSER_UI_FIND_BAR_FIND_TAB_HELPER_H_ | 122 #endif // CHROME_BROWSER_UI_FIND_BAR_FIND_TAB_HELPER_H_ |
| OLD | NEW |