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