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

Side by Side Diff: ui/display/chromeos/x11/native_display_delegate_x11.cc

Issue 208943002: Refactors getting available color profiles code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/display/chromeos/x11/native_display_delegate_x11.h" 5 #include "ui/display/chromeos/x11/native_display_delegate_x11.h"
6 6
7 #include <X11/Xatom.h> 7 #include <X11/Xatom.h>
8 #include <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 #include <X11/extensions/dpms.h> 9 #include <X11/extensions/dpms.h>
10 #include <X11/extensions/Xrandr.h> 10 #include <X11/extensions/Xrandr.h>
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 crtc = info->crtcs[i]; 377 crtc = info->crtcs[i];
378 *last_used_crtc = crtc; 378 *last_used_crtc = crtc;
379 break; 379 break;
380 } 380 }
381 } 381 }
382 382
383 const DisplayMode* current_mode = NULL; 383 const DisplayMode* current_mode = NULL;
384 const DisplayMode* native_mode = NULL; 384 const DisplayMode* native_mode = NULL;
385 std::vector<const DisplayMode*> display_modes; 385 std::vector<const DisplayMode*> display_modes;
386 386
387 // TODO(mukai|marcheu): check the system status and fill the correct list of
388 // available color profiles.
389
390 for (int i = 0; i < info->nmode; ++i) { 387 for (int i = 0; i < info->nmode; ++i) {
391 const RRMode mode = info->modes[i]; 388 const RRMode mode = info->modes[i];
392 if (modes_.find(mode) != modes_.end()) { 389 if (modes_.find(mode) != modes_.end()) {
393 display_modes.push_back(modes_.at(mode)); 390 display_modes.push_back(modes_.at(mode));
394 391
395 if (mode == current_mode_id) 392 if (mode == current_mode_id)
396 current_mode = display_modes.back(); 393 current_mode = display_modes.back();
397 if (mode == native_mode_id) 394 if (mode == native_mode_id)
398 native_mode = display_modes.back(); 395 native_mode = display_modes.back();
399 } else { 396 } else {
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 if (values) 597 if (values)
601 XFree(values); 598 XFree(values);
602 } 599 }
603 } 600 }
604 if (props) 601 if (props)
605 XFree(props); 602 XFree(props);
606 603
607 return ret; 604 return ret;
608 } 605 }
609 606
607
608 void NativeDisplayDelegateX11::GetAvailableColorCalibrationProfiles(
609 const DisplaySnapshot& output,
610 std::vector<ColorCalibrationProfile>* profiles) {
611 // TODO(mukai|marcheu): Checks the system data and fills the result.
612 // Note that the order would be Dynamic -> Standard -> Movie -> Reading.
613 }
614
610 bool NativeDisplayDelegateX11::SetColorCalibrationProfile( 615 bool NativeDisplayDelegateX11::SetColorCalibrationProfile(
611 const DisplaySnapshot& output, 616 const DisplaySnapshot& output,
612 ColorCalibrationProfile new_profile) { 617 ColorCalibrationProfile new_profile) {
613 const DisplaySnapshotX11& x11_output = 618 const DisplaySnapshotX11& x11_output =
614 static_cast<const DisplaySnapshotX11&>(output); 619 static_cast<const DisplaySnapshotX11&>(output);
615 620
616 XRRCrtcGamma* gamma_ramp = CreateGammaRampForProfile(x11_output, new_profile); 621 XRRCrtcGamma* gamma_ramp = CreateGammaRampForProfile(x11_output, new_profile);
617 622
618 if (!gamma_ramp) 623 if (!gamma_ramp)
619 return false; 624 return false;
(...skipping 16 matching lines...) Expand all
636 641
637 void NativeDisplayDelegateX11::AddObserver(NativeDisplayObserver* observer) { 642 void NativeDisplayDelegateX11::AddObserver(NativeDisplayObserver* observer) {
638 observers_.AddObserver(observer); 643 observers_.AddObserver(observer);
639 } 644 }
640 645
641 void NativeDisplayDelegateX11::RemoveObserver(NativeDisplayObserver* observer) { 646 void NativeDisplayDelegateX11::RemoveObserver(NativeDisplayObserver* observer) {
642 observers_.RemoveObserver(observer); 647 observers_.RemoveObserver(observer);
643 } 648 }
644 649
645 } // namespace ui 650 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698