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

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_cocoa.mm

Issue 2775553002: Adds the ability for WebContentsDelegate to decide if event should be updated (Closed)
Patch Set: Fix compile Created 3 years, 9 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 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" 5 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #import "base/mac/sdk_forward_declarations.h" 10 #import "base/mac/sdk_forward_declarations.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 #include "chrome/browser/ui/tabs/tab_strip_model.h" 51 #include "chrome/browser/ui/tabs/tab_strip_model.h"
52 #include "chrome/browser/web_applications/web_app.h" 52 #include "chrome/browser/web_applications/web_app.h"
53 #include "chrome/common/chrome_switches.h" 53 #include "chrome/common/chrome_switches.h"
54 #include "chrome/common/features.h" 54 #include "chrome/common/features.h"
55 #include "chrome/common/pref_names.h" 55 #include "chrome/common/pref_names.h"
56 #include "chrome/grit/generated_resources.h" 56 #include "chrome/grit/generated_resources.h"
57 #include "components/bookmarks/common/bookmark_pref_names.h" 57 #include "components/bookmarks/common/bookmark_pref_names.h"
58 #include "components/prefs/pref_service.h" 58 #include "components/prefs/pref_service.h"
59 #include "components/strings/grit/components_strings.h" 59 #include "components/strings/grit/components_strings.h"
60 #include "components/translate/core/browser/language_state.h" 60 #include "components/translate/core/browser/language_state.h"
61 #include "content/public/browser/keyboard_event_processing_result.h"
61 #include "content/public/browser/native_web_keyboard_event.h" 62 #include "content/public/browser/native_web_keyboard_event.h"
62 #include "content/public/browser/notification_details.h" 63 #include "content/public/browser/notification_details.h"
63 #include "content/public/browser/notification_service.h" 64 #include "content/public/browser/notification_service.h"
64 #include "content/public/browser/notification_source.h" 65 #include "content/public/browser/notification_source.h"
65 #include "content/public/browser/web_contents.h" 66 #include "content/public/browser/web_contents.h"
66 #include "extensions/browser/extension_registry.h" 67 #include "extensions/browser/extension_registry.h"
67 #include "extensions/browser/extension_system.h" 68 #include "extensions/browser/extension_system.h"
68 #include "extensions/common/constants.h" 69 #include "extensions/common/constants.h"
69 #include "ui/base/l10n/l10n_util_mac.h" 70 #include "ui/base/l10n/l10n_util_mac.h"
70 #include "ui/base/material_design/material_design_controller.h" 71 #include "ui/base/material_design/material_design_controller.h"
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 const GURL& virtual_url, 688 const GURL& virtual_url,
688 const security_state::SecurityInfo& security_info) { 689 const security_state::SecurityInfo& security_info) {
689 WebsiteSettingsUIBridge::Show(window(), profile, web_contents, virtual_url, 690 WebsiteSettingsUIBridge::Show(window(), profile, web_contents, virtual_url,
690 security_info); 691 security_info);
691 } 692 }
692 693
693 void BrowserWindowCocoa::ShowAppMenu() { 694 void BrowserWindowCocoa::ShowAppMenu() {
694 // No-op. Mac doesn't support showing the menus via alt keys. 695 // No-op. Mac doesn't support showing the menus via alt keys.
695 } 696 }
696 697
697 bool BrowserWindowCocoa::PreHandleKeyboardEvent( 698 content::KeyboardEventProcessingResult
698 const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) { 699 BrowserWindowCocoa::PreHandleKeyboardEvent(
700 const NativeWebKeyboardEvent& event) {
699 // Handle ESC to dismiss permission bubbles, but still forward it 701 // Handle ESC to dismiss permission bubbles, but still forward it
700 // to the window afterwards. 702 // to the window afterwards.
701 if (event.windowsKeyCode == ui::VKEY_ESCAPE) 703 if (event.windowsKeyCode == ui::VKEY_ESCAPE)
702 [controller_ dismissPermissionBubble]; 704 [controller_ dismissPermissionBubble];
703 705
704 if (![BrowserWindowUtils shouldHandleKeyboardEvent:event]) 706 if (![BrowserWindowUtils shouldHandleKeyboardEvent:event])
705 return false; 707 return content::KeyboardEventProcessingResult::NOT_HANDLED;
706 708
707 if (event.type() == blink::WebInputEvent::RawKeyDown && 709 if (event.type() == blink::WebInputEvent::RawKeyDown &&
708 [controller_ 710 [controller_
709 handledByExtensionCommand:event.os_event 711 handledByExtensionCommand:event.os_event
710 priority:ui::AcceleratorManager::kHighPriority]) 712 priority:ui::AcceleratorManager::kHighPriority])
711 return true; 713 return content::KeyboardEventProcessingResult::HANDLED;
712 714
713 int id = [BrowserWindowUtils getCommandId:event]; 715 int id = [BrowserWindowUtils getCommandId:event];
714 if (id == -1) 716 if (id == -1)
715 return false; 717 return content::KeyboardEventProcessingResult::NOT_HANDLED;
716 718
717 if (browser_->command_controller()->IsReservedCommandOrKey(id, event)) { 719 if (browser_->command_controller()->IsReservedCommandOrKey(id, event)) {
718 return [BrowserWindowUtils handleKeyboardEvent:event.os_event 720 return [BrowserWindowUtils handleKeyboardEvent:event.os_event
719 inWindow:window()]; 721 inWindow:window()]
722 ? content::KeyboardEventProcessingResult::HANDLED
723 : content::KeyboardEventProcessingResult::NOT_HANDLED;
720 } 724 }
721 725
722 DCHECK(is_keyboard_shortcut); 726 return content::KeyboardEventProcessingResult::NOT_HANDLED_IS_SHORTCUT;
723 *is_keyboard_shortcut = true;
724 return false;
725 } 727 }
726 728
727 void BrowserWindowCocoa::HandleKeyboardEvent( 729 void BrowserWindowCocoa::HandleKeyboardEvent(
728 const NativeWebKeyboardEvent& event) { 730 const NativeWebKeyboardEvent& event) {
729 if ([BrowserWindowUtils shouldHandleKeyboardEvent:event]) { 731 if ([BrowserWindowUtils shouldHandleKeyboardEvent:event]) {
730 if (![BrowserWindowUtils handleKeyboardEvent:event.os_event 732 if (![BrowserWindowUtils handleKeyboardEvent:event.os_event
731 inWindow:window()]) { 733 inWindow:window()]) {
732 734
733 // TODO(spqchan): This is a temporary fix for exit extension fullscreen. 735 // TODO(spqchan): This is a temporary fix for exit extension fullscreen.
734 // A priority system for exiting extension fullscreen when there is a 736 // A priority system for exiting extension fullscreen when there is a
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 ExclusiveAccessContext* BrowserWindowCocoa::GetExclusiveAccessContext() { 840 ExclusiveAccessContext* BrowserWindowCocoa::GetExclusiveAccessContext() {
839 return [controller_ exclusiveAccessController]; 841 return [controller_ exclusiveAccessController];
840 } 842 }
841 843
842 void BrowserWindowCocoa::ShowImeWarningBubble( 844 void BrowserWindowCocoa::ShowImeWarningBubble(
843 const extensions::Extension* extension, 845 const extensions::Extension* extension,
844 const base::Callback<void(ImeWarningBubblePermissionStatus status)>& 846 const base::Callback<void(ImeWarningBubblePermissionStatus status)>&
845 callback) { 847 callback) {
846 NOTREACHED() << "The IME warning bubble is unsupported on this platform."; 848 NOTREACHED() << "The IME warning bubble is unsupported on this platform.";
847 } 849 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_cocoa.h ('k') | chrome/browser/ui/views/frame/browser_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698