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

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: Rebased. Unix-line endings. The license text. 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
« no previous file with comments | « remoting/host/disconnect_window_mac.h ('k') | remoting/host/disconnect_window_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)];
« no previous file with comments | « remoting/host/disconnect_window_mac.h ('k') | remoting/host/disconnect_window_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698