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

Side by Side Diff: ui/views/cocoa/bridged_content_view.mm

Issue 987323002: [MacViews] Frameless app windows: make content view cover title bar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 5 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
« no previous file with comments | « chrome/chrome_browser_ui.gypi ('k') | ui/views/widget/native_widget_mac.h » ('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 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 "ui/views/cocoa/bridged_content_view.h" 5 #import "ui/views/cocoa/bridged_content_view.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #import "base/mac/scoped_nsobject.h" 8 #import "base/mac/scoped_nsobject.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "ui/base/ime/text_input_client.h" 10 #include "ui/base/ime/text_input_client.h"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 domCode:ui::DomCode::KEY_A 241 domCode:ui::DomCode::KEY_A
242 eventFlags:ui::EF_CONTROL_DOWN]; 242 eventFlags:ui::EF_CONTROL_DOWN];
243 } 243 }
244 244
245 // NSView implementation. 245 // NSView implementation.
246 246
247 - (BOOL)acceptsFirstResponder { 247 - (BOOL)acceptsFirstResponder {
248 return YES; 248 return YES;
249 } 249 }
250 250
251 - (void)viewDidMoveToWindow {
252 // When this view is added to a window, AppKit calls setFrameSize before it is
253 // added to the window, so the behavior in setFrameSize is not triggered.
254 NSWindow* window = [self window];
255 if (window)
256 [self setFrameSize:NSZeroSize];
257 }
258
251 - (void)setFrameSize:(NSSize)newSize { 259 - (void)setFrameSize:(NSSize)newSize {
260 // The size passed in here does not always use
261 // -[NSWindow contentRectForFrameRect]. The following ensures that the
262 // contentView for a frameless window can extend over the titlebar of the new
263 // window containing it, since AppKit requires a titlebar to give frameless
264 // windows correct shadows and rounded corners.
265 NSWindow* window = [self window];
266 if (window)
267 newSize = [window contentRectForFrameRect:[window frame]].size;
268
252 [super setFrameSize:newSize]; 269 [super setFrameSize:newSize];
253 if (!hostedView_) 270 if (!hostedView_)
254 return; 271 return;
255 272
256 hostedView_->SetSize(gfx::Size(newSize.width, newSize.height)); 273 hostedView_->SetSize(gfx::Size(newSize.width, newSize.height));
257 } 274 }
258 275
259 - (void)drawRect:(NSRect)dirtyRect { 276 - (void)drawRect:(NSRect)dirtyRect {
260 // Note that BridgedNativeWidget uses -[NSWindow setAutodisplay:NO] to 277 // Note that BridgedNativeWidget uses -[NSWindow setAutodisplay:NO] to
261 // suppress calls to this when the window is known to be hidden. 278 // suppress calls to this when the window is known to be hidden.
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 } 720 }
704 721
705 return [super accessibilityAttributeValue:attribute]; 722 return [super accessibilityAttributeValue:attribute];
706 } 723 }
707 724
708 - (id)accessibilityHitTest:(NSPoint)point { 725 - (id)accessibilityHitTest:(NSPoint)point {
709 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point]; 726 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point];
710 } 727 }
711 728
712 @end 729 @end
OLDNEW
« no previous file with comments | « chrome/chrome_browser_ui.gypi ('k') | ui/views/widget/native_widget_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698