Commit 08b47caa authored by dnicoara@chromium.org's avatar dnicoara@chromium.org

Update ui/display to use primitive types as defined in stdint.h

As instructed in base/basictypes.h we should use (u)int{8,16,32,64}_t rather
than the ones without the '_t' suffix.

BUG=333413
R=derat@chromium.org

Review URL: https://codereview.chromium.org/215233002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260118 0039d316-1c4b-4281-b951-d872f2087c98
parent 6e02ed0d
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#ifndef UI_DISPLAY_CHROMEOS_NATIVE_DISPLAY_DELEGATE_H_ #ifndef UI_DISPLAY_CHROMEOS_NATIVE_DISPLAY_DELEGATE_H_
#define UI_DISPLAY_CHROMEOS_NATIVE_DISPLAY_DELEGATE_H_ #define UI_DISPLAY_CHROMEOS_NATIVE_DISPLAY_DELEGATE_H_
#include <stdint.h>
#include <vector> #include <vector>
#include "ui/display/display_constants.h" #include "ui/display/display_constants.h"
...@@ -40,7 +42,7 @@ class DISPLAY_EXPORT NativeDisplayDelegate { ...@@ -40,7 +42,7 @@ class DISPLAY_EXPORT NativeDisplayDelegate {
virtual void SyncWithServer() = 0; virtual void SyncWithServer() = 0;
// Sets the window's background color to |color_argb|. // Sets the window's background color to |color_argb|.
virtual void SetBackgroundColor(uint32 color_argb) = 0; virtual void SetBackgroundColor(uint32_t color_argb) = 0;
// Enables DPMS and forces it to the "on" state. // Enables DPMS and forces it to the "on" state.
virtual void ForceDPMSOn() = 0; virtual void ForceDPMSOn() = 0;
......
...@@ -23,7 +23,7 @@ typedef std::vector<const DisplayMode*> DisplayModeList; ...@@ -23,7 +23,7 @@ typedef std::vector<const DisplayMode*> DisplayModeList;
// The delay to perform configuration after RRNotify. See the comment // The delay to perform configuration after RRNotify. See the comment
// in |Dispatch()|. // in |Dispatch()|.
const int64 kConfigureDelayMs = 500; const int kConfigureDelayMs = 500;
// Returns a string describing |state|. // Returns a string describing |state|.
std::string DisplayPowerStateToString(chromeos::DisplayPowerState state) { std::string DisplayPowerStateToString(chromeos::DisplayPowerState state) {
...@@ -197,7 +197,7 @@ void OutputConfigurator::Init(bool is_panel_fitting_enabled) { ...@@ -197,7 +197,7 @@ void OutputConfigurator::Init(bool is_panel_fitting_enabled) {
touchscreen_delegate_.reset(new TouchscreenDelegateX11()); touchscreen_delegate_.reset(new TouchscreenDelegateX11());
} }
void OutputConfigurator::ForceInitialConfigure(uint32 background_color_argb) { void OutputConfigurator::ForceInitialConfigure(uint32_t background_color_argb) {
if (!configure_display_) if (!configure_display_)
return; return;
...@@ -285,7 +285,7 @@ void OutputConfigurator::UnregisterOutputProtectionClient( ...@@ -285,7 +285,7 @@ void OutputConfigurator::UnregisterOutputProtectionClient(
bool OutputConfigurator::QueryOutputProtectionStatus( bool OutputConfigurator::QueryOutputProtectionStatus(
OutputProtectionClientId client_id, OutputProtectionClientId client_id,
int64 display_id, int64_t display_id,
uint32_t* link_mask, uint32_t* link_mask,
uint32_t* protection_mask) { uint32_t* protection_mask) {
if (!configure_display_) if (!configure_display_)
...@@ -342,7 +342,7 @@ bool OutputConfigurator::QueryOutputProtectionStatus( ...@@ -342,7 +342,7 @@ bool OutputConfigurator::QueryOutputProtectionStatus(
bool OutputConfigurator::EnableOutputProtection( bool OutputConfigurator::EnableOutputProtection(
OutputProtectionClientId client_id, OutputProtectionClientId client_id,
int64 display_id, int64_t display_id,
uint32_t desired_method_mask) { uint32_t desired_method_mask) {
if (!configure_display_) if (!configure_display_)
return false; return false;
...@@ -381,7 +381,7 @@ bool OutputConfigurator::EnableOutputProtection( ...@@ -381,7 +381,7 @@ bool OutputConfigurator::EnableOutputProtection(
std::vector<ui::ColorCalibrationProfile> std::vector<ui::ColorCalibrationProfile>
OutputConfigurator::GetAvailableColorCalibrationProfiles( OutputConfigurator::GetAvailableColorCalibrationProfiles(
int64 display_id) { int64_t display_id) {
for (size_t i = 0; i < cached_outputs_.size(); ++i) { for (size_t i = 0; i < cached_outputs_.size(); ++i) {
if (cached_outputs_[i].display && if (cached_outputs_[i].display &&
cached_outputs_[i].display->display_id() == display_id) { cached_outputs_[i].display->display_id() == display_id) {
...@@ -394,7 +394,7 @@ OutputConfigurator::GetAvailableColorCalibrationProfiles( ...@@ -394,7 +394,7 @@ OutputConfigurator::GetAvailableColorCalibrationProfiles(
} }
bool OutputConfigurator::SetColorCalibrationProfile( bool OutputConfigurator::SetColorCalibrationProfile(
int64 display_id, int64_t display_id,
ui::ColorCalibrationProfile new_profile) { ui::ColorCalibrationProfile new_profile) {
for (size_t i = 0; i < cached_outputs_.size(); ++i) { for (size_t i = 0; i < cached_outputs_.size(); ++i) {
if (cached_outputs_[i].display && if (cached_outputs_[i].display &&
...@@ -916,7 +916,7 @@ OutputState OutputConfigurator::ChooseOutputState( ...@@ -916,7 +916,7 @@ OutputState OutputConfigurator::ChooseOutputState(
return OUTPUT_STATE_DUAL_EXTENDED; return OUTPUT_STATE_DUAL_EXTENDED;
// With either both outputs on or both outputs off, use one of the // With either both outputs on or both outputs off, use one of the
// dual modes. // dual modes.
std::vector<int64> display_ids; std::vector<int64_t> display_ids;
for (size_t i = 0; i < cached_outputs_.size(); ++i) { for (size_t i = 0; i < cached_outputs_.size(); ++i) {
// If display id isn't available, switch to extended mode. // If display id isn't available, switch to extended mode.
if (!cached_outputs_[i].display->has_proper_display_id()) if (!cached_outputs_[i].display->has_proper_display_id())
......
...@@ -5,11 +5,12 @@ ...@@ -5,11 +5,12 @@
#ifndef UI_DISPLAY_CHROMEOS_OUTPUT_CONFIGURATOR_H_ #ifndef UI_DISPLAY_CHROMEOS_OUTPUT_CONFIGURATOR_H_
#define UI_DISPLAY_CHROMEOS_OUTPUT_CONFIGURATOR_H_ #define UI_DISPLAY_CHROMEOS_OUTPUT_CONFIGURATOR_H_
#include <stdint.h>
#include <map> #include <map>
#include <string> #include <string>
#include <vector> #include <vector>
#include "base/basictypes.h"
#include "base/event_types.h" #include "base/event_types.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/observer_list.h" #include "base/observer_list.h"
...@@ -88,11 +89,11 @@ class DISPLAY_EXPORT OutputConfigurator : public NativeDisplayObserver { ...@@ -88,11 +89,11 @@ class DISPLAY_EXPORT OutputConfigurator : public NativeDisplayObserver {
// Called when displays are detected. // Called when displays are detected.
virtual OutputState GetStateForDisplayIds( virtual OutputState GetStateForDisplayIds(
const std::vector<int64>& display_ids) const = 0; const std::vector<int64_t>& display_ids) const = 0;
// Queries the resolution (|size|) in pixels to select output mode for the // Queries the resolution (|size|) in pixels to select output mode for the
// given display id. // given display id.
virtual bool GetResolutionForDisplayId(int64 display_id, virtual bool GetResolutionForDisplayId(int64_t display_id,
gfx::Size* size) const = 0; gfx::Size* size) const = 0;
}; };
...@@ -199,7 +200,7 @@ class DISPLAY_EXPORT OutputConfigurator : public NativeDisplayObserver { ...@@ -199,7 +200,7 @@ class DISPLAY_EXPORT OutputConfigurator : public NativeDisplayObserver {
// If |background_color_argb| is non zero and there are multiple displays, // If |background_color_argb| is non zero and there are multiple displays,
// OutputConfigurator sets the background color of X's RootWindow to this // OutputConfigurator sets the background color of X's RootWindow to this
// color. // color.
void ForceInitialConfigure(uint32 background_color_argb); void ForceInitialConfigure(uint32_t background_color_argb);
// Stop handling display configuration events/requests. // Stop handling display configuration events/requests.
void PrepareForExit(); void PrepareForExit();
...@@ -247,7 +248,7 @@ class DISPLAY_EXPORT OutputConfigurator : public NativeDisplayObserver { ...@@ -247,7 +248,7 @@ class DISPLAY_EXPORT OutputConfigurator : public NativeDisplayObserver {
// which is a bitmask of the OutputProtectionMethod values. // which is a bitmask of the OutputProtectionMethod values.
// Returns true on success. // Returns true on success.
bool QueryOutputProtectionStatus(OutputProtectionClientId client_id, bool QueryOutputProtectionStatus(OutputProtectionClientId client_id,
int64 display_id, int64_t display_id,
uint32_t* link_mask, uint32_t* link_mask,
uint32_t* protection_mask); uint32_t* protection_mask);
...@@ -256,22 +257,22 @@ class DISPLAY_EXPORT OutputConfigurator : public NativeDisplayObserver { ...@@ -256,22 +257,22 @@ class DISPLAY_EXPORT OutputConfigurator : public NativeDisplayObserver {
// of the OutputProtectionMethod values. // of the OutputProtectionMethod values.
// Returns true when the protection request has been made. // Returns true when the protection request has been made.
bool EnableOutputProtection(OutputProtectionClientId client_id, bool EnableOutputProtection(OutputProtectionClientId client_id,
int64 display_id, int64_t display_id,
uint32_t desired_protection_mask); uint32_t desired_protection_mask);
// Checks the available color profiles for |display_id| and fills the result // Checks the available color profiles for |display_id| and fills the result
// into |profiles|. // into |profiles|.
std::vector<ui::ColorCalibrationProfile> GetAvailableColorCalibrationProfiles( std::vector<ui::ColorCalibrationProfile> GetAvailableColorCalibrationProfiles(
int64 display_id); int64_t display_id);
// Updates the color calibration to |new_profile|. // Updates the color calibration to |new_profile|.
bool SetColorCalibrationProfile( bool SetColorCalibrationProfile(
int64 display_id, int64_t display_id,
ui::ColorCalibrationProfile new_profile); ui::ColorCalibrationProfile new_profile);
private: private:
// Mapping a display_id to a protection request bitmask. // Mapping a display_id to a protection request bitmask.
typedef std::map<int64, uint32_t> DisplayProtections; typedef std::map<int64_t, uint32_t> DisplayProtections;
// Mapping a client to its protection request. // Mapping a client to its protection request.
typedef std::map<OutputProtectionClientId, DisplayProtections> typedef std::map<OutputProtectionClientId, DisplayProtections>
ProtectionRequests; ProtectionRequests;
......
...@@ -4,13 +4,14 @@ ...@@ -4,13 +4,14 @@
#include "ui/display/chromeos/output_configurator.h" #include "ui/display/chromeos/output_configurator.h"
#include <stdint.h>
#include <cmath> #include <cmath>
#include <cstdarg> #include <cstdarg>
#include <map> #include <map>
#include <string> #include <string>
#include <vector> #include <vector>
#include "base/basictypes.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/format_macros.h" #include "base/format_macros.h"
#include "base/memory/scoped_vector.h" #include "base/memory/scoped_vector.h"
...@@ -43,7 +44,7 @@ std::string DisplaySnapshotToString(const DisplaySnapshot& output) { ...@@ -43,7 +44,7 @@ std::string DisplaySnapshotToString(const DisplaySnapshot& output) {
// Returns a string describing a TestNativeDisplayDelegate::SetBackgroundColor() // Returns a string describing a TestNativeDisplayDelegate::SetBackgroundColor()
// call. // call.
std::string GetBackgroundAction(uint32 color_argb) { std::string GetBackgroundAction(uint32_t color_argb) {
return base::StringPrintf("background(0x%x)", color_argb); return base::StringPrintf("background(0x%x)", color_argb);
} }
...@@ -212,7 +213,7 @@ class TestNativeDisplayDelegate : public NativeDisplayDelegate { ...@@ -212,7 +213,7 @@ class TestNativeDisplayDelegate : public NativeDisplayDelegate {
virtual void GrabServer() OVERRIDE { log_->AppendAction(kGrab); } virtual void GrabServer() OVERRIDE { log_->AppendAction(kGrab); }
virtual void UngrabServer() OVERRIDE { log_->AppendAction(kUngrab); } virtual void UngrabServer() OVERRIDE { log_->AppendAction(kUngrab); }
virtual void SyncWithServer() OVERRIDE { log_->AppendAction(kSync); } virtual void SyncWithServer() OVERRIDE { log_->AppendAction(kSync); }
virtual void SetBackgroundColor(uint32 color_argb) OVERRIDE { virtual void SetBackgroundColor(uint32_t color_argb) OVERRIDE {
log_->AppendAction(GetBackgroundAction(color_argb)); log_->AppendAction(GetBackgroundAction(color_argb));
} }
virtual void ForceDPMSOn() OVERRIDE { log_->AppendAction(kForceDPMS); } virtual void ForceDPMSOn() OVERRIDE { log_->AppendAction(kForceDPMS); }
...@@ -349,10 +350,10 @@ class TestStateController : public OutputConfigurator::StateController { ...@@ -349,10 +350,10 @@ class TestStateController : public OutputConfigurator::StateController {
// OutputConfigurator::StateController overrides: // OutputConfigurator::StateController overrides:
virtual OutputState GetStateForDisplayIds( virtual OutputState GetStateForDisplayIds(
const std::vector<int64>& outputs) const OVERRIDE { const std::vector<int64_t>& outputs) const OVERRIDE {
return state_; return state_;
} }
virtual bool GetResolutionForDisplayId(int64 display_id, virtual bool GetResolutionForDisplayId(int64_t display_id,
gfx::Size* size) const OVERRIDE { gfx::Size* size) const OVERRIDE {
return false; return false;
} }
......
...@@ -195,7 +195,7 @@ void NativeDisplayDelegateX11::UngrabServer() { ...@@ -195,7 +195,7 @@ void NativeDisplayDelegateX11::UngrabServer() {
void NativeDisplayDelegateX11::SyncWithServer() { XSync(display_, 0); } void NativeDisplayDelegateX11::SyncWithServer() { XSync(display_, 0); }
void NativeDisplayDelegateX11::SetBackgroundColor(uint32 color_argb) { void NativeDisplayDelegateX11::SetBackgroundColor(uint32_t color_argb) {
// Configuring CRTCs/Framebuffer clears the boot screen image. Set the // Configuring CRTCs/Framebuffer clears the boot screen image. Set the
// same background color while configuring the display to minimize the // same background color while configuring the display to minimize the
// duration of black screen at boot time. The background is filled with // duration of black screen at boot time. The background is filled with
...@@ -344,7 +344,7 @@ DisplaySnapshotX11* NativeDisplayDelegateX11::InitDisplaySnapshot( ...@@ -344,7 +344,7 @@ DisplaySnapshotX11* NativeDisplayDelegateX11::InitDisplaySnapshot(
int index) { int index) {
int64_t display_id = 0; int64_t display_id = 0;
bool has_display_id = GetDisplayId( bool has_display_id = GetDisplayId(
id, static_cast<uint8>(index), &display_id); id, static_cast<uint8_t>(index), &display_id);
OutputType type = GetOutputTypeFromName(info->name); OutputType type = GetOutputTypeFromName(info->name);
if (type == OUTPUT_TYPE_UNKNOWN) if (type == OUTPUT_TYPE_UNKNOWN)
......
...@@ -5,10 +5,11 @@ ...@@ -5,10 +5,11 @@
#ifndef UI_DISPLAY_CHROMEOS_X11_NATIVE_DISPLAY_DELEGATE_X11_H_ #ifndef UI_DISPLAY_CHROMEOS_X11_NATIVE_DISPLAY_DELEGATE_X11_H_
#define UI_DISPLAY_CHROMEOS_X11_NATIVE_DISPLAY_DELEGATE_X11_H_ #define UI_DISPLAY_CHROMEOS_X11_NATIVE_DISPLAY_DELEGATE_X11_H_
#include <stdint.h>
#include <map> #include <map>
#include <vector> #include <vector>
#include "base/basictypes.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/event_types.h" #include "base/event_types.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
...@@ -70,7 +71,7 @@ class DISPLAY_EXPORT NativeDisplayDelegateX11 : public NativeDisplayDelegate { ...@@ -70,7 +71,7 @@ class DISPLAY_EXPORT NativeDisplayDelegateX11 : public NativeDisplayDelegate {
virtual void GrabServer() OVERRIDE; virtual void GrabServer() OVERRIDE;
virtual void UngrabServer() OVERRIDE; virtual void UngrabServer() OVERRIDE;
virtual void SyncWithServer() OVERRIDE; virtual void SyncWithServer() OVERRIDE;
virtual void SetBackgroundColor(uint32 color_argb) OVERRIDE; virtual void SetBackgroundColor(uint32_t color_argb) OVERRIDE;
virtual void ForceDPMSOn() OVERRIDE; virtual void ForceDPMSOn() OVERRIDE;
virtual std::vector<DisplaySnapshot*> GetOutputs() OVERRIDE; virtual std::vector<DisplaySnapshot*> GetOutputs() OVERRIDE;
virtual void AddMode(const DisplaySnapshot& output, virtual void AddMode(const DisplaySnapshot& output,
......
...@@ -21,19 +21,19 @@ namespace { ...@@ -21,19 +21,19 @@ namespace {
// treated as swap. The 'serial number' field in EDID isn't used here because // treated as swap. The 'serial number' field in EDID isn't used here because
// it is not guaranteed to have unique number and it may have the same fixed // it is not guaranteed to have unique number and it may have the same fixed
// value (like 0). // value (like 0).
int64 GetID(uint16 manufacturer_id, int64_t GetID(uint16_t manufacturer_id,
uint32 product_code_hash, uint32_t product_code_hash,
uint8 output_index) { uint8_t output_index) {
return ((static_cast<int64>(manufacturer_id) << 40) | return ((static_cast<int64_t>(manufacturer_id) << 40) |
(static_cast<int64>(product_code_hash) << 8) | output_index); (static_cast<int64_t>(product_code_hash) << 8) | output_index);
} }
} // namespace } // namespace
bool GetDisplayIdFromEDID(const std::vector<uint8>& edid, bool GetDisplayIdFromEDID(const std::vector<uint8_t>& edid,
uint8 output_index, uint8_t output_index,
int64* display_id_out) { int64_t* display_id_out) {
uint16 manufacturer_id = 0; uint16_t manufacturer_id = 0;
std::string product_name; std::string product_name;
// ParseOutputDeviceData fails if it doesn't have product_name. // ParseOutputDeviceData fails if it doesn't have product_name.
...@@ -41,7 +41,7 @@ bool GetDisplayIdFromEDID(const std::vector<uint8>& edid, ...@@ -41,7 +41,7 @@ bool GetDisplayIdFromEDID(const std::vector<uint8>& edid,
// Generates product specific value from product_name instead of product code. // Generates product specific value from product_name instead of product code.
// See crbug.com/240341 // See crbug.com/240341
uint32 product_code_hash = product_name.empty() ? uint32_t product_code_hash = product_name.empty() ?
0 : base::Hash(product_name); 0 : base::Hash(product_name);
if (manufacturer_id != 0) { if (manufacturer_id != 0) {
// An ID based on display's index will be assigned later if this call // An ID based on display's index will be assigned later if this call
...@@ -53,8 +53,8 @@ bool GetDisplayIdFromEDID(const std::vector<uint8>& edid, ...@@ -53,8 +53,8 @@ bool GetDisplayIdFromEDID(const std::vector<uint8>& edid,
return false; return false;
} }
bool ParseOutputDeviceData(const std::vector<uint8>& edid, bool ParseOutputDeviceData(const std::vector<uint8_t>& edid,
uint16* manufacturer_id, uint16_t* manufacturer_id,
std::string* human_readable_name) { std::string* human_readable_name) {
// See http://en.wikipedia.org/wiki/Extended_display_identification_data // See http://en.wikipedia.org/wiki/Extended_display_identification_data
// for the details of EDID data format. We use the following data: // for the details of EDID data format. We use the following data:
...@@ -76,7 +76,7 @@ bool ParseOutputDeviceData(const std::vector<uint8>& edid, ...@@ -76,7 +76,7 @@ bool ParseOutputDeviceData(const std::vector<uint8>& edid,
} }
*manufacturer_id = *manufacturer_id =
*reinterpret_cast<const uint16*>(&edid[kManufacturerOffset]); *reinterpret_cast<const uint16_t*>(&edid[kManufacturerOffset]);
#if defined(ARCH_CPU_LITTLE_ENDIAN) #if defined(ARCH_CPU_LITTLE_ENDIAN)
*manufacturer_id = base::ByteSwap(*manufacturer_id); *manufacturer_id = base::ByteSwap(*manufacturer_id);
#endif #endif
...@@ -121,7 +121,7 @@ bool ParseOutputDeviceData(const std::vector<uint8>& edid, ...@@ -121,7 +121,7 @@ bool ParseOutputDeviceData(const std::vector<uint8>& edid,
return true; return true;
} }
bool ParseOutputOverscanFlag(const std::vector<uint8>& edid, bool ParseOutputOverscanFlag(const std::vector<uint8_t>& edid,
bool* flag) { bool* flag) {
// See http://en.wikipedia.org/wiki/Extended_display_identification_data // See http://en.wikipedia.org/wiki/Extended_display_identification_data
// for the extension format of EDID. Also see EIA/CEA-861 spec for // for the extension format of EDID. Also see EIA/CEA-861 spec for
......
...@@ -5,10 +5,11 @@ ...@@ -5,10 +5,11 @@
#ifndef UI_DISPLAY_EDID_PARSER_H_ #ifndef UI_DISPLAY_EDID_PARSER_H_
#define UI_DISPLAY_EDID_PARSER_H_ #define UI_DISPLAY_EDID_PARSER_H_
#include <stdint.h>
#include <string> #include <string>
#include <vector> #include <vector>
#include "base/basictypes.h"
#include "ui/display/display_export.h" #include "ui/display/display_export.h"
// EDID (Extended Display Identification Data) is a format for monitor // EDID (Extended Display Identification Data) is a format for monitor
...@@ -19,19 +20,19 @@ namespace ui { ...@@ -19,19 +20,19 @@ namespace ui {
// Generates the display id for the pair of |edid| and |index|, and store in // Generates the display id for the pair of |edid| and |index|, and store in
// |display_id_out|. Returns true if the display id is successfully generated, // |display_id_out|. Returns true if the display id is successfully generated,
// or false otherwise. // or false otherwise.
DISPLAY_EXPORT bool GetDisplayIdFromEDID(const std::vector<uint8>& edid, DISPLAY_EXPORT bool GetDisplayIdFromEDID(const std::vector<uint8_t>& edid,
uint8 index, uint8_t index,
int64* display_id_out); int64_t* display_id_out);
// Parses |edid| as EDID data and stores extracted data into |manufacturer_id| // Parses |edid| as EDID data and stores extracted data into |manufacturer_id|
// and |human_readable_name| and returns true. NULL can be passed for unwanted // and |human_readable_name| and returns true. NULL can be passed for unwanted
// output parameters. Some devices (especially internal displays) may not have // output parameters. Some devices (especially internal displays) may not have
// the field for |human_readable_name|, and it will return true in that case. // the field for |human_readable_name|, and it will return true in that case.
DISPLAY_EXPORT bool ParseOutputDeviceData(const std::vector<uint8>& edid, DISPLAY_EXPORT bool ParseOutputDeviceData(const std::vector<uint8_t>& edid,
uint16* manufacturer_id, uint16_t* manufacturer_id,
std::string* human_readable_name); std::string* human_readable_name);
DISPLAY_EXPORT bool ParseOutputOverscanFlag(const std::vector<uint8>& edid, DISPLAY_EXPORT bool ParseOutputOverscanFlag(const std::vector<uint8_t>& edid,
bool* flag); bool* flag);
} // namespace ui } // namespace ui
......
...@@ -97,7 +97,7 @@ const unsigned char kLP2565B[] = ...@@ -97,7 +97,7 @@ const unsigned char kLP2565B[] =
TEST(EDIDParserTest, ParseOverscanFlag) { TEST(EDIDParserTest, ParseOverscanFlag) {
bool flag = false; bool flag = false;
std::vector<uint8> edid( std::vector<uint8_t> edid(
kNormalDisplay, kNormalDisplay + charsize(kNormalDisplay)); kNormalDisplay, kNormalDisplay + charsize(kNormalDisplay));
EXPECT_FALSE(ParseOutputOverscanFlag(edid, &flag)); EXPECT_FALSE(ParseOutputOverscanFlag(edid, &flag));
...@@ -127,7 +127,7 @@ TEST(EDIDParserTest, ParseOverscanFlag) { ...@@ -127,7 +127,7 @@ TEST(EDIDParserTest, ParseOverscanFlag) {
TEST(EDIDParserTest, ParseBrokenOverscanData) { TEST(EDIDParserTest, ParseBrokenOverscanData) {
// Do not fill valid data here because it anyway fails to parse the data. // Do not fill valid data here because it anyway fails to parse the data.
std::vector<uint8> data; std::vector<uint8_t> data;
bool flag = false; bool flag = false;
EXPECT_FALSE(ParseOutputOverscanFlag(data, &flag)); EXPECT_FALSE(ParseOutputOverscanFlag(data, &flag));
data.assign(126, '\0'); data.assign(126, '\0');
...@@ -145,9 +145,9 @@ TEST(EDIDParserTest, ParseBrokenOverscanData) { ...@@ -145,9 +145,9 @@ TEST(EDIDParserTest, ParseBrokenOverscanData) {
} }
TEST(EDIDParserTest, ParseEDID) { TEST(EDIDParserTest, ParseEDID) {
uint16 manufacturer_id = 0; uint16_t manufacturer_id = 0;
std::string human_readable_name; std::string human_readable_name;
std::vector<uint8> edid( std::vector<uint8_t> edid(
kNormalDisplay, kNormalDisplay + charsize(kNormalDisplay)); kNormalDisplay, kNormalDisplay + charsize(kNormalDisplay));
EXPECT_TRUE(ParseOutputDeviceData( EXPECT_TRUE(ParseOutputDeviceData(
edid, &manufacturer_id, &human_readable_name)); edid, &manufacturer_id, &human_readable_name));
...@@ -175,9 +175,9 @@ TEST(EDIDParserTest, ParseEDID) { ...@@ -175,9 +175,9 @@ TEST(EDIDParserTest, ParseEDID) {
} }
TEST(EDIDParserTest, ParseBrokenEDID) { TEST(EDIDParserTest, ParseBrokenEDID) {
uint16 manufacturer_id = 0; uint16_t manufacturer_id = 0;
std::string human_readable_name; std::string human_readable_name;
std::vector<uint8> edid; std::vector<uint8_t> edid;
// length == 0 // length == 0
EXPECT_FALSE(ParseOutputDeviceData( EXPECT_FALSE(ParseOutputDeviceData(
...@@ -201,9 +201,9 @@ TEST(EDIDParserTest, ParseBrokenEDID) { ...@@ -201,9 +201,9 @@ TEST(EDIDParserTest, ParseBrokenEDID) {
TEST(EDIDParserTest, GetDisplayId) { TEST(EDIDParserTest, GetDisplayId) {
// EDID of kLP2565A and B are slightly different but actually the same device. // EDID of kLP2565A and B are slightly different but actually the same device.
int64 id1 = -1; int64_t id1 = -1;
int64 id2 = -1; int64_t id2 = -1;
std::vector<uint8> edid(kLP2565A, kLP2565A + charsize(kLP2565A)); std::vector<uint8_t> edid(kLP2565A, kLP2565A + charsize(kLP2565A));
EXPECT_TRUE(GetDisplayIdFromEDID(edid, 0, &id1)); EXPECT_TRUE(GetDisplayIdFromEDID(edid, 0, &id1));
edid.assign(kLP2565B, kLP2565B + charsize(kLP2565B)); edid.assign(kLP2565B, kLP2565B + charsize(kLP2565B));
EXPECT_TRUE(GetDisplayIdFromEDID(edid, 0, &id2)); EXPECT_TRUE(GetDisplayIdFromEDID(edid, 0, &id2));
...@@ -212,16 +212,16 @@ TEST(EDIDParserTest, GetDisplayId) { ...@@ -212,16 +212,16 @@ TEST(EDIDParserTest, GetDisplayId) {
} }
TEST(EDIDParserTest, GetDisplayIdFromInternal) { TEST(EDIDParserTest, GetDisplayIdFromInternal) {
int64 id = -1; int64_t id = -1;
std::vector<uint8> edid( std::vector<uint8_t> edid(
kInternalDisplay, kInternalDisplay + charsize(kInternalDisplay)); kInternalDisplay, kInternalDisplay + charsize(kInternalDisplay));
EXPECT_TRUE(GetDisplayIdFromEDID(edid, 0, &id)); EXPECT_TRUE(GetDisplayIdFromEDID(edid, 0, &id));
EXPECT_NE(-1, id); EXPECT_NE(-1, id);
} }
TEST(EDIDParserTest, GetDisplayIdFailure) { TEST(EDIDParserTest, GetDisplayIdFailure) {
int64 id = -1; int64_t id = -1;
std::vector<uint8> edid; std::vector<uint8_t> edid;
EXPECT_FALSE(GetDisplayIdFromEDID(edid, 0, &id)); EXPECT_FALSE(GetDisplayIdFromEDID(edid, 0, &id));
EXPECT_EQ(-1, id); EXPECT_EQ(-1, id);
} }
......
...@@ -28,7 +28,7 @@ bool IsRandRAvailable() { ...@@ -28,7 +28,7 @@ bool IsRandRAvailable() {
// Get the EDID data from the |output| and stores to |edid|. // Get the EDID data from the |output| and stores to |edid|.
// Returns true if EDID property is successfully obtained. Otherwise returns // Returns true if EDID property is successfully obtained. Otherwise returns
// false and does not touch |edid|. // false and does not touch |edid|.
bool GetEDIDProperty(XID output, std::vector<uint8>* edid) { bool GetEDIDProperty(XID output, std::vector<uint8_t>* edid) {
if (!IsRandRAvailable()) if (!IsRandRAvailable())
return false; return false;
...@@ -81,9 +81,9 @@ bool GetEDIDProperty(XID output, std::vector<uint8>* edid) { ...@@ -81,9 +81,9 @@ bool GetEDIDProperty(XID output, std::vector<uint8>* edid) {
// fails to get those data and doesn't touch manufacturer ID/product code/name. // fails to get those data and doesn't touch manufacturer ID/product code/name.
// NULL can be passed for unwanted output parameters. // NULL can be passed for unwanted output parameters.
bool GetOutputDeviceData(XID output, bool GetOutputDeviceData(XID output,
uint16* manufacturer_id, uint16_t* manufacturer_id,
std::string* human_readable_name) { std::string* human_readable_name) {
std::vector<uint8> edid; std::vector<uint8_t> edid;
if (!GetEDIDProperty(output, &edid)) if (!GetEDIDProperty(output, &edid))
return false; return false;
...@@ -94,8 +94,10 @@ bool GetOutputDeviceData(XID output, ...@@ -94,8 +94,10 @@ bool GetOutputDeviceData(XID output,
} // namespace } // namespace
bool GetDisplayId(XID output_id, uint8 output_index, int64* display_id_out) { bool GetDisplayId(XID output_id,
std::vector<uint8> edid; uint8_t output_index,
int64_t* display_id_out) {
std::vector<uint8_t> edid;
if (!GetEDIDProperty(output_id, &edid)) if (!GetEDIDProperty(output_id, &edid))
return false; return false;
...@@ -110,7 +112,7 @@ std::string GetDisplayName(RROutput output) { ...@@ -110,7 +112,7 @@ std::string GetDisplayName(RROutput output) {
} }
bool GetOutputOverscanFlag(RROutput output, bool* flag) { bool GetOutputOverscanFlag(RROutput output, bool* flag) {
std::vector<uint8> edid; std::vector<uint8_t> edid;
if (!GetEDIDProperty(output, &edid)) if (!GetEDIDProperty(output, &edid))
return false; return false;
......
...@@ -5,9 +5,10 @@ ...@@ -5,9 +5,10 @@
#ifndef UI_DISPLAY_X11_EDID_PARSER_X11_H_ #ifndef UI_DISPLAY_X11_EDID_PARSER_X11_H_
#define UI_DISPLAY_X11_EDID_PARSER_X11_H_ #define UI_DISPLAY_X11_EDID_PARSER_X11_H_
#include <stdint.h>
#include <string> #include <string>
#include "base/basictypes.h"
#include "ui/display/display_constants.h" #include "ui/display/display_constants.h"
#include "ui/display/display_export.h" #include "ui/display/display_export.h"
...@@ -21,8 +22,8 @@ namespace ui { ...@@ -21,8 +22,8 @@ namespace ui {
// Gets the EDID data from |output| and generates the display id through // Gets the EDID data from |output| and generates the display id through
// |GetDisplayIdFromEDID|. // |GetDisplayIdFromEDID|.
DISPLAY_EXPORT bool GetDisplayId(XID output, DISPLAY_EXPORT bool GetDisplayId(XID output,
uint8 index, uint8_t index,
int64* display_id_out); int64_t* display_id_out);
// Generate the human readable string from EDID obtained from |output|. // Generate the human readable string from EDID obtained from |output|.
DISPLAY_EXPORT std::string GetDisplayName(RROutput output); DISPLAY_EXPORT std::string GetDisplayName(RROutput output);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment