OLD | NEW |
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 Loading... |
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/chrome_signin_helper.h" | 40 #include "chrome/browser/signin/chrome_signin_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" |
44 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" | 45 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" |
45 #include "chrome/browser/ui/bookmarks/bookmark_bubble_delegate.h" | 46 #include "chrome/browser/ui/bookmarks/bookmark_bubble_delegate.h" |
46 #include "chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate.h" | 47 #include "chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate.h" |
47 #include "chrome/browser/ui/browser.h" | 48 #include "chrome/browser/ui/browser.h" |
48 #include "chrome/browser/ui/browser_command_controller.h" | 49 #include "chrome/browser/ui/browser_command_controller.h" |
49 #include "chrome/browser/ui/browser_commands.h" | 50 #include "chrome/browser/ui/browser_commands.h" |
50 #include "chrome/browser/ui/browser_dialogs.h" | 51 #include "chrome/browser/ui/browser_dialogs.h" |
51 #include "chrome/browser/ui/browser_finder.h" | 52 #include "chrome/browser/ui/browser_finder.h" |
52 #include "chrome/browser/ui/browser_list.h" | 53 #include "chrome/browser/ui/browser_list.h" |
53 #include "chrome/browser/ui/browser_window_state.h" | 54 #include "chrome/browser/ui/browser_window_state.h" |
(...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1421 DCHECK(focus_manager); | 1422 DCHECK(focus_manager); |
1422 | 1423 |
1423 if (focus_manager->shortcut_handling_suspended()) | 1424 if (focus_manager->shortcut_handling_suspended()) |
1424 return false; | 1425 return false; |
1425 | 1426 |
1426 ui::Accelerator accelerator = | 1427 ui::Accelerator accelerator = |
1427 ui::GetAcceleratorFromNativeWebKeyboardEvent(event); | 1428 ui::GetAcceleratorFromNativeWebKeyboardEvent(event); |
1428 | 1429 |
1429 // What we have to do here is as follows: | 1430 // What we have to do here is as follows: |
1430 // - If the |browser_| is for an app, do nothing. | 1431 // - If the |browser_| is for an app, do nothing. |
| 1432 // - On CrOS if |accelerator| is deprecated, we allow web contents to consume |
| 1433 // it if needed. |
1431 // - If the |browser_| is not for an app, and the |accelerator| is not | 1434 // - If the |browser_| is not for an app, and the |accelerator| is not |
1432 // associated with the browser (e.g. an Ash shortcut), process it. | 1435 // associated with the browser (e.g. an Ash shortcut), process it. |
1433 // - If the |browser_| is not for an app, and the |accelerator| is associated | 1436 // - If the |browser_| is not for an app, and the |accelerator| is associated |
1434 // with the browser, and it is a reserved one (e.g. Ctrl+w), process it. | 1437 // with the browser, and it is a reserved one (e.g. Ctrl+w), process it. |
1435 // - If the |browser_| is not for an app, and the |accelerator| is associated | 1438 // - If the |browser_| is not for an app, and the |accelerator| is associated |
1436 // with the browser, and it is not a reserved one, do nothing. | 1439 // with the browser, and it is not a reserved one, do nothing. |
1437 | 1440 |
1438 if (browser_->is_app()) { | 1441 if (browser_->is_app()) { |
1439 // Let all keys fall through to a v1 app's web content, even accelerators. | 1442 // Let all keys fall through to a v1 app's web content, even accelerators. |
1440 // We don't have to flip |is_keyboard_shortcut| here. If we do that, the app | 1443 // We don't have to flip |is_keyboard_shortcut| here. If we do that, the app |
1441 // might not be able to see a subsequent Char event. See OnHandleInputEvent | 1444 // might not be able to see a subsequent Char event. See OnHandleInputEvent |
1442 // in content/renderer/render_widget.cc for details. | 1445 // in content/renderer/render_widget.cc for details. |
1443 return false; | 1446 return false; |
1444 } | 1447 } |
1445 | 1448 |
| 1449 #if defined(OS_CHROMEOS) |
| 1450 if (chrome::IsAcceleratorDeprecated(accelerator)) { |
| 1451 if (event.type == blink::WebInputEvent::RawKeyDown) |
| 1452 *is_keyboard_shortcut = true; |
| 1453 return false; |
| 1454 } |
| 1455 #endif // defined(OS_CHROMEOS) |
| 1456 |
1446 chrome::BrowserCommandController* controller = browser_->command_controller(); | 1457 chrome::BrowserCommandController* controller = browser_->command_controller(); |
1447 | 1458 |
1448 // Here we need to retrieve the command id (if any) associated to the | 1459 // Here we need to retrieve the command id (if any) associated to the |
1449 // keyboard event. Instead of looking up the command id in the | 1460 // keyboard event. Instead of looking up the command id in the |
1450 // |accelerator_table_| by ourselves, we block the command execution of | 1461 // |accelerator_table_| by ourselves, we block the command execution of |
1451 // the |browser_| object then send the keyboard event to the | 1462 // the |browser_| object then send the keyboard event to the |
1452 // |focus_manager| as if we are activating an accelerator key. | 1463 // |focus_manager| as if we are activating an accelerator key. |
1453 // Then we can retrieve the command id from the |browser_| object. | 1464 // Then we can retrieve the command id from the |browser_| object. |
1454 bool original_block_command_state = controller->block_command_execution(); | 1465 bool original_block_command_state = controller->block_command_execution(); |
1455 controller->SetBlockCommandExecution(true); | 1466 controller->SetBlockCommandExecution(true); |
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2623 return immersive_mode_controller()->IsEnabled(); | 2634 return immersive_mode_controller()->IsEnabled(); |
2624 } | 2635 } |
2625 | 2636 |
2626 views::Widget* BrowserView::GetBubbleAssociatedWidget() { | 2637 views::Widget* BrowserView::GetBubbleAssociatedWidget() { |
2627 return GetWidget(); | 2638 return GetWidget(); |
2628 } | 2639 } |
2629 | 2640 |
2630 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { | 2641 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { |
2631 return top_container_->GetBoundsInScreen(); | 2642 return top_container_->GetBoundsInScreen(); |
2632 } | 2643 } |
OLD | NEW |