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

Side by Side Diff: remoting/host/continue_window_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, 6 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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/mac/scoped_nsautorelease_pool.h" 9 #include "base/mac/scoped_nsautorelease_pool.h"
10 #include "base/memory/scoped_nsobject.h" 10 #include "base/mac/scoped_nsobject.h"
11 #include "base/strings/sys_string_conversions.h" 11 #include "base/strings/sys_string_conversions.h"
12 #include "remoting/host/continue_window.h" 12 #include "remoting/host/continue_window.h"
13 13
14 // Handles the ContinueWindow. 14 // Handles the ContinueWindow.
15 @interface ContinueWindowMacController : NSObject { 15 @interface ContinueWindowMacController : NSObject {
16 @private 16 @private
17 scoped_nsobject<NSMutableArray> shades_; 17 base::scoped_nsobject<NSMutableArray> shades_;
18 scoped_nsobject<NSAlert> continue_alert_; 18 base::scoped_nsobject<NSAlert> continue_alert_;
19 remoting::ContinueWindow* continue_window_; 19 remoting::ContinueWindow* continue_window_;
20 const remoting::UiStrings* ui_strings_; 20 const remoting::UiStrings* ui_strings_;
21 } 21 }
22 22
23 - (id)initWithUiStrings:(const remoting::UiStrings*)ui_strings 23 - (id)initWithUiStrings:(const remoting::UiStrings*)ui_strings
24 continue_window:(remoting::ContinueWindow*)continue_window; 24 continue_window:(remoting::ContinueWindow*)continue_window;
25 - (void)show; 25 - (void)show;
26 - (void)hide; 26 - (void)hide;
27 - (void)onCancel:(id)sender; 27 - (void)onCancel:(id)sender;
28 - (void)onContinue:(id)sender; 28 - (void)onContinue:(id)sender;
29 @end 29 @end
30 30
31 namespace remoting { 31 namespace remoting {
32 32
33 // A bridge between C++ and ObjC implementations of ContinueWindow. 33 // A bridge between C++ and ObjC implementations of ContinueWindow.
34 // Everything important occurs in ContinueWindowMacController. 34 // Everything important occurs in ContinueWindowMacController.
35 class ContinueWindowMac : public ContinueWindow { 35 class ContinueWindowMac : public ContinueWindow {
36 public: 36 public:
37 explicit ContinueWindowMac(const UiStrings& ui_strings); 37 explicit ContinueWindowMac(const UiStrings& ui_strings);
38 virtual ~ContinueWindowMac(); 38 virtual ~ContinueWindowMac();
39 39
40 protected: 40 protected:
41 // ContinueWindow overrides. 41 // ContinueWindow overrides.
42 virtual void ShowUi() OVERRIDE; 42 virtual void ShowUi() OVERRIDE;
43 virtual void HideUi() OVERRIDE; 43 virtual void HideUi() OVERRIDE;
44 44
45 private: 45 private:
46 scoped_nsobject<ContinueWindowMacController> controller_; 46 base::scoped_nsobject<ContinueWindowMacController> controller_;
47 47
48 DISALLOW_COPY_AND_ASSIGN(ContinueWindowMac); 48 DISALLOW_COPY_AND_ASSIGN(ContinueWindowMac);
49 }; 49 };
50 50
51 ContinueWindowMac::ContinueWindowMac(const UiStrings& ui_strings) 51 ContinueWindowMac::ContinueWindowMac(const UiStrings& ui_strings)
52 : ContinueWindow(ui_strings) { 52 : ContinueWindow(ui_strings) {
53 } 53 }
54 54
55 ContinueWindowMac::~ContinueWindowMac() { 55 ContinueWindowMac::~ContinueWindowMac() {
56 DCHECK(CalledOnValidThread()); 56 DCHECK(CalledOnValidThread());
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 [continue_button setAction:@selector(onContinue:)]; 129 [continue_button setAction:@selector(onContinue:)];
130 [continue_button setTarget:self]; 130 [continue_button setTarget:self];
131 131
132 NSButton* cancel_button = 132 NSButton* cancel_button =
133 [continue_alert_ addButtonWithTitle:cancel_button_string]; 133 [continue_alert_ addButtonWithTitle:cancel_button_string];
134 [cancel_button setAction:@selector(onCancel:)]; 134 [cancel_button setAction:@selector(onCancel:)];
135 [cancel_button setTarget:self]; 135 [cancel_button setTarget:self];
136 136
137 NSBundle *bundle = [NSBundle bundleForClass:[self class]]; 137 NSBundle *bundle = [NSBundle bundleForClass:[self class]];
138 NSString *imagePath = [bundle pathForResource:@"chromoting128" ofType:@"png"]; 138 NSString *imagePath = [bundle pathForResource:@"chromoting128" ofType:@"png"];
139 scoped_nsobject<NSImage> image( 139 base::scoped_nsobject<NSImage> image(
140 [[NSImage alloc] initByReferencingFile:imagePath]); 140 [[NSImage alloc] initByReferencingFile:imagePath]);
141 [continue_alert_ setIcon:image]; 141 [continue_alert_ setIcon:image];
142 [continue_alert_ layout]; 142 [continue_alert_ layout];
143 143
144 // Force alert to be at the proper level and location. 144 // Force alert to be at the proper level and location.
145 NSWindow* continue_window = [continue_alert_ window]; 145 NSWindow* continue_window = [continue_alert_ window];
146 [continue_window center]; 146 [continue_window center];
147 [continue_window setLevel:NSModalPanelWindowLevel]; 147 [continue_window setLevel:NSModalPanelWindowLevel];
148 [continue_window orderWindow:NSWindowAbove 148 [continue_window orderWindow:NSWindowAbove
149 relativeTo:[[shades_ lastObject] windowNumber]]; 149 relativeTo:[[shades_ lastObject] windowNumber]];
(...skipping 13 matching lines...) Expand all
163 [self hide]; 163 [self hide];
164 continue_window_->DisconnectSession(); 164 continue_window_->DisconnectSession();
165 } 165 }
166 166
167 - (void)onContinue:(id)sender { 167 - (void)onContinue:(id)sender {
168 [self hide]; 168 [self hide];
169 continue_window_->ContinueSession(); 169 continue_window_->ContinueSession();
170 } 170 }
171 171
172 @end 172 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698