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

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

Issue 2573073003: Collapse the API surface on WebInputEvent via accessor functions. (Closed)
Patch Set: Created 4 years 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 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 immersive_mode_controller_->GetRevealedLock( 1306 immersive_mode_controller_->GetRevealedLock(
1307 ImmersiveModeController::ANIMATE_REVEAL_NO)); 1307 ImmersiveModeController::ANIMATE_REVEAL_NO));
1308 1308
1309 toolbar_->app_menu_button()->Activate(nullptr); 1309 toolbar_->app_menu_button()->Activate(nullptr);
1310 } 1310 }
1311 1311
1312 bool BrowserView::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, 1312 bool BrowserView::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
1313 bool* is_keyboard_shortcut) { 1313 bool* is_keyboard_shortcut) {
1314 *is_keyboard_shortcut = false; 1314 *is_keyboard_shortcut = false;
1315 1315
1316 if ((event.type != blink::WebInputEvent::RawKeyDown) && 1316 if ((event.type() != blink::WebInputEvent::RawKeyDown) &&
1317 (event.type != blink::WebInputEvent::KeyUp)) { 1317 (event.type() != blink::WebInputEvent::KeyUp)) {
1318 return false; 1318 return false;
1319 } 1319 }
1320 1320
1321 views::FocusManager* focus_manager = GetFocusManager(); 1321 views::FocusManager* focus_manager = GetFocusManager();
1322 DCHECK(focus_manager); 1322 DCHECK(focus_manager);
1323 1323
1324 if (focus_manager->shortcut_handling_suspended()) 1324 if (focus_manager->shortcut_handling_suspended())
1325 return false; 1325 return false;
1326 1326
1327 ui::Accelerator accelerator = 1327 ui::Accelerator accelerator =
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1375 controller->SetBlockCommandExecution(original_block_command_state); 1375 controller->SetBlockCommandExecution(original_block_command_state);
1376 1376
1377 // Executing the command may cause |this| object to be destroyed. 1377 // Executing the command may cause |this| object to be destroyed.
1378 if (controller->IsReservedCommandOrKey(id, event)) { 1378 if (controller->IsReservedCommandOrKey(id, event)) {
1379 UpdateAcceleratorMetrics(accelerator, id); 1379 UpdateAcceleratorMetrics(accelerator, id);
1380 return chrome::ExecuteCommand(browser_.get(), id); 1380 return chrome::ExecuteCommand(browser_.get(), id);
1381 } 1381 }
1382 1382
1383 if (id != -1) { 1383 if (id != -1) {
1384 // |accelerator| is a non-reserved browser shortcut (e.g. Ctrl+f). 1384 // |accelerator| is a non-reserved browser shortcut (e.g. Ctrl+f).
1385 if (event.type == blink::WebInputEvent::RawKeyDown) 1385 if (event.type() == blink::WebInputEvent::RawKeyDown)
1386 *is_keyboard_shortcut = true; 1386 *is_keyboard_shortcut = true;
1387 } else if (processed) { 1387 } else if (processed) {
1388 // |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
1389 // that we handled it. 1389 // that we handled it.
1390 return true; 1390 return true;
1391 } 1391 }
1392 1392
1393 return false; 1393 return false;
1394 } 1394 }
1395 1395
(...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698