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 22 matching lines...) Expand all Loading... | |
33 int height, | 33 int height, |
34 InstantSizeUnits units); | 34 InstantSizeUnits units); |
35 | 35 |
36 const string16& query() const { return query_; } | 36 const string16& query() const { return query_; } |
37 bool verbatim() const { return verbatim_; } | 37 bool verbatim() const { return verbatim_; } |
38 size_t selection_start() const { return selection_start_; } | 38 size_t selection_start() const { return selection_start_; } |
39 size_t selection_end() const { return selection_end_; } | 39 size_t selection_end() const { return selection_end_; } |
40 int results_base() const { return results_base_; } | 40 int results_base() const { return results_base_; } |
41 const chrome::search::Mode& mode() const { return mode_; } | 41 const chrome::search::Mode& mode() const { return mode_; } |
42 | 42 |
43 gfx::Rect GetRect(); | 43 // These functions return the start/end margins of the page text area, |
44 // adjusted for the page zoom. | |
45 int GetStartMargin(); | |
dhollowa
2012/11/28 16:44:08
nit: const
melevin
2012/11/28 20:28:19
Done.
| |
46 int GetEndMargin(); | |
dhollowa
2012/11/28 16:44:08
nit: const
melevin
2012/11/28 20:28:19
Done.
| |
47 | |
48 // Returns the bounds of the Searchbox popup in screen coordinates. | |
49 gfx::Rect GetPopupBounds(); | |
dhollowa
2012/11/28 16:44:08
nit: const
melevin
2012/11/28 20:28:19
Done.
| |
50 | |
44 const std::vector<InstantAutocompleteResult>& GetAutocompleteResults(); | 51 const std::vector<InstantAutocompleteResult>& GetAutocompleteResults(); |
45 // Searchbox retains ownership of this object. | 52 // Searchbox retains ownership of this object. |
46 const InstantAutocompleteResult* | 53 const InstantAutocompleteResult* |
47 GetAutocompleteResultWithId(size_t restricted_id) const; | 54 GetAutocompleteResultWithId(size_t restricted_id) const; |
48 const ThemeBackgroundInfo& GetThemeBackgroundInfo(); | 55 const ThemeBackgroundInfo& GetThemeBackgroundInfo(); |
49 int GetThemeAreaHeight(); | 56 int GetThemeAreaHeight(); |
50 | 57 |
51 private: | 58 private: |
52 // Overridden from content::RenderViewObserver: | 59 // Overridden from content::RenderViewObserver: |
53 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 60 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
54 | 61 |
55 void OnChange(const string16& query, | 62 void OnChange(const string16& query, |
56 bool verbatim, | 63 bool verbatim, |
57 size_t selection_start, | 64 size_t selection_start, |
58 size_t selection_end); | 65 size_t selection_end); |
59 void OnSubmit(const string16& query); | 66 void OnSubmit(const string16& query); |
60 void OnCancel(const string16& query); | 67 void OnCancel(const string16& query); |
61 void OnResize(const gfx::Rect& bounds); | 68 void OnPopupResize(const gfx::Rect& bounds); |
69 void OnMarginChange(int start, int end); | |
62 void OnDetermineIfPageSupportsInstant(); | 70 void OnDetermineIfPageSupportsInstant(); |
63 void OnAutocompleteResults( | 71 void OnAutocompleteResults( |
64 const std::vector<InstantAutocompleteResult>& results); | 72 const std::vector<InstantAutocompleteResult>& results); |
65 void OnUpOrDownKeyPressed(int count); | 73 void OnUpOrDownKeyPressed(int count); |
66 void OnModeChanged(const chrome::search::Mode& mode); | 74 void OnModeChanged(const chrome::search::Mode& mode); |
67 void OnThemeChanged(const ThemeBackgroundInfo& theme_info); | 75 void OnThemeChanged(const ThemeBackgroundInfo& theme_info); |
68 void OnThemeAreaHeightChanged(int height); | 76 void OnThemeAreaHeightChanged(int height); |
69 | 77 |
78 // Returns the current zoom factor of the render view or 1 on failure. | |
79 double GetZoom(); | |
samarth
2012/11/28 03:51:19
nit: make this const
melevin
2012/11/28 20:28:19
I tried this originally, the compiler was not amus
dhollowa
2012/11/28 20:44:33
That's annoying, but yes, worth a try. You'll wan
melevin
2012/11/28 21:39:23
The code review tool says "jam" isn't a valid user
| |
80 | |
70 // Sets the searchbox values to their initial value. | 81 // Sets the searchbox values to their initial value. |
71 void Reset(); | 82 void Reset(); |
72 | 83 |
73 string16 query_; | 84 string16 query_; |
74 bool verbatim_; | 85 bool verbatim_; |
75 size_t selection_start_; | 86 size_t selection_start_; |
76 size_t selection_end_; | 87 size_t selection_end_; |
77 size_t results_base_; | 88 size_t results_base_; |
78 gfx::Rect rect_; | 89 int start_margin_; |
90 int end_margin_; | |
91 gfx::Rect popup_bounds_; | |
79 std::vector<InstantAutocompleteResult> autocomplete_results_; | 92 std::vector<InstantAutocompleteResult> autocomplete_results_; |
80 size_t last_results_base_; | 93 size_t last_results_base_; |
81 std::vector<InstantAutocompleteResult> last_autocomplete_results_; | 94 std::vector<InstantAutocompleteResult> last_autocomplete_results_; |
82 chrome::search::Mode mode_; | 95 chrome::search::Mode mode_; |
83 ThemeBackgroundInfo theme_info_; | 96 ThemeBackgroundInfo theme_info_; |
84 int theme_area_height_; | 97 int theme_area_height_; |
85 | 98 |
86 DISALLOW_COPY_AND_ASSIGN(SearchBox); | 99 DISALLOW_COPY_AND_ASSIGN(SearchBox); |
87 }; | 100 }; |
88 | 101 |
89 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ | 102 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ |
OLD | NEW |