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

Side by Side Diff: chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm

Issue 10823176: Cocoa: Support constrained windows for platform apps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment 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 "chrome/browser/ui/cocoa/extensions/shell_window_cocoa.h" 5 #include "chrome/browser/ui/cocoa/extensions/shell_window_cocoa.h"
6 6
7 #include "base/mac/mac_util.h" 7 #include "base/mac/mac_util.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/cocoa/browser_window_utils.h" 10 #include "chrome/browser/ui/cocoa/browser_window_utils.h"
11 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" 11 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h"
12 #include "chrome/browser/ui/tab_contents/tab_contents.h"
jeremya 2012/08/05 22:32:47 I don't think you need this include.
12 #include "chrome/common/extensions/extension.h" 13 #include "chrome/common/extensions/extension.h"
13 #include "content/public/browser/render_widget_host_view.h" 14 #include "content/public/browser/render_widget_host_view.h"
14 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
15 #include "content/public/browser/web_contents_view.h" 16 #include "content/public/browser/web_contents_view.h"
16 #import "ui/base/cocoa/underlay_opengl_hosting_window.h" 17 #import "ui/base/cocoa/underlay_opengl_hosting_window.h"
17 18
18 @interface NSWindow (NSPrivateApis) 19 @interface NSWindow (NSPrivateApis)
19 - (void)setBottomCornerRounded:(BOOL)rounded; 20 - (void)setBottomCornerRounded:(BOOL)rounded;
20 @end 21 @end
21 22
(...skipping 19 matching lines...) Expand all
41 - (void)windowDidBecomeKey:(NSNotification*)notification { 42 - (void)windowDidBecomeKey:(NSNotification*)notification {
42 if (shellWindow_) 43 if (shellWindow_)
43 shellWindow_->WindowDidBecomeKey(); 44 shellWindow_->WindowDidBecomeKey();
44 } 45 }
45 46
46 - (void)windowDidResignKey:(NSNotification*)notification { 47 - (void)windowDidResignKey:(NSNotification*)notification {
47 if (shellWindow_) 48 if (shellWindow_)
48 shellWindow_->WindowDidResignKey(); 49 shellWindow_->WindowDidResignKey();
49 } 50 }
50 51
52 - (void)gtm_systemRequestsVisibilityForView:(NSView*)view {
53 [[self window] makeKeyAndOrderFront:self];
54 }
55
56 - (void)attachConstrainedWindow:(ConstrainedWindowMac*)window {
57 if (!sheetController_.get()) {
58 sheetController_.reset([[GTMWindowSheetController alloc]
59 initWithWindow:[self window]
60 delegate:self]);
61 }
62
63 NSView* tabContentsView =
64 [window->owner()->web_contents()->GetNativeView() superview];
65 window->delegate()->RunSheet(sheetController_, tabContentsView);
66 }
67
68 - (void)removeConstrainedWindow:(ConstrainedWindowMac*)window {
jeremya 2012/08/05 22:32:47 Is this NOTREACHED()?
69 }
70
71 - (BOOL)canAttachConstrainedWindow {
72 return YES;
73 }
74
51 @end 75 @end
52 76
53 @interface ShellNSWindow : UnderlayOpenGLHostingWindow 77 @interface ShellNSWindow : UnderlayOpenGLHostingWindow
54 78
55 - (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view; 79 - (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view;
56 80
57 @end 81 @end
58 82
59 // This is really a method on NSGrayFrame, so it should only be called on the 83 // This is really a method on NSGrayFrame, so it should only be called on the
60 // view passed into -[NSWindow drawCustomFrameRect:forView:]. 84 // view passed into -[NSWindow drawCustomFrameRect:forView:].
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 return [window_controller_ window]; 348 return [window_controller_ window];
325 } 349 }
326 350
327 // static 351 // static
328 ShellWindow* ShellWindow::CreateImpl(Profile* profile, 352 ShellWindow* ShellWindow::CreateImpl(Profile* profile,
329 const extensions::Extension* extension, 353 const extensions::Extension* extension,
330 const GURL& url, 354 const GURL& url,
331 const ShellWindow::CreateParams& params) { 355 const ShellWindow::CreateParams& params) {
332 return new ShellWindowCocoa(profile, extension, url, params); 356 return new ShellWindowCocoa(profile, extension, url, params);
333 } 357 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698