Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: chrome/renderer/searchbox/searchbox.h

Issue 12047107: Change the SearchBox API from using the start/end margins of the location bar to using the start ma… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't run test on Mac & Linux Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 const string16& query() const { return query_; } 58 const string16& query() const { return query_; }
59 bool verbatim() const { return verbatim_; } 59 bool verbatim() const { return verbatim_; }
60 size_t selection_start() const { return selection_start_; } 60 size_t selection_start() const { return selection_start_; }
61 size_t selection_end() const { return selection_end_; } 61 size_t selection_end() const { return selection_end_; }
62 int results_base() const { return results_base_; } 62 int results_base() const { return results_base_; }
63 bool is_key_capture_enabled() const { return is_key_capture_enabled_; } 63 bool is_key_capture_enabled() const { return is_key_capture_enabled_; }
64 bool display_instant_results() const { return display_instant_results_; } 64 bool display_instant_results() const { return display_instant_results_; }
65 const string16& omnibox_font() const { return omnibox_font_; } 65 const string16& omnibox_font() const { return omnibox_font_; }
66 size_t omnibox_font_size() const { return omnibox_font_size_; } 66 size_t omnibox_font_size() const { return omnibox_font_size_; }
67 67
68 // These functions return the start/end margins of the page text area, 68 // In extended Instant, returns the start-edge margin of the location bar in
69 // adjusted for the page zoom. 69 // screen pixels.
70 int GetStartMargin() const; 70 int GetStartMargin() const;
71 int GetEndMargin() const;
72 71
73 // Returns the bounds of the omnibox popup in screen coordinates. 72 // Returns the bounds of the omnibox popup in screen coordinates.
74 gfx::Rect GetPopupBounds() const; 73 gfx::Rect GetPopupBounds() const;
75 74
76 const std::vector<InstantAutocompleteResult>& GetAutocompleteResults(); 75 const std::vector<InstantAutocompleteResult>& GetAutocompleteResults();
77 // Searchbox retains ownership of this object. 76 // Searchbox retains ownership of this object.
78 const InstantAutocompleteResult* 77 const InstantAutocompleteResult*
79 GetAutocompleteResultWithId(size_t restricted_id) const; 78 GetAutocompleteResultWithId(size_t restricted_id) const;
80 const ThemeBackgroundInfo& GetThemeBackgroundInfo(); 79 const ThemeBackgroundInfo& GetThemeBackgroundInfo();
81 80
(...skipping 11 matching lines...) Expand all
93 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 92 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
94 virtual void DidClearWindowObject(WebKit::WebFrame* frame) OVERRIDE; 93 virtual void DidClearWindowObject(WebKit::WebFrame* frame) OVERRIDE;
95 94
96 void OnChange(const string16& query, 95 void OnChange(const string16& query,
97 bool verbatim, 96 bool verbatim,
98 size_t selection_start, 97 size_t selection_start,
99 size_t selection_end); 98 size_t selection_end);
100 void OnSubmit(const string16& query); 99 void OnSubmit(const string16& query);
101 void OnCancel(const string16& query); 100 void OnCancel(const string16& query);
102 void OnPopupResize(const gfx::Rect& bounds); 101 void OnPopupResize(const gfx::Rect& bounds);
103 void OnMarginChange(int start, int end); 102 void OnMarginChange(int margin, int width);
104 void OnDetermineIfPageSupportsInstant(); 103 void OnDetermineIfPageSupportsInstant();
105 void OnAutocompleteResults( 104 void OnAutocompleteResults(
106 const std::vector<InstantAutocompleteResult>& results); 105 const std::vector<InstantAutocompleteResult>& results);
107 void OnUpOrDownKeyPressed(int count); 106 void OnUpOrDownKeyPressed(int count);
108 void OnCancelSelection(const string16& query); 107 void OnCancelSelection(const string16& query);
109 void OnKeyCaptureChange(bool is_key_capture_enabled); 108 void OnKeyCaptureChange(bool is_key_capture_enabled);
110 void OnSetDisplayInstantResults(bool display_instant_results); 109 void OnSetDisplayInstantResults(bool display_instant_results);
111 void OnThemeChanged(const ThemeBackgroundInfo& theme_info); 110 void OnThemeChanged(const ThemeBackgroundInfo& theme_info);
112 void OnThemeAreaHeightChanged(int height); 111 void OnThemeAreaHeightChanged(int height);
113 void OnFontInformationReceived(const string16& omnibox_font, 112 void OnFontInformationReceived(const string16& omnibox_font,
114 size_t omnibox_font_size); 113 size_t omnibox_font_size);
115 void OnMostVisitedChanged(const std::vector<MostVisitedItem>& items); 114 void OnMostVisitedChanged(const std::vector<MostVisitedItem>& items);
116 115
117 // Returns the current zoom factor of the render view or 1 on failure. 116 // Returns the current zoom factor of the render view or 1 on failure.
118 double GetZoom() const; 117 double GetZoom() const;
119 118
120 // Sets the searchbox values to their initial value. 119 // Sets the searchbox values to their initial value.
121 void Reset(); 120 void Reset();
122 121
123 string16 query_; 122 string16 query_;
124 bool verbatim_; 123 bool verbatim_;
125 size_t selection_start_; 124 size_t selection_start_;
126 size_t selection_end_; 125 size_t selection_end_;
127 size_t results_base_; 126 size_t results_base_;
128 int start_margin_; 127 int start_margin_;
129 int end_margin_;
130 gfx::Rect popup_bounds_; 128 gfx::Rect popup_bounds_;
131 std::vector<InstantAutocompleteResult> autocomplete_results_; 129 std::vector<InstantAutocompleteResult> autocomplete_results_;
132 size_t last_results_base_; 130 size_t last_results_base_;
133 std::vector<InstantAutocompleteResult> last_autocomplete_results_; 131 std::vector<InstantAutocompleteResult> last_autocomplete_results_;
134 bool is_key_capture_enabled_; 132 bool is_key_capture_enabled_;
135 ThemeBackgroundInfo theme_info_; 133 ThemeBackgroundInfo theme_info_;
136 bool display_instant_results_; 134 bool display_instant_results_;
137 string16 omnibox_font_; 135 string16 omnibox_font_;
138 size_t omnibox_font_size_; 136 size_t omnibox_font_size_;
139 std::vector<MostVisitedItem> most_visited_items_; 137 std::vector<MostVisitedItem> most_visited_items_;
140 138
141 // URL to Restricted Id mapping. 139 // URL to Restricted Id mapping.
142 // TODO(dcblack): Unify this logic to work with both Most Visited and 140 // TODO(dcblack): Unify this logic to work with both Most Visited and
143 // history suggestions. (crbug/175768) 141 // history suggestions. (crbug/175768)
144 std::map<string16, int> url_to_restricted_id_map_; 142 std::map<string16, int> url_to_restricted_id_map_;
145 std::map<int, string16> restricted_id_to_url_map_; 143 std::map<int, string16> restricted_id_to_url_map_;
146 int last_restricted_id_; 144 int last_restricted_id_;
147 145
148 DISALLOW_COPY_AND_ASSIGN(SearchBox); 146 DISALLOW_COPY_AND_ASSIGN(SearchBox);
149 }; 147 };
150 148
151 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ 149 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_
OLDNEW
« no previous file with comments | « chrome/renderer/resources/extensions/searchbox_api.js ('k') | chrome/renderer/searchbox/searchbox.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698