Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #import "chrome/browser/chrome_browser_application_mac.h" | 5 #import "chrome/browser/chrome_browser_application_mac.h" |
| 6 | 6 |
| 7 #import "base/auto_reset.h" | 7 #import "base/auto_reset.h" |
| 8 #include "base/command_line.h" | |
| 8 #include "base/debug/crash_logging.h" | 9 #include "base/debug/crash_logging.h" |
| 9 #include "base/debug/stack_trace.h" | 10 #include "base/debug/stack_trace.h" |
| 10 #import "base/logging.h" | 11 #import "base/logging.h" |
| 11 #import "base/mac/scoped_nsexception_enabler.h" | 12 #import "base/mac/scoped_nsexception_enabler.h" |
| 12 #import "base/mac/scoped_nsobject.h" | 13 #import "base/mac/scoped_nsobject.h" |
| 13 #import "base/mac/scoped_objc_class_swizzler.h" | 14 #import "base/mac/scoped_objc_class_swizzler.h" |
| 14 #import "base/metrics/histogram.h" | 15 #import "base/metrics/histogram.h" |
| 15 #include "base/profiler/scoped_tracker.h" | 16 #include "base/profiler/scoped_tracker.h" |
| 16 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
| 17 #import "base/strings/sys_string_conversions.h" | 18 #import "base/strings/sys_string_conversions.h" |
| 18 #import "chrome/browser/app_controller_mac.h" | 19 #import "chrome/browser/app_controller_mac.h" |
| 19 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" | 20 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" |
| 21 #include "chrome/common/chrome_switches.h" | |
| 20 #include "chrome/common/crash_keys.h" | 22 #include "chrome/common/crash_keys.h" |
| 21 #import "chrome/common/mac/objc_zombie.h" | 23 #import "chrome/common/mac/objc_zombie.h" |
| 22 #include "content/public/browser/browser_accessibility_state.h" | 24 #include "content/public/browser/browser_accessibility_state.h" |
| 23 #include "content/public/browser/render_view_host.h" | 25 #include "content/public/browser/render_view_host.h" |
| 24 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
| 25 | 27 |
| 26 namespace { | 28 namespace { |
| 27 | 29 |
| 28 // Tracking for cases being hit by -crInitWithName:reason:userInfo:. | 30 // Tracking for cases being hit by -crInitWithName:reason:userInfo:. |
| 29 enum ExceptionEventType { | 31 enum ExceptionEventType { |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 480 case NSLeftMouseDragged: | 482 case NSLeftMouseDragged: |
| 481 case NSRightMouseDragged: | 483 case NSRightMouseDragged: |
| 482 case NSMouseEntered: | 484 case NSMouseEntered: |
| 483 case NSMouseExited: | 485 case NSMouseExited: |
| 484 case NSOtherMouseDown: | 486 case NSOtherMouseDown: |
| 485 case NSOtherMouseUp: | 487 case NSOtherMouseUp: |
| 486 case NSOtherMouseDragged: { | 488 case NSOtherMouseDragged: { |
| 487 tracked_objects::ScopedTracker tracking_profile( | 489 tracked_objects::ScopedTracker tracking_profile( |
| 488 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 490 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 489 "463272 -[BrowserCrApplication sendEvent:] Mouse")); | 491 "463272 -[BrowserCrApplication sendEvent:] Mouse")); |
| 490 base::mac::ScopedSendingEvent sendingEventScoper; | 492 |
| 491 [super sendEvent:event]; | 493 const bool isLeftMouseMenu = (event.type == NSLeftMouseDown) && |
| 494 ([event modifierFlags] & NSControlKeyMask); | |
| 495 | |
| 496 // swallow the events when in kiosk mode to prevent context menu. | |
|
Peter Kasting
2015/06/24 21:54:37
Nit: How about:
In kiosk mode, we want to prevent
frederic.jacob.78
2015/06/24 22:34:29
No problem with that. I am speaking French, so I n
| |
| 497 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 498 switches::kKioskMode) || | |
| 499 ((event.type != NSRightMouseDown) && | |
| 500 !isLeftMouseMenu)) { | |
| 501 base::mac::ScopedSendingEvent sendingEventScoper; | |
| 502 [super sendEvent:event]; | |
| 503 } | |
| 492 break; | 504 break; |
| 493 } | 505 } |
| 494 | 506 |
| 495 case NSKeyDown: | 507 case NSKeyDown: |
| 496 case NSKeyUp: { | 508 case NSKeyUp: { |
| 497 tracked_objects::ScopedTracker tracking_profile( | 509 tracked_objects::ScopedTracker tracking_profile( |
| 498 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 510 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 499 "463272 -[BrowserCrApplication sendEvent:] Key")); | 511 "463272 -[BrowserCrApplication sendEvent:] Key")); |
| 500 base::mac::ScopedSendingEvent sendingEventScoper; | 512 base::mac::ScopedSendingEvent sendingEventScoper; |
| 501 [super sendEvent:event]; | 513 [super sendEvent:event]; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 685 std::vector<NSWindow*>::iterator window_iterator = | 697 std::vector<NSWindow*>::iterator window_iterator = |
| 686 std::find(previousKeyWindows_.begin(), | 698 std::find(previousKeyWindows_.begin(), |
| 687 previousKeyWindows_.end(), | 699 previousKeyWindows_.end(), |
| 688 window); | 700 window); |
| 689 if (window_iterator != previousKeyWindows_.end()) { | 701 if (window_iterator != previousKeyWindows_.end()) { |
| 690 previousKeyWindows_.erase(window_iterator); | 702 previousKeyWindows_.erase(window_iterator); |
| 691 } | 703 } |
| 692 } | 704 } |
| 693 | 705 |
| 694 @end | 706 @end |
| OLD | NEW |