| 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 <stdint.h> |     7 #include <stdint.h> | 
|     8  |     8  | 
|     9 #include <algorithm> |     9 #include <algorithm> | 
|    10 #include <memory> |    10 #include <memory> | 
| (...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1301       immersive_mode_controller_->GetRevealedLock( |  1301       immersive_mode_controller_->GetRevealedLock( | 
|  1302           ImmersiveModeController::ANIMATE_REVEAL_NO)); |  1302           ImmersiveModeController::ANIMATE_REVEAL_NO)); | 
|  1303  |  1303  | 
|  1304   toolbar_->app_menu_button()->Activate(nullptr); |  1304   toolbar_->app_menu_button()->Activate(nullptr); | 
|  1305 } |  1305 } | 
|  1306  |  1306  | 
|  1307 bool BrowserView::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, |  1307 bool BrowserView::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, | 
|  1308                                          bool* is_keyboard_shortcut) { |  1308                                          bool* is_keyboard_shortcut) { | 
|  1309   *is_keyboard_shortcut = false; |  1309   *is_keyboard_shortcut = false; | 
|  1310  |  1310  | 
|  1311   if ((event.type != blink::WebInputEvent::RawKeyDown) && |  1311   if ((event.type() != blink::WebInputEvent::RawKeyDown) && | 
|  1312       (event.type != blink::WebInputEvent::KeyUp)) { |  1312       (event.type() != blink::WebInputEvent::KeyUp)) { | 
|  1313     return false; |  1313     return false; | 
|  1314   } |  1314   } | 
|  1315  |  1315  | 
|  1316   views::FocusManager* focus_manager = GetFocusManager(); |  1316   views::FocusManager* focus_manager = GetFocusManager(); | 
|  1317   DCHECK(focus_manager); |  1317   DCHECK(focus_manager); | 
|  1318  |  1318  | 
|  1319   if (focus_manager->shortcut_handling_suspended()) |  1319   if (focus_manager->shortcut_handling_suspended()) | 
|  1320     return false; |  1320     return false; | 
|  1321  |  1321  | 
|  1322   ui::Accelerator accelerator = |  1322   ui::Accelerator accelerator = | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
|  1336   if (browser_->is_app()) { |  1336   if (browser_->is_app()) { | 
|  1337     // Let all keys fall through to a v1 app's web content, even accelerators. |  1337     // Let all keys fall through to a v1 app's web content, even accelerators. | 
|  1338     // We don't have to flip |is_keyboard_shortcut| here. If we do that, the app |  1338     // We don't have to flip |is_keyboard_shortcut| here. If we do that, the app | 
|  1339     // might not be able to see a subsequent Char event. See OnHandleInputEvent |  1339     // might not be able to see a subsequent Char event. See OnHandleInputEvent | 
|  1340     // in content/renderer/render_widget.cc for details. |  1340     // in content/renderer/render_widget.cc for details. | 
|  1341     return false; |  1341     return false; | 
|  1342   } |  1342   } | 
|  1343  |  1343  | 
|  1344 #if defined(OS_CHROMEOS) |  1344 #if defined(OS_CHROMEOS) | 
|  1345   if (chrome::IsAcceleratorDeprecated(accelerator)) { |  1345   if (chrome::IsAcceleratorDeprecated(accelerator)) { | 
|  1346     if (event.type == blink::WebInputEvent::RawKeyDown) |  1346     if (event.type() == blink::WebInputEvent::RawKeyDown) | 
|  1347       *is_keyboard_shortcut = true; |  1347       *is_keyboard_shortcut = true; | 
|  1348     return false; |  1348     return false; | 
|  1349   } |  1349   } | 
|  1350 #endif  // defined(OS_CHROMEOS) |  1350 #endif  // defined(OS_CHROMEOS) | 
|  1351  |  1351  | 
|  1352   if (frame_->PreHandleKeyboardEvent(event)) |  1352   if (frame_->PreHandleKeyboardEvent(event)) | 
|  1353     return true; |  1353     return true; | 
|  1354  |  1354  | 
|  1355   chrome::BrowserCommandController* controller = browser_->command_controller(); |  1355   chrome::BrowserCommandController* controller = browser_->command_controller(); | 
|  1356  |  1356  | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
|  1370   controller->SetBlockCommandExecution(original_block_command_state); |  1370   controller->SetBlockCommandExecution(original_block_command_state); | 
|  1371  |  1371  | 
|  1372   // Executing the command may cause |this| object to be destroyed. |  1372   // Executing the command may cause |this| object to be destroyed. | 
|  1373   if (controller->IsReservedCommandOrKey(id, event)) { |  1373   if (controller->IsReservedCommandOrKey(id, event)) { | 
|  1374     UpdateAcceleratorMetrics(accelerator, id); |  1374     UpdateAcceleratorMetrics(accelerator, id); | 
|  1375     return chrome::ExecuteCommand(browser_.get(), id); |  1375     return chrome::ExecuteCommand(browser_.get(), id); | 
|  1376   } |  1376   } | 
|  1377  |  1377  | 
|  1378   if (id != -1) { |  1378   if (id != -1) { | 
|  1379     // |accelerator| is a non-reserved browser shortcut (e.g. Ctrl+f). |  1379     // |accelerator| is a non-reserved browser shortcut (e.g. Ctrl+f). | 
|  1380     if (event.type == blink::WebInputEvent::RawKeyDown) |  1380     if (event.type() == blink::WebInputEvent::RawKeyDown) | 
|  1381       *is_keyboard_shortcut = true; |  1381       *is_keyboard_shortcut = true; | 
|  1382   } else if (processed) { |  1382   } else if (processed) { | 
|  1383     // |accelerator| is a non-browser shortcut (e.g. F4-F10 on Ash). Report |  1383     // |accelerator| is a non-browser shortcut (e.g. F4-F10 on Ash). Report | 
|  1384     // that we handled it. |  1384     // that we handled it. | 
|  1385     return true; |  1385     return true; | 
|  1386   } |  1386   } | 
|  1387  |  1387  | 
|  1388   return false; |  1388   return false; | 
|  1389 } |  1389 } | 
|  1390  |  1390  | 
| (...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2644 } |  2644 } | 
|  2645  |  2645  | 
|  2646 extensions::ActiveTabPermissionGranter* |  2646 extensions::ActiveTabPermissionGranter* | 
|  2647 BrowserView::GetActiveTabPermissionGranter() { |  2647 BrowserView::GetActiveTabPermissionGranter() { | 
|  2648   content::WebContents* web_contents = GetActiveWebContents(); |  2648   content::WebContents* web_contents = GetActiveWebContents(); | 
|  2649   if (!web_contents) |  2649   if (!web_contents) | 
|  2650     return nullptr; |  2650     return nullptr; | 
|  2651   return extensions::TabHelper::FromWebContents(web_contents) |  2651   return extensions::TabHelper::FromWebContents(web_contents) | 
|  2652       ->active_tab_permission_granter(); |  2652       ->active_tab_permission_granter(); | 
|  2653 } |  2653 } | 
| OLD | NEW |