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

Side by Side Diff: ui/views_content_client/views_content_client_main_parts_mac.mm

Issue 782673002: MacViews: tryjobs for toolkit_views=1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: latest crrev/901823002 Created 5 years, 10 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
« no previous file with comments | « ui/views/widget/widget_interactive_uitest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/mac/scoped_nsobject.h" 8 #include "base/mac/scoped_nsobject.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "content/public/browser/plugin_service.h" 10 #include "content/public/browser/plugin_service.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 - (void)applicationDidFinishLaunching:(NSNotification*)aNotification { 98 - (void)applicationDidFinishLaunching:(NSNotification*)aNotification {
99 // To get key events, the application needs to have an activation policy. 99 // To get key events, the application needs to have an activation policy.
100 // Unbundled apps (i.e. those without an Info.plist) default to 100 // Unbundled apps (i.e. those without an Info.plist) default to
101 // NSApplicationActivationPolicyProhibited. 101 // NSApplicationActivationPolicyProhibited.
102 [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; 102 [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
103 103
104 // Create a basic mainMenu object using the executable filename. 104 // Create a basic mainMenu object using the executable filename.
105 base::scoped_nsobject<NSMenu> mainMenu([[NSMenu alloc] initWithTitle:@""]); 105 base::scoped_nsobject<NSMenu> mainMenu([[NSMenu alloc] initWithTitle:@""]);
106 NSMenuItem* appMenuItem = 106 NSMenuItem* appMenuItem =
107 [mainMenu addItemWithTitle:@"" action:NULL keyEquivalent:@""]; 107 [mainMenu addItemWithTitle:@"" action:nullptr keyEquivalent:@""];
108 NSMenuItem* editMenuItem =
109 [mainMenu addItemWithTitle:@"" action:nullptr keyEquivalent:@""];
108 [NSApp setMainMenu:mainMenu]; 110 [NSApp setMainMenu:mainMenu];
109 111
110 base::scoped_nsobject<NSMenu> appMenu([[NSMenu alloc] initWithTitle:@""]); 112 base::scoped_nsobject<NSMenu> appMenu([[NSMenu alloc] initWithTitle:@""]);
111 NSString* appName = [[NSProcessInfo processInfo] processName]; 113 NSString* appName = [[NSProcessInfo processInfo] processName];
112 // TODO(tapted): Localize "Quit" if this is ever used for a released binary. 114 // TODO(tapted): Localize "Quit" if this is ever used for a released binary.
113 // At the time of writing, ui_strings.grd has "Close" but not "Quit". 115 // At the time of writing, ui_strings.grd has "Close" but not "Quit".
114 NSString* quitTitle = [@"Quit " stringByAppendingString:appName]; 116 NSString* quitTitle = [@"Quit " stringByAppendingString:appName];
115 [appMenu addItemWithTitle:quitTitle 117 [appMenu addItemWithTitle:quitTitle
116 action:@selector(terminate:) 118 action:@selector(terminate:)
117 keyEquivalent:@"q"]; 119 keyEquivalent:@"q"];
118 [appMenuItem setSubmenu:appMenu]; 120 [appMenuItem setSubmenu:appMenu];
119 121
122 base::scoped_nsobject<NSMenu> editMenu(
123 [[NSMenu alloc] initWithTitle:@"Edit"]);
124 struct {
125 NSString* title;
126 SEL action;
127 NSString* key_equivalent;
128 } edit_menu_item[] = {
129 { @"Undo", @selector(undo:), @"z" },
130 { @"Redo", @selector(redo:), @"Z" },
131 { @"Copy", @selector(copy:), @"c" },
132 { @"Cut", @selector(cut:), @"x" },
133 { @"Paste", @selector(paste:), @"v" },
134 { @"Select All", @selector(selectAll:), @"a" },
135 };
136 for (size_t i = 0; i < arraysize(edit_menu_item); ++i) {
137 [editMenu insertItemWithTitle:edit_menu_item[i].title
138 action:edit_menu_item[i].action
139 keyEquivalent:edit_menu_item[i].key_equivalent
140 atIndex:i];
141 }
142 [editMenuItem setSubmenu:editMenu];
143
120 task_.Run(); 144 task_.Run();
121 } 145 }
122 146
123 @end 147 @end
OLDNEW
« no previous file with comments | « ui/views/widget/widget_interactive_uitest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698