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

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

Issue 10823149: Remove WebAuthFlowWindow and its implementation on all platforms. We don't need it anymore since we… (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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/cocoa/extensions/web_auth_flow_window_cocoa.h"
6
7 #include "base/sys_string_conversions.h"
8 #include "chrome/browser/ui/cocoa/browser_window_utils.h"
9 #include "content/public/browser/web_contents.h"
10 #include "content/public/browser/web_contents_view.h"
11 #import "ui/base/cocoa/underlay_opengl_hosting_window.h"
12
13 // A window controller for a minimal window to host a web app view. Passes
14 // Objective-C notifications to the C++ bridge.
15 @interface WebAuthFlowWindowController
16 : NSWindowController<NSWindowDelegate> {
17 @private
18 WebAuthFlowWindowCocoa* webAuthWindow_; // Weak; owns self.
19 }
20
21 @property(assign, nonatomic) WebAuthFlowWindowCocoa* webAuthWindow;
22
23 @end
24
25 @implementation WebAuthFlowWindowController
26
27 @synthesize webAuthWindow = webAuthWindow_;
28
29 - (void)windowWillClose:(NSNotification*)notification {
30 if (webAuthWindow_)
31 webAuthWindow_->WindowWillClose();
32 }
33
34 @end
35
36 WebAuthFlowWindowCocoa::WebAuthFlowWindowCocoa(
37 Delegate* delegate,
38 content::BrowserContext* browser_context,
39 content::WebContents* contents)
40 : WebAuthFlowWindow(delegate, browser_context, contents),
41 attention_request_id_(0) {
42 }
43
44 void WebAuthFlowWindowCocoa::Show() {
45 NSRect rect = NSMakeRect(0, 0, kDefaultWidth, kDefaultHeight);
46 NSUInteger styleMask = NSTitledWindowMask | NSClosableWindowMask |
47 NSMiniaturizableWindowMask | NSResizableWindowMask;
48 scoped_nsobject<NSWindow> window([[UnderlayOpenGLHostingWindow alloc]
49 initWithContentRect:rect
50 styleMask:styleMask
51 backing:NSBackingStoreBuffered
52 defer:NO]);
53
54 NSView* view = contents()->GetView()->GetNativeView();
55 [view setFrame:rect];
56 [view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
57 [[window contentView] addSubview:view];
58
59 window_controller_.reset(
60 [[WebAuthFlowWindowController alloc] initWithWindow:window.release()]);
61 [[window_controller_ window] setDelegate:window_controller_];
62 [window_controller_ setWebAuthWindow:this];
63
64 [[window_controller_ window] center];
65 [window_controller_ showWindow:nil];
66 }
67
68 void WebAuthFlowWindowCocoa::WindowWillClose() {
69 if (delegate())
70 delegate()->OnClose();
71 }
72
73 WebAuthFlowWindowCocoa::~WebAuthFlowWindowCocoa() {
74 [window_controller_ setWebAuthWindow:NULL];
75 [window_controller_ close];
76 }
77
78 // static
79 WebAuthFlowWindow* WebAuthFlowWindow::Create(
80 Delegate* delegate,
81 content::BrowserContext* browser_context,
82 content::WebContents* contents) {
83 return new WebAuthFlowWindowCocoa(delegate, browser_context, contents);
84 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/extensions/web_auth_flow_window_cocoa.h ('k') | chrome/browser/ui/extensions/web_auth_flow_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698