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

Side by Side Diff: chrome/browser/ui/cocoa/constrained_web_dialog_delegate_mac.mm

Issue 17593006: mac: Update clients of scoped_nsobject.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: iwyu, scoped_nsprotocol Created 7 years, 5 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/webui/constrained_web_dialog_delegate_base.h" 5 #include "chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/memory/scoped_nsobject.h" 9 #include "base/mac/scoped_nsobject.h"
10 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h" 10 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h"
11 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_wi ndow.h" 11 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_wi ndow.h"
12 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" 12 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h"
13 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
14 #include "content/public/browser/web_contents_view.h" 14 #include "content/public/browser/web_contents_view.h"
15 #include "ui/gfx/size.h" 15 #include "ui/gfx/size.h"
16 #include "ui/web_dialogs/web_dialog_delegate.h" 16 #include "ui/web_dialogs/web_dialog_delegate.h"
17 #include "ui/web_dialogs/web_dialog_ui.h" 17 #include "ui/web_dialogs/web_dialog_ui.h"
18 #include "ui/web_dialogs/web_dialog_web_contents_delegate.h" 18 #include "ui/web_dialogs/web_dialog_web_contents_delegate.h"
19 19
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 virtual void OnConstrainedWindowClosed( 88 virtual void OnConstrainedWindowClosed(
89 ConstrainedWindowMac* window) OVERRIDE { 89 ConstrainedWindowMac* window) OVERRIDE {
90 if (!impl_->closed_via_webui()) 90 if (!impl_->closed_via_webui())
91 GetWebDialogDelegate()->OnDialogClosed(""); 91 GetWebDialogDelegate()->OnDialogClosed("");
92 delete this; 92 delete this;
93 } 93 }
94 94
95 private: 95 private:
96 scoped_ptr<ConstrainedWebDialogDelegateMac> impl_; 96 scoped_ptr<ConstrainedWebDialogDelegateMac> impl_;
97 scoped_ptr<ConstrainedWindowMac> constrained_window_; 97 scoped_ptr<ConstrainedWindowMac> constrained_window_;
98 scoped_nsobject<NSWindow> window_; 98 base::scoped_nsobject<NSWindow> window_;
99 99
100 DISALLOW_COPY_AND_ASSIGN(ConstrainedWebDialogDelegateViewMac); 100 DISALLOW_COPY_AND_ASSIGN(ConstrainedWebDialogDelegateViewMac);
101 }; 101 };
102 102
103 ConstrainedWebDialogDelegateViewMac::ConstrainedWebDialogDelegateViewMac( 103 ConstrainedWebDialogDelegateViewMac::ConstrainedWebDialogDelegateViewMac(
104 content::BrowserContext* browser_context, 104 content::BrowserContext* browser_context,
105 WebDialogDelegate* delegate, 105 WebDialogDelegate* delegate,
106 WebDialogWebContentsDelegate* tab_delegate, 106 WebDialogWebContentsDelegate* tab_delegate,
107 content::WebContents* web_contents) 107 content::WebContents* web_contents)
108 : impl_(new ConstrainedWebDialogDelegateMac(browser_context, 108 : impl_(new ConstrainedWebDialogDelegateMac(browser_context,
109 delegate, 109 delegate,
110 tab_delegate)) { 110 tab_delegate)) {
111 // Create a window to hold web_contents in the constrained sheet: 111 // Create a window to hold web_contents in the constrained sheet:
112 gfx::Size size; 112 gfx::Size size;
113 delegate->GetDialogSize(&size); 113 delegate->GetDialogSize(&size);
114 NSRect frame = NSMakeRect(0, 0, size.width(), size.height()); 114 NSRect frame = NSMakeRect(0, 0, size.width(), size.height());
115 115
116 window_.reset( 116 window_.reset(
117 [[ConstrainedWindowCustomWindow alloc] initWithContentRect:frame]); 117 [[ConstrainedWindowCustomWindow alloc] initWithContentRect:frame]);
118 [GetWebContents()->GetView()->GetNativeView() setFrame:frame]; 118 [GetWebContents()->GetView()->GetNativeView() setFrame:frame];
119 [[window_ contentView] 119 [[window_ contentView]
120 addSubview:GetWebContents()->GetView()->GetNativeView()]; 120 addSubview:GetWebContents()->GetView()->GetNativeView()];
121 121
122 scoped_nsobject<CustomConstrainedWindowSheet> sheet( 122 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet(
123 [[CustomConstrainedWindowSheet alloc] 123 [[CustomConstrainedWindowSheet alloc] initWithCustomWindow:window_]);
124 initWithCustomWindow:window_]);
125 constrained_window_.reset(new ConstrainedWindowMac( 124 constrained_window_.reset(new ConstrainedWindowMac(
126 this, web_contents, sheet)); 125 this, web_contents, sheet));
127 126
128 impl_->set_window(constrained_window_.get()); 127 impl_->set_window(constrained_window_.get());
129 } 128 }
130 129
131 ConstrainedWebDialogDelegate* CreateConstrainedWebDialog( 130 ConstrainedWebDialogDelegate* CreateConstrainedWebDialog(
132 content::BrowserContext* browser_context, 131 content::BrowserContext* browser_context,
133 WebDialogDelegate* delegate, 132 WebDialogDelegate* delegate,
134 WebDialogWebContentsDelegate* tab_delegate, 133 WebDialogWebContentsDelegate* tab_delegate,
135 content::WebContents* web_contents) { 134 content::WebContents* web_contents) {
136 // Deleted when the dialog closes. 135 // Deleted when the dialog closes.
137 ConstrainedWebDialogDelegateViewMac* constrained_delegate = 136 ConstrainedWebDialogDelegateViewMac* constrained_delegate =
138 new ConstrainedWebDialogDelegateViewMac( 137 new ConstrainedWebDialogDelegateViewMac(
139 browser_context, delegate, tab_delegate, web_contents); 138 browser_context, delegate, tab_delegate, web_contents);
140 return constrained_delegate; 139 return constrained_delegate;
141 } 140 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698