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

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

Issue 11413217: Instant API: tell page whether the browser is capturing key strokes. (Closed) Base URL: http://git.chromium.org/chromium/src.git@focus
Patch Set: Fix js error. Created 8 years 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
OLDNEW
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 #include "chrome/renderer/searchbox/searchbox.h" 5 #include "chrome/renderer/searchbox/searchbox.h"
6 6
7 #include "chrome/common/render_messages.h" 7 #include "chrome/common/render_messages.h"
8 #include "chrome/renderer/searchbox/searchbox_extension.h" 8 #include "chrome/renderer/searchbox/searchbox_extension.h"
9 #include "content/public/renderer/render_view.h" 9 #include "content/public/renderer/render_view.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxChange, OnChange) 102 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxChange, OnChange)
103 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSubmit, OnSubmit) 103 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSubmit, OnSubmit)
104 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxCancel, OnCancel) 104 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxCancel, OnCancel)
105 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxResize, OnResize) 105 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxResize, OnResize)
106 IPC_MESSAGE_HANDLER(ChromeViewMsg_DetermineIfPageSupportsInstant, 106 IPC_MESSAGE_HANDLER(ChromeViewMsg_DetermineIfPageSupportsInstant,
107 OnDetermineIfPageSupportsInstant) 107 OnDetermineIfPageSupportsInstant)
108 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxAutocompleteResults, 108 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxAutocompleteResults,
109 OnAutocompleteResults) 109 OnAutocompleteResults)
110 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxUpOrDownKeyPressed, 110 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxUpOrDownKeyPressed,
111 OnUpOrDownKeyPressed) 111 OnUpOrDownKeyPressed)
112 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxStartedCapturingKeyStrokes,
113 OnStartedCapturingKeyStrokes)
114 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxStoppedCapturingKeyStrokes,
115 OnStoppedCapturingKeyStrokes)
112 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxModeChanged, 116 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxModeChanged,
113 OnModeChanged) 117 OnModeChanged)
114 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxThemeChanged, 118 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxThemeChanged,
115 OnThemeChanged) 119 OnThemeChanged)
116 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxThemeAreaHeightChanged, 120 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxThemeAreaHeightChanged,
117 OnThemeAreaHeightChanged) 121 OnThemeAreaHeightChanged)
118 IPC_MESSAGE_UNHANDLED(handled = false) 122 IPC_MESSAGE_UNHANDLED(handled = false)
119 IPC_END_MESSAGE_MAP() 123 IPC_END_MESSAGE_MAP()
120 return handled; 124 return handled;
121 } 125 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 } 187 }
184 } 188 }
185 189
186 void SearchBox::OnUpOrDownKeyPressed(int count) { 190 void SearchBox::OnUpOrDownKeyPressed(int count) {
187 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { 191 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) {
188 extensions_v8::SearchBoxExtension::DispatchUpOrDownKeyPress( 192 extensions_v8::SearchBoxExtension::DispatchUpOrDownKeyPress(
189 render_view()->GetWebView()->mainFrame(), count); 193 render_view()->GetWebView()->mainFrame(), count);
190 } 194 }
191 } 195 }
192 196
197 void SearchBox::OnStartedCapturingKeyStrokes() {
198 capturing_key_strokes_ = true;
199 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) {
200 extensions_v8::SearchBoxExtension::DispatchKeyStrokeCapturingModeChange(
201 render_view()->GetWebView()->mainFrame());
202 }
203 }
204
205 void SearchBox::OnStoppedCapturingKeyStrokes() {
206 capturing_key_strokes_ = false;
207 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) {
208 extensions_v8::SearchBoxExtension::DispatchKeyStrokeCapturingModeChange(
209 render_view()->GetWebView()->mainFrame());
210 }
211 }
212
193 void SearchBox::OnModeChanged(const chrome::search::Mode& mode) { 213 void SearchBox::OnModeChanged(const chrome::search::Mode& mode) {
194 mode_ = mode; 214 mode_ = mode;
195 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { 215 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) {
196 extensions_v8::SearchBoxExtension::DispatchContextChange( 216 extensions_v8::SearchBoxExtension::DispatchContextChange(
197 render_view()->GetWebView()->mainFrame()); 217 render_view()->GetWebView()->mainFrame());
198 } 218 }
199 } 219 }
200 220
201 void SearchBox::OnThemeChanged(const ThemeBackgroundInfo& theme_info) { 221 void SearchBox::OnThemeChanged(const ThemeBackgroundInfo& theme_info) {
202 theme_info_ = theme_info; 222 theme_info_ = theme_info;
(...skipping 12 matching lines...) Expand all
215 } 235 }
216 236
217 void SearchBox::Reset() { 237 void SearchBox::Reset() {
218 query_.clear(); 238 query_.clear();
219 verbatim_ = false; 239 verbatim_ = false;
220 selection_start_ = 0; 240 selection_start_ = 0;
221 selection_end_ = 0; 241 selection_end_ = 0;
222 results_base_ = 0; 242 results_base_ = 0;
223 rect_ = gfx::Rect(); 243 rect_ = gfx::Rect();
224 autocomplete_results_.clear(); 244 autocomplete_results_.clear();
245 capturing_key_strokes_ = false;
225 mode_ = chrome::search::Mode(); 246 mode_ = chrome::search::Mode();
226 theme_info_ = ThemeBackgroundInfo(); 247 theme_info_ = ThemeBackgroundInfo();
227 theme_area_height_ = 0; 248 theme_area_height_ = 0;
228 } 249 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698