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

Side by Side Diff: chrome/browser/ui/views/find_bar_host.cc

Issue 8508055: Move views::Accelerator to ui in order to use it from aura code. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 9 years, 1 month 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
« no previous file with comments | « chrome/browser/ui/views/find_bar_host.h ('k') | chrome/browser/ui/views/frame/browser_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/browser/ui/views/find_bar_host.h" 5 #include "chrome/browser/ui/views/find_bar_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "chrome/browser/ui/find_bar/find_bar_controller.h" 9 #include "chrome/browser/ui/find_bar/find_bar_controller.h"
10 #include "chrome/browser/ui/find_bar/find_tab_helper.h" 10 #include "chrome/browser/ui/find_bar/find_tab_helper.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } else { 161 } else {
162 focus_tracker()->FocusLastFocusedExternalView(); 162 focus_tracker()->FocusLastFocusedExternalView();
163 } 163 }
164 } 164 }
165 165
166 FindBarTesting* FindBarHost::GetFindBarTesting() { 166 FindBarTesting* FindBarHost::GetFindBarTesting() {
167 return this; 167 return this;
168 } 168 }
169 169
170 //////////////////////////////////////////////////////////////////////////////// 170 ////////////////////////////////////////////////////////////////////////////////
171 // FindBarWin, views::AcceleratorTarget implementation: 171 // FindBarWin, ui::AcceleratorTarget implementation:
172 172
173 bool FindBarHost::AcceleratorPressed(const views::Accelerator& accelerator) { 173 bool FindBarHost::AcceleratorPressed(const ui::Accelerator& accelerator) {
174 ui::KeyboardCode key = accelerator.key_code(); 174 ui::KeyboardCode key = accelerator.key_code();
175 if (key == ui::VKEY_RETURN && accelerator.IsCtrlDown()) { 175 if (key == ui::VKEY_RETURN && accelerator.IsCtrlDown()) {
176 // Ctrl+Enter closes the Find session and navigates any link that is active. 176 // Ctrl+Enter closes the Find session and navigates any link that is active.
177 find_bar_controller_->EndFindSession(FindBarController::kActivateSelection); 177 find_bar_controller_->EndFindSession(FindBarController::kActivateSelection);
178 } else if (key == ui::VKEY_ESCAPE) { 178 } else if (key == ui::VKEY_ESCAPE) {
179 // This will end the Find session and hide the window, causing it to loose 179 // This will end the Find session and hide the window, causing it to loose
180 // focus and in the process unregister us as the handler for the Escape 180 // focus and in the process unregister us as the handler for the Escape
181 // accelerator through the OnWillChangeFocus event. 181 // accelerator through the OnWillChangeFocus event.
182 find_bar_controller_->EndFindSession(FindBarController::kKeepSelection); 182 find_bar_controller_->EndFindSession(FindBarController::kKeepSelection);
183 } else { 183 } else {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 DCHECK(bounds); 295 DCHECK(bounds);
296 // The BrowserView does Layout for the components that we care about 296 // The BrowserView does Layout for the components that we care about
297 // positioning relative to, so we ask it to tell us where we should go. 297 // positioning relative to, so we ask it to tell us where we should go.
298 *bounds = browser_view()->GetFindBarBoundingBox(); 298 *bounds = browser_view()->GetFindBarBoundingBox();
299 } 299 }
300 300
301 void FindBarHost::RegisterAccelerators() { 301 void FindBarHost::RegisterAccelerators() {
302 DropdownBarHost::RegisterAccelerators(); 302 DropdownBarHost::RegisterAccelerators();
303 303
304 // Register for Ctrl+Return. 304 // Register for Ctrl+Return.
305 views::Accelerator escape(ui::VKEY_RETURN, false, true, false); 305 ui::Accelerator escape(ui::VKEY_RETURN, false, true, false);
306 focus_manager()->RegisterAccelerator(escape, this); 306 focus_manager()->RegisterAccelerator(escape, this);
307 } 307 }
308 308
309 void FindBarHost::UnregisterAccelerators() { 309 void FindBarHost::UnregisterAccelerators() {
310 // Unregister Ctrl+Return. 310 // Unregister Ctrl+Return.
311 views::Accelerator escape(ui::VKEY_RETURN, false, true, false); 311 ui::Accelerator escape(ui::VKEY_RETURN, false, true, false);
312 focus_manager()->UnregisterAccelerator(escape, this); 312 focus_manager()->UnregisterAccelerator(escape, this);
313 313
314 DropdownBarHost::UnregisterAccelerators(); 314 DropdownBarHost::UnregisterAccelerators();
315 } 315 }
316 316
317 //////////////////////////////////////////////////////////////////////////////// 317 ////////////////////////////////////////////////////////////////////////////////
318 // private: 318 // private:
319 319
320 FindBarView* FindBarHost::find_bar_view() { 320 FindBarView* FindBarHost::find_bar_view() {
321 return static_cast<FindBarView*>(view()); 321 return static_cast<FindBarView*>(view());
322 } 322 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/find_bar_host.h ('k') | chrome/browser/ui/views/frame/browser_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698