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

Unified Diff: remoting/host/disconnect_window_mac.mm

Issue 10384127: Chromoting: the Me2me host now presents a notification on the console allowing a user to disconnect… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
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..8e24a2195f286fdf4d5be88c813cbac78e9689f0 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 DisconnectCallback& 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 DisconnectCallback& 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];
}
@@ -62,6 +65,7 @@ scoped_ptr<DisconnectWindow> DisconnectWindow::Create() {
@interface DisconnectWindowController()
@property (nonatomic, assign) remoting::ChromotingHost* host;
+@property (nonatomic, assign) DisconnectCallback disconnect_callback;
dcaiafa 2012/05/11 20:10:38 This doesn't need to be a property. It's private a
alexeypa (please no reviews) 2012/05/11 20:19:29 Removed.
@property (nonatomic, copy) NSString* username;
- (BOOL)isRToL;
@@ -71,13 +75,16 @@ scoped_ptr<DisconnectWindow> DisconnectWindow::Create() {
@implementation DisconnectWindowController
@synthesize host = host_;
+@synthesize disconnect_callback = disconnect_callback_;
dcaiafa 2012/05/11 20:10:38 Again, not needed.
alexeypa (please no reviews) 2012/05/11 20:19:29 Done.
@synthesize username = username_;
- (id)initWithHost:(remoting::ChromotingHost*)host
+ callback:(const DisconnectCallback&)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 +96,8 @@ scoped_ptr<DisconnectWindow> DisconnectWindow::Create() {
}
- (IBAction)stopSharing:(id)sender {
- if (self.host) {
- self.host->Shutdown(base::Closure());
- self.host = NULL;
+ if (!self.disconnect_callback.is_null()) {
dcaiafa 2012/05/11 20:10:38 To access the field directly, just drop the 'self.
alexeypa (please no reviews) 2012/05/11 20:19:29 Done.
+ self.disconnect_callback.Run();
}
}

Powered by Google App Engine
This is Rietveld 408576698