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

Side by Side Diff: content/shell/shell_mac.mm

Issue 10823263: Add Debug menu to Mac Content Shell. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
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 "content/shell/shell.h" 5 #include "content/shell/shell.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 - (void)performAction:(id)sender { 76 - (void)performAction:(id)sender {
77 shell_->ActionPerformed([sender tag]); 77 shell_->ActionPerformed([sender tag]);
78 } 78 }
79 79
80 - (void)takeURLStringValueFrom:(id)sender { 80 - (void)takeURLStringValueFrom:(id)sender {
81 shell_->URLEntered(base::SysNSStringToUTF8([sender stringValue])); 81 shell_->URLEntered(base::SysNSStringToUTF8([sender stringValue]));
82 } 82 }
83 83
84 @end 84 @end
85 85
86 @interface CrShellWindow : UnderlayOpenGLHostingWindow {
87 @private
88 content::Shell* shell_;
89 }
90 - (void)setShell:(content::Shell*)shell;
91 - (void)showDevTools:(id)sender;
92 @end
93
94 @implementation CrShellWindow
95
96 - (void)setShell:(content::Shell*)shell {
97 shell_ = shell;
98 }
99
100 - (void)showDevTools:(id)sender {
101 shell_->ShowDevTools();
102 }
103
104 @end
105
86 namespace { 106 namespace {
87 107
88 NSString* kWindowTitle = @"Content Shell"; 108 NSString* kWindowTitle = @"Content Shell";
89 109
90 // Layout constants (in view coordinates) 110 // Layout constants (in view coordinates)
91 const CGFloat kButtonWidth = 72; 111 const CGFloat kButtonWidth = 72;
92 const CGFloat kURLBarHeight = 24; 112 const CGFloat kURLBarHeight = 24;
93 113
94 // The minimum size of the window's content (in view coordinates) 114 // The minimum size of the window's content (in view coordinates)
95 const CGFloat kMinimumWindowWidth = 400; 115 const CGFloat kMinimumWindowWidth = 400;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 NSMakeRect(0, 0, width, height + kURLBarHeight); 181 NSMakeRect(0, 0, width, height + kURLBarHeight);
162 NSRect content_rect = initial_window_bounds; 182 NSRect content_rect = initial_window_bounds;
163 NSUInteger style_mask = NSTitledWindowMask | 183 NSUInteger style_mask = NSTitledWindowMask |
164 NSClosableWindowMask | 184 NSClosableWindowMask |
165 NSMiniaturizableWindowMask | 185 NSMiniaturizableWindowMask |
166 NSResizableWindowMask; 186 NSResizableWindowMask;
167 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { 187 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) {
168 content_rect = NSOffsetRect(initial_window_bounds, -10000, -10000); 188 content_rect = NSOffsetRect(initial_window_bounds, -10000, -10000);
169 style_mask = NSBorderlessWindowMask; 189 style_mask = NSBorderlessWindowMask;
170 } 190 }
171 window_ = [[UnderlayOpenGLHostingWindow alloc] 191 CrShellWindow* window =
172 initWithContentRect:content_rect 192 [[CrShellWindow alloc] initWithContentRect:content_rect
173 styleMask:style_mask 193 styleMask:style_mask
174 backing:NSBackingStoreBuffered 194 backing:NSBackingStoreBuffered
175 defer:NO]; 195 defer:NO];
196 window_ = window;
197 [window setShell:this];
176 [window_ setTitle:kWindowTitle]; 198 [window_ setTitle:kWindowTitle];
177 NSView* content = [window_ contentView]; 199 NSView* content = [window_ contentView];
178 200
179 // If the window is allowed to get too small, it will wreck the view bindings. 201 // If the window is allowed to get too small, it will wreck the view bindings.
180 NSSize min_size = NSMakeSize(kMinimumWindowWidth, kMinimumWindowHeight); 202 NSSize min_size = NSMakeSize(kMinimumWindowWidth, kMinimumWindowHeight);
181 min_size = [content convertSize:min_size toView:nil]; 203 min_size = [content convertSize:min_size toView:nil];
182 // Note that this takes window coordinates. 204 // Note that this takes window coordinates.
183 [window_ setContentMinSize:min_size]; 205 [window_ setContentMinSize:min_size];
184 206
185 // Set the shell window to participate in Lion Fullscreen mode. Set 207 // Set the shell window to participate in Lion Fullscreen mode. Set
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 [[event.os_event characters] isEqual:@"l"]) { 314 [[event.os_event characters] isEqual:@"l"]) {
293 [window_ makeFirstResponder:url_edit_view_]; 315 [window_ makeFirstResponder:url_edit_view_];
294 return; 316 return;
295 } 317 }
296 318
297 [[NSApp mainMenu] performKeyEquivalent:event.os_event]; 319 [[NSApp mainMenu] performKeyEquivalent:event.os_event];
298 } 320 }
299 } 321 }
300 322
301 } // namespace content 323 } // namespace content
OLDNEW
« content/shell/mac/English.lproj/MainMenu.xib ('K') | « content/shell/shell_browser_main_parts.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698