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

Side by Side Diff: chrome/browser/chrome_browser_application_mac.mm

Issue 1091173005: Removed the context menu in kiosk mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed the comments Created 5 years, 6 months 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 (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
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) &&
Dan Beam 2015/06/25 00:36:15 nit: event.type == NSLeftMouseDown && (no need fo
frederic.jacob.78 2015/06/25 22:25:34 Done.
494 ([event modifierFlags] & NSControlKeyMask);
495
496 // In kiosk mode, we want to prevent context menus from appearing,
497 // so simply discard menu-generating events instead of passing them along.
498 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
499 switches::kKioskMode) ||
500 ((event.type != NSRightMouseDown) &&
Dan Beam 2015/06/25 00:36:15 same: extra parens
frederic.jacob.78 2015/06/25 22:25:34 Done.
501 !isLeftMouseMenu)) {
502 base::mac::ScopedSendingEvent sendingEventScoper;
503 [super sendEvent:event];
504 }
492 break; 505 break;
493 } 506 }
494 507
495 case NSKeyDown: 508 case NSKeyDown:
496 case NSKeyUp: { 509 case NSKeyUp: {
497 tracked_objects::ScopedTracker tracking_profile( 510 tracked_objects::ScopedTracker tracking_profile(
498 FROM_HERE_WITH_EXPLICIT_FUNCTION( 511 FROM_HERE_WITH_EXPLICIT_FUNCTION(
499 "463272 -[BrowserCrApplication sendEvent:] Key")); 512 "463272 -[BrowserCrApplication sendEvent:] Key"));
500 base::mac::ScopedSendingEvent sendingEventScoper; 513 base::mac::ScopedSendingEvent sendingEventScoper;
501 [super sendEvent:event]; 514 [super sendEvent:event];
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 std::vector<NSWindow*>::iterator window_iterator = 698 std::vector<NSWindow*>::iterator window_iterator =
686 std::find(previousKeyWindows_.begin(), 699 std::find(previousKeyWindows_.begin(),
687 previousKeyWindows_.end(), 700 previousKeyWindows_.end(),
688 window); 701 window);
689 if (window_iterator != previousKeyWindows_.end()) { 702 if (window_iterator != previousKeyWindows_.end()) {
690 previousKeyWindows_.erase(window_iterator); 703 previousKeyWindows_.erase(window_iterator);
691 } 704 }
692 } 705 }
693 706
694 @end 707 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698