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

Side by Side Diff: remoting/host/capturer_mac.cc

Issue 10382184: [Chromoting] Initial plumbing for cursor shape. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Call SetCursor only for native format images 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 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 #include "remoting/host/capturer.h" 5 #include "remoting/host/capturer.h"
6 6
7 #include <ApplicationServices/ApplicationServices.h> 7 #include <ApplicationServices/ApplicationServices.h>
8 #include <dlfcn.h> 8 #include <dlfcn.h>
9 #include <IOKit/pwr_mgt/IOPMLib.h> 9 #include <IOKit/pwr_mgt/IOPMLib.h>
10 #include <OpenGL/CGLMacro.h> 10 #include <OpenGL/CGLMacro.h>
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 // A class to perform capturing for mac. 152 // A class to perform capturing for mac.
153 class CapturerMac : public Capturer { 153 class CapturerMac : public Capturer {
154 public: 154 public:
155 CapturerMac(); 155 CapturerMac();
156 virtual ~CapturerMac(); 156 virtual ~CapturerMac();
157 157
158 bool Init(); 158 bool Init();
159 159
160 // Capturer interface. 160 // Capturer interface.
161 virtual void Start() OVERRIDE; 161 virtual void Start(const CursorShapeChangedCallback& callback) OVERRIDE;
162 virtual void Stop() OVERRIDE; 162 virtual void Stop() OVERRIDE;
163 virtual void ScreenConfigurationChanged() OVERRIDE; 163 virtual void ScreenConfigurationChanged() OVERRIDE;
164 virtual media::VideoFrame::Format pixel_format() const OVERRIDE; 164 virtual media::VideoFrame::Format pixel_format() const OVERRIDE;
165 virtual void ClearInvalidRegion() OVERRIDE; 165 virtual void ClearInvalidRegion() OVERRIDE;
166 virtual void InvalidateRegion(const SkRegion& invalid_region) OVERRIDE; 166 virtual void InvalidateRegion(const SkRegion& invalid_region) OVERRIDE;
167 virtual void InvalidateScreen(const SkISize& size) OVERRIDE; 167 virtual void InvalidateScreen(const SkISize& size) OVERRIDE;
168 virtual void InvalidateFullScreen() OVERRIDE; 168 virtual void InvalidateFullScreen() OVERRIDE;
169 virtual void CaptureInvalidRegion( 169 virtual void CaptureInvalidRegion(
170 const CaptureCompletedCallback& callback) OVERRIDE; 170 const CaptureCompletedCallback& callback) OVERRIDE;
171 virtual const SkISize& size_most_recent() const OVERRIDE; 171 virtual const SkISize& size_most_recent() const OVERRIDE;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 cgl_context_ = NULL; 295 cgl_context_ = NULL;
296 } 296 }
297 // The buffers might be in use by the encoder, so don't delete them here. 297 // The buffers might be in use by the encoder, so don't delete them here.
298 // Instead, mark them as "needs update"; next time the buffers are used by 298 // Instead, mark them as "needs update"; next time the buffers are used by
299 // the capturer, they will be recreated if necessary. 299 // the capturer, they will be recreated if necessary.
300 for (int i = 0; i < kNumBuffers; ++i) { 300 for (int i = 0; i < kNumBuffers; ++i) {
301 buffers_[i].set_needs_update(); 301 buffers_[i].set_needs_update();
302 } 302 }
303 } 303 }
304 304
305 void CapturerMac::Start() { 305 void CapturerMac::Start(
306 const CursorShapeChangedCallback& callback) {
307 cursor_shape_changed_callback_ = callback;
308
306 // Create a power management assertion that wakes the display and prevents it 309 // Create a power management assertion that wakes the display and prevents it
307 // from going to sleep on user idle. 310 // from going to sleep on user idle.
308 IOPMAssertionCreate(kIOPMAssertionTypeNoDisplaySleep, 311 IOPMAssertionCreate(kIOPMAssertionTypeNoDisplaySleep,
309 kIOPMAssertionLevelOn, 312 kIOPMAssertionLevelOn,
310 &power_assertion_id_); 313 &power_assertion_id_);
311 } 314 }
312 315
313 void CapturerMac::Stop() { 316 void CapturerMac::Stop() {
314 if (power_assertion_id_ != kIOPMNullAssertionID) { 317 if (power_assertion_id_ != kIOPMNullAssertionID) {
315 IOPMAssertionRelease(power_assertion_id_); 318 IOPMAssertionRelease(power_assertion_id_);
316 power_assertion_id_ = kIOPMNullAssertionID; 319 power_assertion_id_ = kIOPMNullAssertionID;
317 } 320 }
318 } 321 }
319 322
323 void CapturerMac::SetCursorShapeChangedCallback(
324 const CursorShapeChangedCallback& callback) {
325 // TODO(garykac) Implement cursor shape for Mac. (crbug.com/116299)
326 }
327
320 void CapturerMac::ScreenConfigurationChanged() { 328 void CapturerMac::ScreenConfigurationChanged() {
321 ReleaseBuffers(); 329 ReleaseBuffers();
322 helper_.ClearInvalidRegion(); 330 helper_.ClearInvalidRegion();
323 last_buffer_ = NULL; 331 last_buffer_ = NULL;
324 332
325 CGDirectDisplayID mainDevice = CGMainDisplayID(); 333 CGDirectDisplayID mainDevice = CGMainDisplayID();
326 int width = CGDisplayPixelsWide(mainDevice); 334 int width = CGDisplayPixelsWide(mainDevice);
327 int height = CGDisplayPixelsHigh(mainDevice); 335 int height = CGDisplayPixelsHigh(mainDevice);
328 InvalidateScreen(SkISize::Make(width, height)); 336 InvalidateScreen(SkISize::Make(width, height));
329 337
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 Capturer* Capturer::Create() { 664 Capturer* Capturer::Create() {
657 CapturerMac* capturer = new CapturerMac(); 665 CapturerMac* capturer = new CapturerMac();
658 if (!capturer->Init()) { 666 if (!capturer->Init()) {
659 delete capturer; 667 delete capturer;
660 capturer = NULL; 668 capturer = NULL;
661 } 669 }
662 return capturer; 670 return capturer;
663 } 671 }
664 672
665 } // namespace remoting 673 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698