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

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: Sync Created 7 years, 10 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 const string16& query() const { return query_; } 46 const string16& query() const { return query_; }
47 bool verbatim() const { return verbatim_; } 47 bool verbatim() const { return verbatim_; }
48 size_t selection_start() const { return selection_start_; } 48 size_t selection_start() const { return selection_start_; }
49 size_t selection_end() const { return selection_end_; } 49 size_t selection_end() const { return selection_end_; }
50 int results_base() const { return results_base_; } 50 int results_base() const { return results_base_; }
51 bool is_key_capture_enabled() const { return is_key_capture_enabled_; } 51 bool is_key_capture_enabled() const { return is_key_capture_enabled_; }
52 bool display_instant_results() const { return display_instant_results_; } 52 bool display_instant_results() const { return display_instant_results_; }
53 const string16& omnibox_font() const { return omnibox_font_; } 53 const string16& omnibox_font() const { return omnibox_font_; }
54 size_t omnibox_font_size() const { return omnibox_font_size_; } 54 size_t omnibox_font_size() const { return omnibox_font_size_; }
55 55
56 // These functions return the start/end margins of the page text area, 56 // In extended Instant, returns the start-edge margin of the location bar in
57 // adjusted for the page zoom. 57 // screen pixels.
58 int GetStartMargin() const; 58 int GetStartMargin() const;
59 int GetEndMargin() const;
60 59
61 // Returns the bounds of the omnibox popup in screen coordinates. 60 // Returns the bounds of the omnibox popup in screen coordinates.
62 gfx::Rect GetPopupBounds() const; 61 gfx::Rect GetPopupBounds() const;
63 62
64 const std::vector<InstantAutocompleteResult>& GetAutocompleteResults(); 63 const std::vector<InstantAutocompleteResult>& GetAutocompleteResults();
65 // Searchbox retains ownership of this object. 64 // Searchbox retains ownership of this object.
66 const InstantAutocompleteResult* 65 const InstantAutocompleteResult*
67 GetAutocompleteResultWithId(size_t restricted_id) const; 66 GetAutocompleteResultWithId(size_t restricted_id) const;
68 const ThemeBackgroundInfo& GetThemeBackgroundInfo(); 67 const ThemeBackgroundInfo& GetThemeBackgroundInfo();
69 68
70 private: 69 private:
71 // Overridden from content::RenderViewObserver: 70 // Overridden from content::RenderViewObserver:
72 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 71 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
73 virtual void DidClearWindowObject(WebKit::WebFrame* frame) OVERRIDE; 72 virtual void DidClearWindowObject(WebKit::WebFrame* frame) OVERRIDE;
74 73
75 void OnChange(const string16& query, 74 void OnChange(const string16& query,
76 bool verbatim, 75 bool verbatim,
77 size_t selection_start, 76 size_t selection_start,
78 size_t selection_end); 77 size_t selection_end);
79 void OnSubmit(const string16& query); 78 void OnSubmit(const string16& query);
80 void OnCancel(const string16& query); 79 void OnCancel(const string16& query);
81 void OnPopupResize(const gfx::Rect& bounds); 80 void OnPopupResize(const gfx::Rect& bounds);
82 void OnMarginChange(int start, int end); 81 void OnMarginChange(int margin, int width);
83 void OnDetermineIfPageSupportsInstant(); 82 void OnDetermineIfPageSupportsInstant();
84 void OnAutocompleteResults( 83 void OnAutocompleteResults(
85 const std::vector<InstantAutocompleteResult>& results); 84 const std::vector<InstantAutocompleteResult>& results);
86 void OnUpOrDownKeyPressed(int count); 85 void OnUpOrDownKeyPressed(int count);
87 void OnCancelSelection(const string16& query); 86 void OnCancelSelection(const string16& query);
88 void OnKeyCaptureChange(bool is_key_capture_enabled); 87 void OnKeyCaptureChange(bool is_key_capture_enabled);
89 void OnSetDisplayInstantResults(bool display_instant_results); 88 void OnSetDisplayInstantResults(bool display_instant_results);
90 void OnThemeChanged(const ThemeBackgroundInfo& theme_info); 89 void OnThemeChanged(const ThemeBackgroundInfo& theme_info);
91 void OnThemeAreaHeightChanged(int height); 90 void OnThemeAreaHeightChanged(int height);
92 void OnFontInformationReceived(const string16& omnibox_font, 91 void OnFontInformationReceived(const string16& omnibox_font,
93 size_t omnibox_font_size); 92 size_t omnibox_font_size);
94 93
95 // Returns the current zoom factor of the render view or 1 on failure. 94 // Returns the current zoom factor of the render view or 1 on failure.
96 double GetZoom() const; 95 double GetZoom() const;
97 96
98 // Sets the searchbox values to their initial value. 97 // Sets the searchbox values to their initial value.
99 void Reset(); 98 void Reset();
100 99
101 string16 query_; 100 string16 query_;
102 bool verbatim_; 101 bool verbatim_;
103 size_t selection_start_; 102 size_t selection_start_;
104 size_t selection_end_; 103 size_t selection_end_;
105 size_t results_base_; 104 size_t results_base_;
106 int start_margin_; 105 int start_margin_;
107 int end_margin_;
108 gfx::Rect popup_bounds_; 106 gfx::Rect popup_bounds_;
109 std::vector<InstantAutocompleteResult> autocomplete_results_; 107 std::vector<InstantAutocompleteResult> autocomplete_results_;
110 size_t last_results_base_; 108 size_t last_results_base_;
111 std::vector<InstantAutocompleteResult> last_autocomplete_results_; 109 std::vector<InstantAutocompleteResult> last_autocomplete_results_;
112 bool is_key_capture_enabled_; 110 bool is_key_capture_enabled_;
113 ThemeBackgroundInfo theme_info_; 111 ThemeBackgroundInfo theme_info_;
114 bool display_instant_results_; 112 bool display_instant_results_;
115 string16 omnibox_font_; 113 string16 omnibox_font_;
116 size_t omnibox_font_size_; 114 size_t omnibox_font_size_;
117 115
118 DISALLOW_COPY_AND_ASSIGN(SearchBox); 116 DISALLOW_COPY_AND_ASSIGN(SearchBox);
119 }; 117 };
120 118
121 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ 119 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698