OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_RENDERER_SEARCHBOX_SEARCHBOX_H_ | 5 #ifndef CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ |
6 #define CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ | 6 #define CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 void StopCapturingKeyStrokes(); | 40 void StopCapturingKeyStrokes(); |
41 | 41 |
42 const string16& query() const { return query_; } | 42 const string16& query() const { return query_; } |
43 bool verbatim() const { return verbatim_; } | 43 bool verbatim() const { return verbatim_; } |
44 size_t selection_start() const { return selection_start_; } | 44 size_t selection_start() const { return selection_start_; } |
45 size_t selection_end() const { return selection_end_; } | 45 size_t selection_end() const { return selection_end_; } |
46 int results_base() const { return results_base_; } | 46 int results_base() const { return results_base_; } |
47 const chrome::search::Mode& mode() const { return mode_; } | 47 const chrome::search::Mode& mode() const { return mode_; } |
48 bool display_instant_results() const { return display_instant_results_; } | 48 bool display_instant_results() const { return display_instant_results_; } |
49 | 49 |
50 gfx::Rect GetRect(); | 50 // These functions return the start/end margins of the page text area, |
| 51 // adjusted for the page zoom. |
| 52 int GetStartMargin() const; |
| 53 int GetEndMargin() const; |
| 54 |
| 55 // Returns the bounds of the omnibox popup in screen coordinates. |
| 56 gfx::Rect GetPopupBounds() const; |
| 57 |
51 const std::vector<InstantAutocompleteResult>& GetAutocompleteResults(); | 58 const std::vector<InstantAutocompleteResult>& GetAutocompleteResults(); |
52 // Searchbox retains ownership of this object. | 59 // Searchbox retains ownership of this object. |
53 const InstantAutocompleteResult* | 60 const InstantAutocompleteResult* |
54 GetAutocompleteResultWithId(size_t restricted_id) const; | 61 GetAutocompleteResultWithId(size_t restricted_id) const; |
55 const ThemeBackgroundInfo& GetThemeBackgroundInfo(); | 62 const ThemeBackgroundInfo& GetThemeBackgroundInfo(); |
56 int GetThemeAreaHeight(); | 63 int GetThemeAreaHeight(); |
57 | 64 |
58 private: | 65 private: |
59 // Overridden from content::RenderViewObserver: | 66 // Overridden from content::RenderViewObserver: |
60 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 67 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
61 | 68 |
62 void OnChange(const string16& query, | 69 void OnChange(const string16& query, |
63 bool verbatim, | 70 bool verbatim, |
64 size_t selection_start, | 71 size_t selection_start, |
65 size_t selection_end); | 72 size_t selection_end); |
66 void OnSubmit(const string16& query); | 73 void OnSubmit(const string16& query); |
67 void OnCancel(const string16& query); | 74 void OnCancel(const string16& query); |
68 void OnResize(const gfx::Rect& bounds); | 75 void OnPopupResize(const gfx::Rect& bounds); |
| 76 void OnMarginChange(int start, int end); |
69 void OnDetermineIfPageSupportsInstant(); | 77 void OnDetermineIfPageSupportsInstant(); |
70 void OnAutocompleteResults( | 78 void OnAutocompleteResults( |
71 const std::vector<InstantAutocompleteResult>& results); | 79 const std::vector<InstantAutocompleteResult>& results); |
72 void OnUpOrDownKeyPressed(int count); | 80 void OnUpOrDownKeyPressed(int count); |
73 void OnModeChanged(const chrome::search::Mode& mode); | 81 void OnModeChanged(const chrome::search::Mode& mode); |
74 void OnSetDisplayInstantResults(bool display_instant_results); | 82 void OnSetDisplayInstantResults(bool display_instant_results); |
75 void OnThemeChanged(const ThemeBackgroundInfo& theme_info); | 83 void OnThemeChanged(const ThemeBackgroundInfo& theme_info); |
76 void OnThemeAreaHeightChanged(int height); | 84 void OnThemeAreaHeightChanged(int height); |
77 | 85 |
| 86 // Returns the current zoom factor of the render view or 1 on failure. |
| 87 double GetZoom() const; |
| 88 |
78 // Sets the searchbox values to their initial value. | 89 // Sets the searchbox values to their initial value. |
79 void Reset(); | 90 void Reset(); |
80 | 91 |
81 string16 query_; | 92 string16 query_; |
82 bool verbatim_; | 93 bool verbatim_; |
83 size_t selection_start_; | 94 size_t selection_start_; |
84 size_t selection_end_; | 95 size_t selection_end_; |
85 size_t results_base_; | 96 size_t results_base_; |
86 gfx::Rect rect_; | 97 int start_margin_; |
| 98 int end_margin_; |
| 99 gfx::Rect popup_bounds_; |
87 std::vector<InstantAutocompleteResult> autocomplete_results_; | 100 std::vector<InstantAutocompleteResult> autocomplete_results_; |
88 size_t last_results_base_; | 101 size_t last_results_base_; |
89 std::vector<InstantAutocompleteResult> last_autocomplete_results_; | 102 std::vector<InstantAutocompleteResult> last_autocomplete_results_; |
90 chrome::search::Mode mode_; | 103 chrome::search::Mode mode_; |
91 ThemeBackgroundInfo theme_info_; | 104 ThemeBackgroundInfo theme_info_; |
92 int theme_area_height_; | 105 int theme_area_height_; |
93 bool display_instant_results_; | 106 bool display_instant_results_; |
94 | 107 |
95 DISALLOW_COPY_AND_ASSIGN(SearchBox); | 108 DISALLOW_COPY_AND_ASSIGN(SearchBox); |
96 }; | 109 }; |
97 | 110 |
98 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ | 111 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ |
OLD | NEW |