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

Side by Side Diff: chrome/browser/views/tab_contents/tab_contents_view_gtk.cc

Issue 235039: Fix conflicts between accelerator keys and HTML DOM accesskeys.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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 (c) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #include "chrome/browser/views/tab_contents/tab_contents_view_gtk.h" 5 #include "chrome/browser/views/tab_contents/tab_contents_view_gtk.h"
6 6
7 #include <gdk/gdk.h> 7 #include <gdk/gdk.h>
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include "app/gfx/canvas_paint.h" 10 #include "app/gfx/canvas_paint.h"
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 tab_contents()->delegate()->TabContentsFocused(tab_contents()); 276 tab_contents()->delegate()->TabContentsFocused(tab_contents());
277 } 277 }
278 278
279 void TabContentsViewGtk::TakeFocus(bool reverse) { 279 void TabContentsViewGtk::TakeFocus(bool reverse) {
280 // This is called when we the renderer asks us to take focus back (i.e., it 280 // This is called when we the renderer asks us to take focus back (i.e., it
281 // has iterated past the last focusable element on the page). 281 // has iterated past the last focusable element on the page).
282 gtk_widget_child_focus(GTK_WIDGET(GetTopLevelNativeWindow()), 282 gtk_widget_child_focus(GTK_WIDGET(GetTopLevelNativeWindow()),
283 reverse ? GTK_DIR_TAB_BACKWARD : GTK_DIR_TAB_FORWARD); 283 reverse ? GTK_DIR_TAB_BACKWARD : GTK_DIR_TAB_FORWARD);
284 } 284 }
285 285
286 void TabContentsViewGtk::HandleKeyboardEvent( 286 bool TabContentsViewGtk::HandleKeyboardEvent(
287 const NativeWebKeyboardEvent& event) { 287 const NativeWebKeyboardEvent& event) {
288 // The renderer returned a keyboard event it did not process. This may be 288 // The renderer returned a keyboard event it did not process. This may be
289 // a keyboard shortcut that we have to process. 289 // a keyboard shortcut that we have to process.
290 if (event.type != WebInputEvent::RawKeyDown) 290 if (event.type != WebInputEvent::RawKeyDown)
291 return; 291 return false;
292 292
293 views::FocusManager* focus_manager = 293 views::FocusManager* focus_manager =
294 views::FocusManager::GetFocusManagerForNativeView(GetNativeView()); 294 views::FocusManager::GetFocusManagerForNativeView(GetNativeView());
295 // We may not have a focus_manager at this point (if the tab has been switched 295 // We may not have a focus_manager at this point (if the tab has been switched
296 // by the time this message returned). 296 // by the time this message returned).
297 if (!focus_manager) 297 if (!focus_manager)
298 return; 298 return false;
299 299
300 bool shift_pressed = (event.modifiers & WebInputEvent::ShiftKey) == 300 bool shift_pressed = (event.modifiers & WebInputEvent::ShiftKey) ==
301 WebInputEvent::ShiftKey; 301 WebInputEvent::ShiftKey;
302 bool ctrl_pressed = (event.modifiers & WebInputEvent::ControlKey) == 302 bool ctrl_pressed = (event.modifiers & WebInputEvent::ControlKey) ==
303 WebInputEvent::ControlKey; 303 WebInputEvent::ControlKey;
304 bool alt_pressed = (event.modifiers & WebInputEvent::AltKey) == 304 bool alt_pressed = (event.modifiers & WebInputEvent::AltKey) ==
305 WebInputEvent::AltKey; 305 WebInputEvent::AltKey;
306 306
307 focus_manager->ProcessAccelerator( 307 return focus_manager->ProcessAccelerator(
308 views::Accelerator(static_cast<base::KeyboardCode>(event.windowsKeyCode), 308 views::Accelerator(static_cast<base::KeyboardCode>(event.windowsKeyCode),
309 shift_pressed, ctrl_pressed, alt_pressed)); 309 shift_pressed, ctrl_pressed, alt_pressed));
310 // DANGER: |this| could be deleted now! 310 // DANGER: |this| could be deleted now!
311 311
312 // Note that we do not handle Gtk mnemonics/accelerators or binding set here 312 // Note that we do not handle Gtk mnemonics/accelerators or binding set here
313 // (as it is done in BrowserWindowGtk::HandleKeyboardEvent), as we override 313 // (as it is done in BrowserWindowGtk::HandleKeyboardEvent), as we override
314 // Gtk behavior completely. 314 // Gtk behavior completely.
315 } 315 }
316 316
317 void TabContentsViewGtk::ShowContextMenu(const ContextMenuParams& params) { 317 void TabContentsViewGtk::ShowContextMenu(const ContextMenuParams& params) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 void TabContentsViewGtk::WasSized(const gfx::Size& size) { 372 void TabContentsViewGtk::WasSized(const gfx::Size& size) {
373 size_ = size; 373 size_ = size;
374 if (tab_contents()->interstitial_page()) 374 if (tab_contents()->interstitial_page())
375 tab_contents()->interstitial_page()->SetSize(size); 375 tab_contents()->interstitial_page()->SetSize(size);
376 if (tab_contents()->render_widget_host_view()) 376 if (tab_contents()->render_widget_host_view())
377 tab_contents()->render_widget_host_view()->SetSize(size); 377 tab_contents()->render_widget_host_view()->SetSize(size);
378 378
379 // TODO(brettw) this function can probably be moved to this class. 379 // TODO(brettw) this function can probably be moved to this class.
380 tab_contents()->RepositionSupressedPopupsToFit(); 380 tab_contents()->RepositionSupressedPopupsToFit();
381 } 381 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698