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

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

Issue 2458833005: Move printing defines to buildflag system. (Closed)
Patch Set: Merge Created 4 years, 1 month 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
« no previous file with comments | « chrome/browser/ui/browser_commands.cc ('k') | chrome/browser/ui/libgtkui/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/accelerators_cocoa.h" 5 #include "chrome/browser/ui/cocoa/accelerators_cocoa.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/singleton.h" 14 #include "base/memory/singleton.h"
15 #include "chrome/app/chrome_command_ids.h" 15 #include "chrome/app/chrome_command_ids.h"
16 #include "printing/features/features.h"
16 #import "ui/base/accelerators/platform_accelerator_cocoa.h" 17 #import "ui/base/accelerators/platform_accelerator_cocoa.h"
17 #import "ui/events/cocoa/cocoa_event_utils.h" 18 #import "ui/events/cocoa/cocoa_event_utils.h"
18 #import "ui/events/keycodes/keyboard_code_conversion_mac.h" 19 #import "ui/events/keycodes/keyboard_code_conversion_mac.h"
19 20
20 namespace { 21 namespace {
21 22
22 // These accelerators are not associated with a command_id. 23 // These accelerators are not associated with a command_id.
23 const struct AcceleratorListing { 24 const struct AcceleratorListing {
24 NSUInteger modifiers; // The Cocoa modifiers. 25 NSUInteger modifiers; // The Cocoa modifiers.
25 ui::KeyboardCode key_code; // The key used for cross-platform compatibility. 26 ui::KeyboardCode key_code; // The key used for cross-platform compatibility.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 {IDC_ZOOM_MINUS, NSCommandKeyMask, ui::VKEY_OEM_MINUS}, 66 {IDC_ZOOM_MINUS, NSCommandKeyMask, ui::VKEY_OEM_MINUS},
66 {IDC_ZOOM_PLUS, NSCommandKeyMask | NSShiftKeyMask, ui::VKEY_OEM_PLUS}, 67 {IDC_ZOOM_PLUS, NSCommandKeyMask | NSShiftKeyMask, ui::VKEY_OEM_PLUS},
67 68
68 // Accelerators used in MainMenu.xib, but not the toolbar menu. 69 // Accelerators used in MainMenu.xib, but not the toolbar menu.
69 {IDC_HIDE_APP, NSCommandKeyMask, ui::VKEY_H}, 70 {IDC_HIDE_APP, NSCommandKeyMask, ui::VKEY_H},
70 {IDC_EXIT, NSCommandKeyMask, ui::VKEY_Q}, 71 {IDC_EXIT, NSCommandKeyMask, ui::VKEY_Q},
71 {IDC_OPEN_FILE, NSCommandKeyMask, ui::VKEY_O}, 72 {IDC_OPEN_FILE, NSCommandKeyMask, ui::VKEY_O},
72 {IDC_FOCUS_LOCATION, NSCommandKeyMask, ui::VKEY_L}, 73 {IDC_FOCUS_LOCATION, NSCommandKeyMask, ui::VKEY_L},
73 {IDC_CLOSE_WINDOW, NSCommandKeyMask, ui::VKEY_W}, 74 {IDC_CLOSE_WINDOW, NSCommandKeyMask, ui::VKEY_W},
74 {IDC_EMAIL_PAGE_LOCATION, NSCommandKeyMask | NSShiftKeyMask, ui::VKEY_I}, 75 {IDC_EMAIL_PAGE_LOCATION, NSCommandKeyMask | NSShiftKeyMask, ui::VKEY_I},
75 #if defined(ENABLE_BASIC_PRINTING) 76 #if BUILDFLAG(ENABLE_BASIC_PRINTING)
76 {IDC_BASIC_PRINT, NSCommandKeyMask | NSAlternateKeyMask, ui::VKEY_P}, 77 {IDC_BASIC_PRINT, NSCommandKeyMask | NSAlternateKeyMask, ui::VKEY_P},
77 #endif // ENABLE_BASIC_PRINTING 78 #endif // ENABLE_BASIC_PRINTING
78 {IDC_CONTENT_CONTEXT_UNDO, NSCommandKeyMask, ui::VKEY_Z}, 79 {IDC_CONTENT_CONTEXT_UNDO, NSCommandKeyMask, ui::VKEY_Z},
79 {IDC_CONTENT_CONTEXT_REDO, NSCommandKeyMask | NSShiftKeyMask, ui::VKEY_Z}, 80 {IDC_CONTENT_CONTEXT_REDO, NSCommandKeyMask | NSShiftKeyMask, ui::VKEY_Z},
80 {IDC_CONTENT_CONTEXT_CUT, NSCommandKeyMask, ui::VKEY_X}, 81 {IDC_CONTENT_CONTEXT_CUT, NSCommandKeyMask, ui::VKEY_X},
81 {IDC_CONTENT_CONTEXT_COPY, NSCommandKeyMask, ui::VKEY_C}, 82 {IDC_CONTENT_CONTEXT_COPY, NSCommandKeyMask, ui::VKEY_C},
82 {IDC_CONTENT_CONTEXT_PASTE, NSCommandKeyMask, ui::VKEY_V}, 83 {IDC_CONTENT_CONTEXT_PASTE, NSCommandKeyMask, ui::VKEY_V},
83 {IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE, 84 {IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE,
84 NSCommandKeyMask | NSShiftKeyMask, ui::VKEY_V}, 85 NSCommandKeyMask | NSShiftKeyMask, ui::VKEY_V},
85 {IDC_CONTENT_CONTEXT_SELECTALL, NSCommandKeyMask, ui::VKEY_A}, 86 {IDC_CONTENT_CONTEXT_SELECTALL, NSCommandKeyMask, ui::VKEY_A},
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 NSUInteger mask = platform_accelerator->modifier_mask(); 186 NSUInteger mask = platform_accelerator->modifier_mask();
186 BOOL maskEqual = 187 BOOL maskEqual =
187 (mask == modifiers) || ((mask & (~NSShiftKeyMask)) == modifiers); 188 (mask == modifiers) || ((mask & (~NSShiftKeyMask)) == modifiers);
188 NSString* string = [NSString stringWithFormat:@"%C", shifted_character]; 189 NSString* string = [NSString stringWithFormat:@"%C", shifted_character];
189 if ([string isEqual:key_equivalent] && maskEqual) 190 if ([string isEqual:key_equivalent] && maskEqual)
190 return &*it; 191 return &*it;
191 } 192 }
192 193
193 return NULL; 194 return NULL;
194 } 195 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_commands.cc ('k') | chrome/browser/ui/libgtkui/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698