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

Unified 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: Add the FALL THROUGH comment Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « AUTHORS ('k') | chrome/browser/resources/ntp4/apps_page.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_browser_application_mac.mm
diff --git a/chrome/browser/chrome_browser_application_mac.mm b/chrome/browser/chrome_browser_application_mac.mm
index e648774a16a5bc68567109486ab69b097578272b..4f5dc4b41f7b190b61215c7319b2ff0292123d82 100644
--- a/chrome/browser/chrome_browser_application_mac.mm
+++ b/chrome/browser/chrome_browser_application_mac.mm
@@ -5,6 +5,7 @@
#import "chrome/browser/chrome_browser_application_mac.h"
#import "base/auto_reset.h"
+#include "base/command_line.h"
#include "base/debug/crash_logging.h"
#include "base/debug/stack_trace.h"
#import "base/logging.h"
@@ -17,6 +18,7 @@
#import "base/strings/sys_string_conversions.h"
#import "chrome/browser/app_controller_mac.h"
#include "chrome/browser/ui/tab_contents/tab_contents_iterator.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/crash_keys.h"
#import "chrome/common/mac/objc_zombie.h"
#include "content/public/browser/browser_accessibility_state.h"
@@ -473,8 +475,17 @@ void SwizzleInit() {
// instrumentations, so a big switch with each bunch instrumented is required.
switch (event.type) {
case NSLeftMouseDown:
+ case NSRightMouseDown: {
+ // In kiosk mode, we want to prevent context menus from appearing,
+ // so simply discard menu-generating events instead of passing them along.
+ bool kioskMode = base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kKioskMode);
+ bool ctrlDown = [event modifierFlags] & NSControlKeyMask;
+ if (kioskMode && ([event type] == NSRightMouseDown || ctrlDown))
+ break;
+ }
+ // FALL THROUGH
case NSLeftMouseUp:
- case NSRightMouseDown:
case NSRightMouseUp:
case NSMouseMoved:
case NSLeftMouseDragged:
« no previous file with comments | « AUTHORS ('k') | chrome/browser/resources/ntp4/apps_page.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698