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

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

Issue 1202923002: Revert "Deprecating high-conflict accelerators" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « chrome/browser/ui/views/accelerator_table.cc ('k') | tools/metrics/histograms/histograms.xml » ('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 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 23 matching lines...) Expand all
34 #include "chrome/browser/profiles/profile_manager.h" 34 #include "chrome/browser/profiles/profile_manager.h"
35 #include "chrome/browser/profiles/profile_window.h" 35 #include "chrome/browser/profiles/profile_window.h"
36 #include "chrome/browser/profiles/profiles_state.h" 36 #include "chrome/browser/profiles/profiles_state.h"
37 #include "chrome/browser/search/search.h" 37 #include "chrome/browser/search/search.h"
38 #include "chrome/browser/sessions/tab_restore_service.h" 38 #include "chrome/browser/sessions/tab_restore_service.h"
39 #include "chrome/browser/sessions/tab_restore_service_factory.h" 39 #include "chrome/browser/sessions/tab_restore_service_factory.h"
40 #include "chrome/browser/signin/signin_header_helper.h" 40 #include "chrome/browser/signin/signin_header_helper.h"
41 #include "chrome/browser/themes/theme_properties.h" 41 #include "chrome/browser/themes/theme_properties.h"
42 #include "chrome/browser/themes/theme_service_factory.h" 42 #include "chrome/browser/themes/theme_service_factory.h"
43 #include "chrome/browser/translate/chrome_translate_client.h" 43 #include "chrome/browser/translate/chrome_translate_client.h"
44 #include "chrome/browser/ui/ash/ash_util.h"
45 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" 44 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h"
46 #include "chrome/browser/ui/bookmarks/bookmark_bubble_delegate.h" 45 #include "chrome/browser/ui/bookmarks/bookmark_bubble_delegate.h"
47 #include "chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate.h" 46 #include "chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate.h"
48 #include "chrome/browser/ui/browser.h" 47 #include "chrome/browser/ui/browser.h"
49 #include "chrome/browser/ui/browser_command_controller.h" 48 #include "chrome/browser/ui/browser_command_controller.h"
50 #include "chrome/browser/ui/browser_commands.h" 49 #include "chrome/browser/ui/browser_commands.h"
51 #include "chrome/browser/ui/browser_dialogs.h" 50 #include "chrome/browser/ui/browser_dialogs.h"
52 #include "chrome/browser/ui/browser_finder.h" 51 #include "chrome/browser/ui/browser_finder.h"
53 #include "chrome/browser/ui/browser_list.h" 52 #include "chrome/browser/ui/browser_list.h"
54 #include "chrome/browser/ui/browser_window_state.h" 53 #include "chrome/browser/ui/browser_window_state.h"
(...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 DCHECK(focus_manager); 1396 DCHECK(focus_manager);
1398 1397
1399 if (focus_manager->shortcut_handling_suspended()) 1398 if (focus_manager->shortcut_handling_suspended())
1400 return false; 1399 return false;
1401 1400
1402 ui::Accelerator accelerator = 1401 ui::Accelerator accelerator =
1403 ui::GetAcceleratorFromNativeWebKeyboardEvent(event); 1402 ui::GetAcceleratorFromNativeWebKeyboardEvent(event);
1404 1403
1405 // What we have to do here is as follows: 1404 // What we have to do here is as follows:
1406 // - If the |browser_| is for an app, do nothing. 1405 // - If the |browser_| is for an app, do nothing.
1407 // - On CrOS if |accelerator| is deprecated, we allow web contents to consume
1408 // it if needed.
1409 // - If the |browser_| is not for an app, and the |accelerator| is not 1406 // - If the |browser_| is not for an app, and the |accelerator| is not
1410 // associated with the browser (e.g. an Ash shortcut), process it. 1407 // associated with the browser (e.g. an Ash shortcut), process it.
1411 // - If the |browser_| is not for an app, and the |accelerator| is associated 1408 // - If the |browser_| is not for an app, and the |accelerator| is associated
1412 // with the browser, and it is a reserved one (e.g. Ctrl+w), process it. 1409 // with the browser, and it is a reserved one (e.g. Ctrl+w), process it.
1413 // - If the |browser_| is not for an app, and the |accelerator| is associated 1410 // - If the |browser_| is not for an app, and the |accelerator| is associated
1414 // with the browser, and it is not a reserved one, do nothing. 1411 // with the browser, and it is not a reserved one, do nothing.
1415 1412
1416 if (browser_->is_app()) { 1413 if (browser_->is_app()) {
1417 // Let all keys fall through to a v1 app's web content, even accelerators. 1414 // Let all keys fall through to a v1 app's web content, even accelerators.
1418 // We don't have to flip |is_keyboard_shortcut| here. If we do that, the app 1415 // We don't have to flip |is_keyboard_shortcut| here. If we do that, the app
1419 // might not be able to see a subsequent Char event. See OnHandleInputEvent 1416 // might not be able to see a subsequent Char event. See OnHandleInputEvent
1420 // in content/renderer/render_widget.cc for details. 1417 // in content/renderer/render_widget.cc for details.
1421 return false; 1418 return false;
1422 } 1419 }
1423 1420
1424 #if defined(OS_CHROMEOS)
1425 if (chrome::IsAcceleratorDeprecated(accelerator)) {
1426 if (event.type == blink::WebInputEvent::RawKeyDown)
1427 *is_keyboard_shortcut = true;
1428 return false;
1429 }
1430 #endif // defined(OS_CHROMEOS)
1431
1432 chrome::BrowserCommandController* controller = browser_->command_controller(); 1421 chrome::BrowserCommandController* controller = browser_->command_controller();
1433 1422
1434 // Here we need to retrieve the command id (if any) associated to the 1423 // Here we need to retrieve the command id (if any) associated to the
1435 // keyboard event. Instead of looking up the command id in the 1424 // keyboard event. Instead of looking up the command id in the
1436 // |accelerator_table_| by ourselves, we block the command execution of 1425 // |accelerator_table_| by ourselves, we block the command execution of
1437 // the |browser_| object then send the keyboard event to the 1426 // the |browser_| object then send the keyboard event to the
1438 // |focus_manager| as if we are activating an accelerator key. 1427 // |focus_manager| as if we are activating an accelerator key.
1439 // Then we can retrieve the command id from the |browser_| object. 1428 // Then we can retrieve the command id from the |browser_| object.
1440 bool original_block_command_state = controller->block_command_execution(); 1429 bool original_block_command_state = controller->block_command_execution();
1441 controller->SetBlockCommandExecution(true); 1430 controller->SetBlockCommandExecution(true);
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after
2628 return immersive_mode_controller()->IsEnabled(); 2617 return immersive_mode_controller()->IsEnabled();
2629 } 2618 }
2630 2619
2631 views::Widget* BrowserView::GetBubbleAssociatedWidget() { 2620 views::Widget* BrowserView::GetBubbleAssociatedWidget() {
2632 return GetWidget(); 2621 return GetWidget();
2633 } 2622 }
2634 2623
2635 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { 2624 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() {
2636 return top_container_->GetBoundsInScreen(); 2625 return top_container_->GetBoundsInScreen();
2637 } 2626 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/accelerator_table.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698