OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 26 matching lines...) Expand all Loading... |
37 InstantSizeUnits units); | 37 InstantSizeUnits units); |
38 | 38 |
39 bool is_focused() const { return is_focused_; } | 39 bool is_focused() const { return is_focused_; } |
40 const string16& query() const { return query_; } | 40 const string16& query() const { return query_; } |
41 bool verbatim() const { return verbatim_; } | 41 bool verbatim() const { return verbatim_; } |
42 size_t selection_start() const { return selection_start_; } | 42 size_t selection_start() const { return selection_start_; } |
43 size_t selection_end() const { return selection_end_; } | 43 size_t selection_end() const { return selection_end_; } |
44 int results_base() const { return results_base_; } | 44 int results_base() const { return results_base_; } |
45 bool active_tab_is_ntp() const { return active_tab_is_ntp_; } | 45 bool active_tab_is_ntp() const { return active_tab_is_ntp_; } |
46 | 46 |
47 gfx::Rect GetRect(); | 47 // Returns the bounds of the Omnibox in screen coordinates. |
| 48 gfx::Rect GetOmniboxBounds(); |
| 49 |
| 50 // Returns the bounds of the Searchbox popup in screen coordinates. |
| 51 gfx::Rect GetPopupBounds(); |
| 52 |
48 const std::vector<InstantAutocompleteResult>& GetAutocompleteResults(); | 53 const std::vector<InstantAutocompleteResult>& GetAutocompleteResults(); |
49 // Searchbox retains ownership of this object. | 54 // Searchbox retains ownership of this object. |
50 const InstantAutocompleteResult* | 55 const InstantAutocompleteResult* |
51 GetAutocompleteResultWithId(size_t restricted_id) const; | 56 GetAutocompleteResultWithId(size_t restricted_id) const; |
52 | 57 |
53 private: | 58 private: |
54 // RenderViewObserver implementation. | 59 // RenderViewObserver implementation. |
55 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 60 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
56 | 61 |
57 void OnChange(const string16& query, | 62 void OnChange(const string16& query, |
58 bool verbatim, | 63 bool verbatim, |
59 size_t selection_start, | 64 size_t selection_start, |
60 size_t selection_end); | 65 size_t selection_end); |
61 void OnSubmit(const string16& query); | 66 void OnSubmit(const string16& query); |
62 void OnCancel(const string16& query); | 67 void OnCancel(const string16& query); |
63 void OnResize(const gfx::Rect& bounds); | 68 void OnPopupResize(const gfx::Rect& bounds); |
| 69 void OnOmniboxResize(const gfx::Rect& bounds); |
64 void OnDetermineIfPageSupportsInstant(); | 70 void OnDetermineIfPageSupportsInstant(); |
65 void OnAutocompleteResults( | 71 void OnAutocompleteResults( |
66 const std::vector<InstantAutocompleteResult>& results); | 72 const std::vector<InstantAutocompleteResult>& results); |
67 void OnUpOrDownKeyPressed(int count); | 73 void OnUpOrDownKeyPressed(int count); |
68 void OnFocus(); | 74 void OnFocus(); |
69 void OnBlur(); | 75 void OnBlur(); |
70 void OnActiveTabModeChanged(bool active_tab_is_ntp); | 76 void OnActiveTabModeChanged(bool active_tab_is_ntp); |
| 77 gfx::Rect GetZoomedBounds(const gfx::Rect); |
71 | 78 |
72 // Sets the searchbox values to their initial value. | 79 // Sets the searchbox values to their initial value. |
73 void Reset(); | 80 void Reset(); |
74 | 81 |
75 string16 query_; | 82 string16 query_; |
76 bool verbatim_; | 83 bool verbatim_; |
77 size_t selection_start_; | 84 size_t selection_start_; |
78 size_t selection_end_; | 85 size_t selection_end_; |
79 size_t results_base_; | 86 size_t results_base_; |
80 gfx::Rect rect_; | 87 gfx::Rect omnibox_bounds_; |
| 88 gfx::Rect popup_bounds_; |
81 std::vector<InstantAutocompleteResult> autocomplete_results_; | 89 std::vector<InstantAutocompleteResult> autocomplete_results_; |
82 size_t last_results_base_; | 90 size_t last_results_base_; |
83 std::vector<InstantAutocompleteResult> last_autocomplete_results_; | 91 std::vector<InstantAutocompleteResult> last_autocomplete_results_; |
84 bool is_focused_; | 92 bool is_focused_; |
85 bool active_tab_is_ntp_; | 93 bool active_tab_is_ntp_; |
86 | 94 |
87 DISALLOW_COPY_AND_ASSIGN(SearchBox); | 95 DISALLOW_COPY_AND_ASSIGN(SearchBox); |
88 }; | 96 }; |
89 | 97 |
90 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ | 98 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ |
OLD | NEW |