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

Unified Diff: remoting/host/continue_window_mac.mm

Issue 8624009: Refactor ContinueWindow::Show() to accept a callback parameter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Mac compile Created 9 years, 1 month 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/continue_window_mac.mm
diff --git a/remoting/host/continue_window_mac.mm b/remoting/host/continue_window_mac.mm
index 2dac22cab8d09bfaac41a731a76dc947872ba445..f5661846a0805fcc4e43b42bf029817d0e33e44a 100644
--- a/remoting/host/continue_window_mac.mm
+++ b/remoting/host/continue_window_mac.mm
@@ -13,15 +13,20 @@
#include "base/sys_string_conversions.h"
#include "remoting/host/chromoting_host.h"
+typedef remoting::ContinueWindow::ContinueSessionCallback
+ ContinueSessionCallback;
+
// Handles the ContinueWindow.
@interface ContinueWindowMacController : NSObject {
@private
scoped_nsobject<NSMutableArray> shades_;
scoped_nsobject<NSAlert> continue_alert_;
remoting::ChromotingHost* host_;
+ ContinueSessionCallback callback_;
}
-- (id)initWithHost:(remoting::ChromotingHost*)host;
+- (id)initWithHost:(remoting::ChromotingHost*)host
+ callback:(const ContinueSessionCallback&)callback;
- (void)show;
- (void)hide;
- (void)onCancel:(id)sender;
@@ -37,20 +42,24 @@ class ContinueWindowMac : public remoting::ContinueWindow {
ContinueWindowMac() {}
virtual ~ContinueWindowMac() {}
- virtual void Show(remoting::ChromotingHost* host) OVERRIDE;
+ virtual void Show(remoting::ChromotingHost* host,
+ const ContinueSessionCallback& callback) OVERRIDE;
virtual void Hide() OVERRIDE;
private:
scoped_nsobject<ContinueWindowMacController> controller_;
+ ContinueSessionCallback callback_;
DISALLOW_COPY_AND_ASSIGN(ContinueWindowMac);
};
-void ContinueWindowMac::Show(remoting::ChromotingHost* host) {
+void ContinueWindowMac::Show(remoting::ChromotingHost* host,
+ const ContinueSessionCallback& callback) {
base::mac::ScopedNSAutoreleasePool pool;
- controller_.reset([[ContinueWindowMacController alloc] initWithHost:host]);
+ controller_.reset(
+ [[ContinueWindowMacController alloc] initWithHost:host
+ callback:callback]);
[controller_ show];
-
}
void ContinueWindowMac::Hide() {
@@ -66,9 +75,11 @@ ContinueWindow* ContinueWindow::Create() {
@implementation ContinueWindowMacController
-- (id)initWithHost:(remoting::ChromotingHost*)host {
+- (id)initWithHost:(remoting::ChromotingHost*)host
+ callback:(const ContinueSessionCallback&)callback {
if ((self = [super init])) {
host_ = host;
+ callback_ = callback;
}
return self;
}
@@ -143,13 +154,13 @@ ContinueWindow* ContinueWindow::Create() {
- (void)onCancel:(id)sender {
[self hide];
- host_->Shutdown(base::Closure());
+ callback_.Run(false);
host_ = nil;
}
- (void)onContinue:(id)sender {
[self hide];
- host_->PauseSession(false);
+ callback_.Run(true);
host_ = nil;
}

Powered by Google App Engine
This is Rietveld 408576698