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

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 2074643003: MacViews: Views accelerators table should match the Cocoa one. (Closed) Base URL: ssh://bitbucket.browser.yandex-team.ru/chromium/src.git@master
Patch Set: Fix compilation. Created 4 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
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 #include "chrome/browser/ui/views/frame/browser_view.h" 5 #include "chrome/browser/ui/views/frame/browser_view.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 } 1347 }
1348 1348
1349 #if defined(OS_CHROMEOS) 1349 #if defined(OS_CHROMEOS)
1350 if (chrome::IsAcceleratorDeprecated(accelerator)) { 1350 if (chrome::IsAcceleratorDeprecated(accelerator)) {
1351 if (event.type == blink::WebInputEvent::RawKeyDown) 1351 if (event.type == blink::WebInputEvent::RawKeyDown)
1352 *is_keyboard_shortcut = true; 1352 *is_keyboard_shortcut = true;
1353 return false; 1353 return false;
1354 } 1354 }
1355 #endif // defined(OS_CHROMEOS) 1355 #endif // defined(OS_CHROMEOS)
1356 1356
1357 if (frame_->PreHandleKeyboardEvent(event))
1358 return true;
1359
1357 chrome::BrowserCommandController* controller = browser_->command_controller(); 1360 chrome::BrowserCommandController* controller = browser_->command_controller();
1358 1361
1359 // Here we need to retrieve the command id (if any) associated to the 1362 // Here we need to retrieve the command id (if any) associated to the
1360 // keyboard event. Instead of looking up the command id in the 1363 // keyboard event. Instead of looking up the command id in the
1361 // |accelerator_table_| by ourselves, we block the command execution of 1364 // |accelerator_table_| by ourselves, we block the command execution of
1362 // the |browser_| object then send the keyboard event to the 1365 // the |browser_| object then send the keyboard event to the
1363 // |focus_manager| as if we are activating an accelerator key. 1366 // |focus_manager| as if we are activating an accelerator key.
1364 // Then we can retrieve the command id from the |browser_| object. 1367 // Then we can retrieve the command id from the |browser_| object.
1365 bool original_block_command_state = controller->block_command_execution(); 1368 bool original_block_command_state = controller->block_command_execution();
1366 controller->SetBlockCommandExecution(true); 1369 controller->SetBlockCommandExecution(true);
(...skipping 17 matching lines...) Expand all
1384 } else if (processed) { 1387 } else if (processed) {
1385 // |accelerator| is a non-browser shortcut (e.g. F4-F10 on Ash). Report 1388 // |accelerator| is a non-browser shortcut (e.g. F4-F10 on Ash). Report
1386 // that we handled it. 1389 // that we handled it.
1387 return true; 1390 return true;
1388 } 1391 }
1389 1392
1390 return false; 1393 return false;
1391 } 1394 }
1392 1395
1393 void BrowserView::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { 1396 void BrowserView::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) {
1397 if (frame_->HandleKeyboardEvent(event))
1398 return;
1399
1394 unhandled_keyboard_event_handler_.HandleKeyboardEvent(event, 1400 unhandled_keyboard_event_handler_.HandleKeyboardEvent(event,
1395 GetFocusManager()); 1401 GetFocusManager());
1396 } 1402 }
1397 1403
1398 // TODO(devint): http://b/issue?id=1117225 Cut, Copy, and Paste are always 1404 // TODO(devint): http://b/issue?id=1117225 Cut, Copy, and Paste are always
1399 // enabled in the page menu regardless of whether the command will do 1405 // enabled in the page menu regardless of whether the command will do
1400 // anything. When someone selects the menu item, we just act as if they hit 1406 // anything. When someone selects the menu item, we just act as if they hit
1401 // the keyboard shortcut for the command by sending the associated key press 1407 // the keyboard shortcut for the command by sending the associated key press
1402 // to windows. The real fix to this bug is to disable the commands when they 1408 // to windows. The real fix to this bug is to disable the commands when they
1403 // won't do anything. We'll need something like an overall clipboard command 1409 // won't do anything. We'll need something like an overall clipboard command
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after
2590 } 2596 }
2591 2597
2592 extensions::ActiveTabPermissionGranter* 2598 extensions::ActiveTabPermissionGranter*
2593 BrowserView::GetActiveTabPermissionGranter() { 2599 BrowserView::GetActiveTabPermissionGranter() {
2594 content::WebContents* web_contents = GetActiveWebContents(); 2600 content::WebContents* web_contents = GetActiveWebContents();
2595 if (!web_contents) 2601 if (!web_contents)
2596 return nullptr; 2602 return nullptr;
2597 return extensions::TabHelper::FromWebContents(web_contents) 2603 return extensions::TabHelper::FromWebContents(web_contents)
2598 ->active_tab_permission_granter(); 2604 ->active_tab_permission_granter();
2599 } 2605 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_frame_mus.cc ('k') | chrome/browser/ui/views/frame/desktop_browser_frame_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698