12a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Copyright (c) 2013 The Chromium Authors. All rights reserved. 22a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 32a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// found in the LICENSE file. 42a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 52a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#ifndef ASH_DISPLAY_DISPLAY_INFO_H_ 62a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#define ASH_DISPLAY_DISPLAY_INFO_H_ 72a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 82a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include <string> 9a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)#include <vector> 102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "ash/ash_export.h" 12a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch#include "ui/display/types/display_constants.h" 132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "ui/gfx/display.h" 142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "ui/gfx/insets.h" 152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "ui/gfx/rect.h" 162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace ash { 182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 195d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// A struct that represents the display's mode info. 205d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)struct ASH_EXPORT DisplayMode { 215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) DisplayMode(); 225d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) DisplayMode(const gfx::Size& size, 235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) float refresh_rate, 245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) bool interlaced, 255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) bool native); 265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 275f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) // Returns the size in DIP which isvisible to the user. 285f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) gfx::Size GetSizeInDIP() const; 295f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) 305f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) // Returns true if |other| has same size and scale factors. 315f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) bool IsEquivalent(const DisplayMode& other) const; 325f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) 335d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) gfx::Size size; // Physical pixel size of the display. 345d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) float refresh_rate; // Refresh rate of the display, in Hz. 355d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) bool interlaced; // True if mode is interlaced. 365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) bool native; // True if mode is native mode of the display. 375f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) float ui_scale; // The UI scale factor of the mode. 385f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) float device_scale_factor; // The device scale factor of the mode. 39a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)}; 40a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) 412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// DisplayInfo contains metadata for each display. This is used to 422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// create |gfx::Display| as well as to maintain extra infomation 432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// to manage displays in ash environment. 442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// This class is intentionally made copiable. 452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class ASH_EXPORT DisplayInfo { 462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) public: 472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Creates a DisplayInfo from string spec. 100+200-1440x800 creates display 482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // whose size is 1440x800 at the location (100, 200) in host coordinates. 492a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // The format is 502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // 513551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) // [origin-]widthxheight[*device_scale_factor][#resolutions list] 523551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) // [/<properties>][@ui-scale] 532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // 542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // where [] are optional: 552a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // - |origin| is given in x+y- format. 562a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // - |device_scale_factor| is either 2 or 1 (or empty). 572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // - properties can combination of 'o', which adds default overscan insets 582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // (5%), and one rotation property where 'r' is 90 degree clock-wise 592a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // (to the 'r'ight) 'u' is 180 degrees ('u'pside-down) and 'l' is 602a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // 270 degrees (to the 'l'eft). 612a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // - ui-scale is floating value, e.g. @1.5 or @1.25. 623551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) // - |resolution list| is the list of size that is given in 635d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // |width x height [% refresh_rate]| separated by '|'. 642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // 652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // A couple of examples: 662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // "100x100" 672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // 100x100 window at 0,0 origin. 1x device scale factor. no overscan. 682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // no rotation. 1.0 ui scale. 692a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // "5+5-300x200*2" 702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // 300x200 window at 5,5 origin. 2x device scale factor. 712a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // no overscan, no rotation. 1.0 ui scale. 722a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // "300x200/ol" 732a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // 300x200 window at 0,0 origin. 1x device scale factor. 742a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // with 5% overscan. rotated to left (90 degree counter clockwise). 752a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // 1.0 ui scale. 762a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // "10+20-300x200/u@1.5" 772a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // 300x200 window at 10,20 origin. 1x device scale factor. 782a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // no overscan. flipped upside-down (180 degree) and 1.5 ui scale. 795d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // "200x100#300x200|200x100%59.0|100x100%60" 803551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) // 200x100 window at 0,0 origin, with 3 possible resolutions, 815d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // 300x200, 200x100 at 59 Hz, and 100x100 at 60 Hz. 822a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) static DisplayInfo CreateFromSpec(const std::string& spec); 832a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 842a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Creates a DisplayInfo from string spec using given |id|. 852a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) static DisplayInfo CreateFromSpecWithID(const std::string& spec, 862a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) int64 id); 872a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 882a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) DisplayInfo(); 892a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) DisplayInfo(int64 id, const std::string& name, bool has_overscan); 902a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) ~DisplayInfo(); 912a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 921320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci // When this is set to true on the device whose internal display has 931320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci // 1.25 dsf, Chrome uses 1.0f as a default scale factor, and uses 941320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci // dsf 1.25 when UI scaling is set to 0.8f. 951320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci static void SetUse125DSFForUIScaling(bool enable); 96a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch 972a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) int64 id() const { return id_; } 982a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 992a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // The name of the display. 1002a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const std::string& name() const { return name_; } 1012a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 102eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // True if the display EDID has the overscan flag. This does not create the 103eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // actual overscan automatically, but used in the message. 1042a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bool has_overscan() const { return has_overscan_; } 1052a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void set_rotation(gfx::Display::Rotation rotation) { rotation_ = rotation; } 1072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) gfx::Display::Rotation rotation() const { return rotation_; } 1082a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1091e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) void set_touch_support(gfx::Display::TouchSupport support) { 1101e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) touch_support_ = support; 1111e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) } 1121e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) gfx::Display::TouchSupport touch_support() const { return touch_support_; } 1131e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 114cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) void set_touch_device_id(int id) { touch_device_id_ = id; } 115cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) int touch_device_id() const { return touch_device_id_; } 116cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 1172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Gets/Sets the device scale factor of the display. 1182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) float device_scale_factor() const { return device_scale_factor_; } 1192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void set_device_scale_factor(float scale) { device_scale_factor_ = scale; } 1202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 121f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // The native bounds for the display. The size of this can be 122f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // different from the |size_in_pixel| when overscan insets are set 123f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // and/or |configured_ui_scale_| is set. 1245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const gfx::Rect& bounds_in_native() const { 12568043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) return bounds_in_native_; 1262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } 1272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // The size for the display in pixels. 1292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const gfx::Size& size_in_pixel() const { return size_in_pixel_; } 1302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // The overscan insets for the display in DIP. 1322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const gfx::Insets& overscan_insets_in_dip() const { 1332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return overscan_insets_in_dip_; 1342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } 1352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 136f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // Sets/gets configured ui scale. This can be different from the ui 137f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // scale actually used when the scale is 2.0 and DSF is 2.0. 138f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // (the effective ui scale is 1.0 in this case). 139f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) float configured_ui_scale() const { return configured_ui_scale_; } 140f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) void set_configured_ui_scale(float scale) { configured_ui_scale_ = scale; } 1412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 142a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch // Returns the ui scale and device scale factor actually used to create 143a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch // display that chrome sees. This can be different from one obtained 144a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch // from dispaly or one specified by a user in following situation. 145a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch // 1) DSF is 2.0f and UI scale is 2.0f. (Returns 1.0f and 1.0f respectiely) 1461320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci // 2) A user specified 0.8x on the device that has 1.25 DSF. 1.25 DSF device 1471320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci // uses 1.0f DFS unless 0.8x UI scaling is specified. 148a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch float GetEffectiveDeviceScaleFactor() const; 1491320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 1501320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci // Returns the ui scale used for the device scale factor. This 1511320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci // return 1.0f if the ui scale and dsf are both set to 2.0. 152f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) float GetEffectiveUIScale() const; 153f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 154f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // Copy the display info except for fields that can be modified by a 155f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // user (|rotation_| and |configured_ui_scale_|). |rotation_| and 156f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // |configured_ui_scale_| are copied when the |another_info| isn't native one. 1572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void Copy(const DisplayInfo& another_info); 1582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 15968043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) // Update the |bounds_in_native_| and |size_in_pixel_| using 16068043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) // given |bounds_in_native|. 16168043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) void SetBounds(const gfx::Rect& bounds_in_native); 1622a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 16368043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) // Update the |bounds_in_native| according to the current overscan 1642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // and rotation settings. 1652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void UpdateDisplaySize(); 1662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Sets/Clears the overscan insets. 168eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch void SetOverscanInsets(const gfx::Insets& insets_in_dip); 1692a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) gfx::Insets GetOverscanInsetsInPixel() const; 1702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1712a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void set_native(bool native) { native_ = native; } 1722a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bool native() const { return native_; } 1732a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1745d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const std::vector<DisplayMode>& display_modes() const { 1755d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) return display_modes_; 176a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) } 1775d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) void set_display_modes(std::vector<DisplayMode>& display_modes) { 1785d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) display_modes_.swap(display_modes); 179a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) } 180a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) 1811320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci // Returns the native mode size. If a native mode is not present, return an 1821320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci // empty size. 1831320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci gfx::Size GetNativeModeSize() const; 1841320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 185effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch ui::ColorCalibrationProfile color_profile() const { 186effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch return color_profile_; 187effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch } 188effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 189effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch // Sets the color profile. It will ignore if the specified |profile| is not in 190effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch // |available_color_profiles_|. 191effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch void SetColorProfile(ui::ColorCalibrationProfile profile); 192effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 193effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch // Returns true if |profile| is in |available_color_profiles_|. 194effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch bool IsColorProfileAvailable(ui::ColorCalibrationProfile profile) const; 195effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 196effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch const std::vector<ui::ColorCalibrationProfile>& 197effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch available_color_profiles() const { 198effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch return available_color_profiles_; 199effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch } 200effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 201effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch void set_available_color_profiles( 202effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch const std::vector<ui::ColorCalibrationProfile>& profiles) { 203effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch available_color_profiles_ = profiles; 204effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch } 205effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 206116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch bool is_aspect_preserving_scaling() const { 207116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch return is_aspect_preserving_scaling_; 208116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch } 209116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 210116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch void set_is_aspect_preserving_scaling(bool value) { 211116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch is_aspect_preserving_scaling_ = value; 212116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch } 213116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 2145d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Returns a string representation of the DisplayInfo, excluding display 2155d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // modes. 2162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) std::string ToString() const; 2172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 2185d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Returns a string representation of the DisplayInfo, including display 2195d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // modes. 220a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) std::string ToFullString() const; 221a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) 2222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) private: 2232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) int64 id_; 2242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) std::string name_; 2252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bool has_overscan_; 2262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) gfx::Display::Rotation rotation_; 2271e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) gfx::Display::TouchSupport touch_support_; 22868043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) 229cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // If the display is also a touch device, it will have a positive 230cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // |touch_device_id_|. Otherwise |touch_device_id_| is 0. 231cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) int touch_device_id_; 232cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 23368043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) // This specifies the device's pixel density. (For example, a 23468043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) // display whose DPI is higher than the threshold is considered to have 23568043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) // device_scale_factor = 2.0 on Chrome OS). This is used by the 23668043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) // grapics layer to choose and draw appropriate images and scale 23768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) // layers properly. 2382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) float device_scale_factor_; 23968043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) gfx::Rect bounds_in_native_; 24068043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) 2412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // The size of the display in use. The size can be different from the size 24268043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) // of |bounds_in_native_| if the display has overscan insets and/or rotation. 2432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) gfx::Size size_in_pixel_; 2442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) gfx::Insets overscan_insets_in_dip_; 2452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 24668043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) // The pixel scale of the display. This is used to simply expand (or 24768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) // shrink) the desktop over the native display resolution (useful in 24868043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) // HighDPI display). Note that this should not be confused with the 24968043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) // device scale factor, which specifies the pixel density of the 250f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // display. The actuall scale value to be used depends on the device 251f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // scale factor. See |GetEffectiveScaleFactor()|. 252f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) float configured_ui_scale_; 2532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 2543551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) // True if this comes from native platform (DisplayChangeObserver). 2552a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bool native_; 256a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) 257116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // True if the display is configured to preserve the aspect ratio. When the 258116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // display is configured in a non-native mode, only parts of the display will 259116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // be used such that the aspect ratio is preserved. 260116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch bool is_aspect_preserving_scaling_; 261116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 2625d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // The list of modes supported by this display. 2635d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) std::vector<DisplayMode> display_modes_; 264effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 265effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch // The current profile of the color calibration. 266effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch ui::ColorCalibrationProfile color_profile_; 267effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 268effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch // The list of available variations for the color calibration. 269effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch std::vector<ui::ColorCalibrationProfile> available_color_profiles_; 2702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}; 2712a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 2722a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} // namespace ash 2732a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 2742a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif // ASH_DISPLAY_DISPLAY_INFO_H_ 275