Index: remoting/host/disconnect_window_mac.mm |
diff --git a/remoting/host/disconnect_window_mac.mm b/remoting/host/disconnect_window_mac.mm |
index bccd31c97eec7e25b7db21db274d1ef293497172..58fa0419743eebb954b7da7249fcfdbdc2ed322a 100644 |
--- a/remoting/host/disconnect_window_mac.mm |
+++ b/remoting/host/disconnect_window_mac.mm |
@@ -19,7 +19,8 @@ class DisconnectWindowMac : public remoting::DisconnectWindow { |
DisconnectWindowMac(); |
virtual ~DisconnectWindowMac(); |
- virtual void Show(remoting::ChromotingHost* host, |
+ virtual void Show(ChromotingHost* host, |
+ const base::Closure& disconnect_callback, |
const std::string& username) OVERRIDE; |
virtual void Hide() OVERRIDE; |
@@ -37,12 +38,14 @@ DisconnectWindowMac::~DisconnectWindowMac() { |
[window_controller_ close]; |
} |
-void DisconnectWindowMac::Show(remoting::ChromotingHost* host, |
+void DisconnectWindowMac::Show(ChromotingHost* host, |
+ const base::Closure& disconnect_callback, |
const std::string& username) { |
CHECK(window_controller_ == nil); |
NSString* nsUsername = base::SysUTF8ToNSString(username); |
window_controller_ = |
[[DisconnectWindowController alloc] initWithHost:host |
+ callback:disconnect_callback |
username:nsUsername]; |
[window_controller_ showWindow:nil]; |
} |
@@ -61,23 +64,17 @@ scoped_ptr<DisconnectWindow> DisconnectWindow::Create() { |
} // namespace remoting |
@interface DisconnectWindowController() |
-@property (nonatomic, assign) remoting::ChromotingHost* host; |
-@property (nonatomic, copy) NSString* username; |
- |
- (BOOL)isRToL; |
- |
@end |
@implementation DisconnectWindowController |
- |
-@synthesize host = host_; |
-@synthesize username = username_; |
- |
- (id)initWithHost:(remoting::ChromotingHost*)host |
+ callback:(const base::Closure&)disconnect_callback |
username:(NSString*)username { |
self = [super initWithWindowNibName:@"disconnect_window"]; |
if (self) { |
host_ = host; |
+ disconnect_callback_ = disconnect_callback; |
username_ = [username copy]; |
} |
return self; |
@@ -89,9 +86,8 @@ scoped_ptr<DisconnectWindow> DisconnectWindow::Create() { |
} |
- (IBAction)stopSharing:(id)sender { |
- if (self.host) { |
- self.host->Shutdown(base::Closure()); |
- self.host = NULL; |
+ if (host_ != NULL && !disconnect_callback_.is_null()) { |
+ disconnect_callback_.Run(); |
} |
} |
@@ -104,14 +100,14 @@ scoped_ptr<DisconnectWindow> DisconnectWindow::Create() { |
} |
- (void)close { |
- self.host = NULL; |
+ host_ = NULL; |
[super close]; |
} |
- (void)windowDidLoad { |
string16 text = ReplaceStringPlaceholders( |
host_->ui_strings().disconnect_message, |
- base::SysNSStringToUTF16(self.username), |
+ base::SysNSStringToUTF16(username_), |
NULL); |
[connectedToField_ setStringValue:base::SysUTF16ToNSString(text)]; |