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/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" | |
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 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1396 DCHECK(focus_manager); | 1397 DCHECK(focus_manager); |
1397 | 1398 |
1398 if (focus_manager->shortcut_handling_suspended()) | 1399 if (focus_manager->shortcut_handling_suspended()) |
1399 return false; | 1400 return false; |
1400 | 1401 |
1401 ui::Accelerator accelerator = | 1402 ui::Accelerator accelerator = |
1402 ui::GetAcceleratorFromNativeWebKeyboardEvent(event); | 1403 ui::GetAcceleratorFromNativeWebKeyboardEvent(event); |
1403 | 1404 |
1404 // What we have to do here is as follows: | 1405 // What we have to do here is as follows: |
1405 // - If the |browser_| is for an app, do nothing. | 1406 // - 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. | |
1406 // - If the |browser_| is not for an app, and the |accelerator| is not | 1409 // - If the |browser_| is not for an app, and the |accelerator| is not |
1407 // associated with the browser (e.g. an Ash shortcut), process it. | 1410 // associated with the browser (e.g. an Ash shortcut), process it. |
1408 // - If the |browser_| is not for an app, and the |accelerator| is associated | 1411 // - If the |browser_| is not for an app, and the |accelerator| is associated |
1409 // with the browser, and it is a reserved one (e.g. Ctrl+w), process it. | 1412 // with the browser, and it is a reserved one (e.g. Ctrl+w), process it. |
1410 // - If the |browser_| is not for an app, and the |accelerator| is associated | 1413 // - If the |browser_| is not for an app, and the |accelerator| is associated |
1411 // with the browser, and it is not a reserved one, do nothing. | 1414 // with the browser, and it is not a reserved one, do nothing. |
1412 | 1415 |
1413 if (browser_->is_app()) { | 1416 if (browser_->is_app()) { |
1414 // Let all keys fall through to a v1 app's web content, even accelerators. | 1417 // Let all keys fall through to a v1 app's web content, even accelerators. |
1415 // We don't have to flip |is_keyboard_shortcut| here. If we do that, the app | 1418 // We don't have to flip |is_keyboard_shortcut| here. If we do that, the app |
1416 // might not be able to see a subsequent Char event. See OnHandleInputEvent | 1419 // might not be able to see a subsequent Char event. See OnHandleInputEvent |
1417 // in content/renderer/render_widget.cc for details. | 1420 // in content/renderer/render_widget.cc for details. |
1418 return false; | 1421 return false; |
1419 } | 1422 } |
1420 | 1423 |
1424 #if defined(OS_CHROMEOS) | |
1425 if (chrome::IsAcceleratorDeprecated(accelerator)) { | |
1426 if (event.type == blink::WebInputEvent::RawKeyDown) | |
sky
2015/06/19 21:00:48
nit: combine these two ifs.
afakhry
2015/06/19 22:14:19
Actually the second if is only for *is_keyboard_sh
| |
1427 *is_keyboard_shortcut = true; | |
1428 return false; | |
1429 } | |
1430 #endif // defined(OS_CHROMEOS) | |
1431 | |
1421 chrome::BrowserCommandController* controller = browser_->command_controller(); | 1432 chrome::BrowserCommandController* controller = browser_->command_controller(); |
1422 | 1433 |
1423 // Here we need to retrieve the command id (if any) associated to the | 1434 // Here we need to retrieve the command id (if any) associated to the |
1424 // keyboard event. Instead of looking up the command id in the | 1435 // keyboard event. Instead of looking up the command id in the |
1425 // |accelerator_table_| by ourselves, we block the command execution of | 1436 // |accelerator_table_| by ourselves, we block the command execution of |
1426 // the |browser_| object then send the keyboard event to the | 1437 // the |browser_| object then send the keyboard event to the |
1427 // |focus_manager| as if we are activating an accelerator key. | 1438 // |focus_manager| as if we are activating an accelerator key. |
1428 // Then we can retrieve the command id from the |browser_| object. | 1439 // Then we can retrieve the command id from the |browser_| object. |
1429 bool original_block_command_state = controller->block_command_execution(); | 1440 bool original_block_command_state = controller->block_command_execution(); |
1430 controller->SetBlockCommandExecution(true); | 1441 controller->SetBlockCommandExecution(true); |
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2617 return immersive_mode_controller()->IsEnabled(); | 2628 return immersive_mode_controller()->IsEnabled(); |
2618 } | 2629 } |
2619 | 2630 |
2620 views::Widget* BrowserView::GetBubbleAssociatedWidget() { | 2631 views::Widget* BrowserView::GetBubbleAssociatedWidget() { |
2621 return GetWidget(); | 2632 return GetWidget(); |
2622 } | 2633 } |
2623 | 2634 |
2624 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { | 2635 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { |
2625 return top_container_->GetBoundsInScreen(); | 2636 return top_container_->GetBoundsInScreen(); |
2626 } | 2637 } |
OLD | NEW |