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

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: Change Cocoa codes and fix style problems after reviews" 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 const base::CommandLine* command_line =
Robert Sesek 2015/06/24 18:36:12 nit: blank line before
Robert Sesek 2015/06/24 18:36:12 naming: commandLine
frederic.jacob.78 2015/06/24 21:35:03 Acknowledged.
frederic.jacob.78 2015/06/24 21:35:03 Done.
491 [super sendEvent:event]; 493 base::CommandLine::ForCurrentProcess();
494 const bool kioskMode = command_line->HasSwitch(switches::kKioskMode);
Peter Kasting 2015/06/24 20:40:56 Nit: Personally I think the explosion of temps her
frederic.jacob.78 2015/06/24 21:35:03 I finally changed the code to only use the isLeftM
495 const bool isRightMouseMenu = (event.type == NSRightMouseDown);
496 const bool isLeftMouseMenu = (event.type == NSLeftMouseDown) &&
497 ([event modifierFlags] & NSControlKeyMask);
498
499 if (!kioskMode || (!isRightMouseMenu && !isLeftMouseMenu)) {
Robert Sesek 2015/06/24 18:36:12 Leave a comment as to why this is here.
frederic.jacob.78 2015/06/24 21:35:03 Done.
500 base::mac::ScopedSendingEvent sendingEventScoper;
501 [super sendEvent:event];
502 }
492 break; 503 break;
493 } 504 }
494 505
495 case NSKeyDown: 506 case NSKeyDown:
496 case NSKeyUp: { 507 case NSKeyUp: {
497 tracked_objects::ScopedTracker tracking_profile( 508 tracked_objects::ScopedTracker tracking_profile(
498 FROM_HERE_WITH_EXPLICIT_FUNCTION( 509 FROM_HERE_WITH_EXPLICIT_FUNCTION(
499 "463272 -[BrowserCrApplication sendEvent:] Key")); 510 "463272 -[BrowserCrApplication sendEvent:] Key"));
500 base::mac::ScopedSendingEvent sendingEventScoper; 511 base::mac::ScopedSendingEvent sendingEventScoper;
501 [super sendEvent:event]; 512 [super sendEvent:event];
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 std::vector<NSWindow*>::iterator window_iterator = 696 std::vector<NSWindow*>::iterator window_iterator =
686 std::find(previousKeyWindows_.begin(), 697 std::find(previousKeyWindows_.begin(),
687 previousKeyWindows_.end(), 698 previousKeyWindows_.end(),
688 window); 699 window);
689 if (window_iterator != previousKeyWindows_.end()) { 700 if (window_iterator != previousKeyWindows_.end()) {
690 previousKeyWindows_.erase(window_iterator); 701 previousKeyWindows_.erase(window_iterator);
691 } 702 }
692 } 703 }
693 704
694 @end 705 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698