Skip to content

Commit

Permalink
Renaming ui/display constants and variables from OUTPUT_* to DISPLAY_*
Browse files Browse the repository at this point in the history
This moves all display configuration to using one terminology when referring to displays.

BUG=333413

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262503 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
dnicoara@chromium.org committed Apr 8, 2014
1 parent 47ed745 commit bcec7fb
Show file tree
Hide file tree
Showing 37 changed files with 646 additions and 590 deletions.
2 changes: 1 addition & 1 deletion apps/shell/browser/shell_desktop_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void ShellDesktopController::DestroyRootWindow() {
gfx::Size ShellDesktopController::GetPrimaryDisplaySize() {
#if defined(OS_CHROMEOS)
const std::vector<ui::DisplayConfigurator::DisplayState>& states =
display_configurator_->cached_outputs();
display_configurator_->cached_displays();
if (states.empty())
return gfx::Size();
const ui::DisplayMode* mode = states[0].display->current_mode();
Expand Down
42 changes: 21 additions & 21 deletions ash/display/display_change_observer_chromeos.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ DisplayChangeObserver::~DisplayChangeObserver() {
Shell::GetInstance()->RemoveShellObserver(this);
}

ui::OutputState DisplayChangeObserver::GetStateForDisplayIds(
ui::MultipleDisplayState DisplayChangeObserver::GetStateForDisplayIds(
const std::vector<int64>& display_ids) const {
CHECK_EQ(2U, display_ids.size());
DisplayIdPair pair = std::make_pair(display_ids[0], display_ids[1]);
DisplayLayout layout = Shell::GetInstance()->display_manager()->
layout_store()->GetRegisteredDisplayLayout(pair);
return layout.mirrored ? ui::OUTPUT_STATE_DUAL_MIRROR :
ui::OUTPUT_STATE_DUAL_EXTENDED;
return layout.mirrored ? ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR :
ui::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED;
}

bool DisplayChangeObserver::GetResolutionForDisplayId(int64 display_id,
Expand All @@ -118,40 +118,40 @@ bool DisplayChangeObserver::GetResolutionForDisplayId(int64 display_id,
}

void DisplayChangeObserver::OnDisplayModeChanged(
const std::vector<DisplayConfigurator::DisplayState>& outputs) {
const std::vector<DisplayConfigurator::DisplayState>& display_states) {
std::vector<DisplayInfo> displays;
std::set<int64> ids;
for (size_t i = 0; i < outputs.size(); ++i) {
const DisplayConfigurator::DisplayState& output = outputs[i];
for (size_t i = 0; i < display_states.size(); ++i) {
const DisplayConfigurator::DisplayState& state = display_states[i];

if (output.display->type() == ui::OUTPUT_TYPE_INTERNAL &&
if (state.display->type() == ui::DISPLAY_CONNECTION_TYPE_INTERNAL &&
gfx::Display::InternalDisplayId() == gfx::Display::kInvalidDisplayID) {
gfx::Display::SetInternalDisplayId(output.display->display_id());
gfx::Display::SetInternalDisplayId(state.display->display_id());
}

const ui::DisplayMode* mode_info = output.display->current_mode();
const ui::DisplayMode* mode_info = state.display->current_mode();
if (!mode_info)
continue;

float device_scale_factor = 1.0f;
if (!ui::IsDisplaySizeBlackListed(output.display->physical_size()) &&
if (!ui::IsDisplaySizeBlackListed(state.display->physical_size()) &&
(kInchInMm * mode_info->size().width() /
output.display->physical_size().width()) > kHighDensityDPIThreshold) {
state.display->physical_size().width()) > kHighDensityDPIThreshold) {
device_scale_factor = 2.0f;
}
gfx::Rect display_bounds(output.display->origin(), mode_info->size());
gfx::Rect display_bounds(state.display->origin(), mode_info->size());

std::vector<DisplayMode> display_modes = GetDisplayModeList(output);
std::vector<DisplayMode> display_modes = GetDisplayModeList(state);

std::string name =
output.display->type() == ui::OUTPUT_TYPE_INTERNAL
? l10n_util::GetStringUTF8(IDS_ASH_INTERNAL_DISPLAY_NAME) :
output.display->display_name();
state.display->type() == ui::DISPLAY_CONNECTION_TYPE_INTERNAL ?
l10n_util::GetStringUTF8(IDS_ASH_INTERNAL_DISPLAY_NAME) :
state.display->display_name();
if (name.empty())
name = l10n_util::GetStringUTF8(IDS_ASH_STATUS_TRAY_UNKNOWN_DISPLAY_NAME);

bool has_overscan = output.display->has_overscan();
int64 id = output.display->display_id();
bool has_overscan = state.display->has_overscan();
int64 id = state.display->display_id();
ids.insert(id);

displays.push_back(DisplayInfo(id, name, has_overscan));
Expand All @@ -160,9 +160,9 @@ void DisplayChangeObserver::OnDisplayModeChanged(
new_info.SetBounds(display_bounds);
new_info.set_native(true);
new_info.set_display_modes(display_modes);
new_info.set_touch_support(
output.touch_device_id == 0 ? gfx::Display::TOUCH_SUPPORT_UNAVAILABLE :
gfx::Display::TOUCH_SUPPORT_AVAILABLE);
new_info.set_touch_support(state.touch_device_id == 0 ?
gfx::Display::TOUCH_SUPPORT_UNAVAILABLE :
gfx::Display::TOUCH_SUPPORT_AVAILABLE);
new_info.set_available_color_profiles(
Shell::GetInstance()
->display_configurator()
Expand Down
2 changes: 1 addition & 1 deletion ash/display/display_change_observer_chromeos.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class DisplayChangeObserver : public ui::DisplayConfigurator::StateController,
virtual ~DisplayChangeObserver();

// ui::DisplayConfigurator::StateController overrides:
virtual ui::OutputState GetStateForDisplayIds(
virtual ui::MultipleDisplayState GetStateForDisplayIds(
const std::vector<int64>& outputs) const OVERRIDE;
virtual bool GetResolutionForDisplayId(int64 display_id,
gfx::Size* size) const OVERRIDE;
Expand Down
4 changes: 2 additions & 2 deletions ash/display/display_error_observer_chromeos.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ DisplayErrorObserver::~DisplayErrorObserver() {
}

void DisplayErrorObserver::OnDisplayModeChangeFailed(
ui::OutputState new_state) {
ui::MultipleDisplayState new_state) {
// Always remove the notification to make sure the notification appears
// as a popup in any situation.
message_center::MessageCenter::Get()->RemoveNotification(
kDisplayErrorNotificationId, false /* by_user */);

int message_id = (new_state == ui::OUTPUT_STATE_DUAL_MIRROR) ?
int message_id = (new_state == ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR) ?
IDS_ASH_DISPLAY_FAILURE_ON_MIRRORING :
IDS_ASH_DISPLAY_FAILURE_ON_NON_MIRRORING;

Expand Down
4 changes: 2 additions & 2 deletions ash/display/display_error_observer_chromeos.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class ASH_EXPORT DisplayErrorObserver
virtual ~DisplayErrorObserver();

// ui::DisplayConfigurator::Observer overrides:
virtual void OnDisplayModeChangeFailed(ui::OutputState failed_new_state)
OVERRIDE;
virtual void OnDisplayModeChangeFailed(
ui::MultipleDisplayState failed_new_state) OVERRIDE;

private:
friend class DisplayErrorObserverTest;
Expand Down
11 changes: 6 additions & 5 deletions ash/display/display_error_observer_chromeos_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ TEST_F(DisplayErrorObserverTest, Normal) {
return;

UpdateDisplay("200x200,300x300");
observer()->OnDisplayModeChangeFailed(ui::OUTPUT_STATE_DUAL_MIRROR);
observer()->OnDisplayModeChangeFailed(ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR);
EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_FAILURE_ON_MIRRORING),
GetMessageContents());
}
Expand All @@ -56,11 +56,11 @@ TEST_F(DisplayErrorObserverTest, CallTwice) {
return;

UpdateDisplay("200x200,300x300");
observer()->OnDisplayModeChangeFailed(ui::OUTPUT_STATE_DUAL_MIRROR);
observer()->OnDisplayModeChangeFailed(ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR);
base::string16 message = GetMessageContents();
EXPECT_FALSE(message.empty());

observer()->OnDisplayModeChangeFailed(ui::OUTPUT_STATE_DUAL_MIRROR);
observer()->OnDisplayModeChangeFailed(ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR);
base::string16 message2 = GetMessageContents();
EXPECT_FALSE(message2.empty());
EXPECT_EQ(message, message2);
Expand All @@ -71,11 +71,12 @@ TEST_F(DisplayErrorObserverTest, CallWithDifferentState) {
return;

UpdateDisplay("200x200,300x300");
observer()->OnDisplayModeChangeFailed(ui::OUTPUT_STATE_DUAL_MIRROR);
observer()->OnDisplayModeChangeFailed(ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR);
EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_FAILURE_ON_MIRRORING),
GetMessageContents());

observer()->OnDisplayModeChangeFailed(ui::OUTPUT_STATE_DUAL_EXTENDED);
observer()->OnDisplayModeChangeFailed(
ui::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED);
EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_FAILURE_ON_NON_MIRRORING),
GetMessageContents());
}
Expand Down
5 changes: 3 additions & 2 deletions ash/display/display_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -864,8 +864,9 @@ void DisplayManager::SetMirrorMode(bool mirrored) {

#if defined(OS_CHROMEOS)
if (base::SysInfo::IsRunningOnChromeOS()) {
ui::OutputState new_state = mirrored ? ui::OUTPUT_STATE_DUAL_MIRROR :
ui::OUTPUT_STATE_DUAL_EXTENDED;
ui::MultipleDisplayState new_state =
mirrored ? ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR :
ui::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED;
Shell::GetInstance()->display_configurator()->SetDisplayMode(new_state);
return;
}
Expand Down
3 changes: 2 additions & 1 deletion ash/display/event_transformation_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ void EventTransformationHandler::OnTouchEvent(ui::TouchEvent* event) {
// Check display_configurator's output_state instead of checking
// DisplayManager::IsMirrored() because the compositor based mirroring
// won't cause the scaling issue.
if (display_configurator->output_state() != ui::OUTPUT_STATE_DUAL_MIRROR)
if (display_configurator->display_state() !=
ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR)
return;

const std::map<int, float>& area_ratio_map =
Expand Down
2 changes: 1 addition & 1 deletion ash/display/output_configurator_animation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ void OutputConfiguratorAnimation::OnDisplayModeChanged(
}

void OutputConfiguratorAnimation::OnDisplayModeChangeFailed(
ui::OutputState failed_new_state) {
ui::MultipleDisplayState failed_new_state) {
if (!hiding_layers_.empty())
StartFadeInAnimation();
}
Expand Down
4 changes: 2 additions & 2 deletions ash/display/output_configurator_animation.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class ASH_EXPORT OutputConfiguratorAnimation
// ui::DisplayConfigurator::Observer overrides:
virtual void OnDisplayModeChanged(
const ui::DisplayConfigurator::DisplayStateList& outputs) OVERRIDE;
virtual void OnDisplayModeChangeFailed(ui::OutputState failed_new_state)
OVERRIDE;
virtual void OnDisplayModeChangeFailed(
ui::MultipleDisplayState failed_new_state) OVERRIDE;

private:
// Clears all hiding layers. Note that in case that this method is called
Expand Down
9 changes: 5 additions & 4 deletions ash/display/projecting_observer_chromeos.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ ProjectingObserver::ProjectingObserver()
ProjectingObserver::~ProjectingObserver() {}

void ProjectingObserver::OnDisplayModeChanged(
const ui::DisplayConfigurator::DisplayStateList& outputs) {
const ui::DisplayConfigurator::DisplayStateList& display_states) {
has_internal_output_ = false;
output_count_ = outputs.size();
output_count_ = display_states.size();

for (size_t i = 0; i < outputs.size(); ++i) {
if (outputs[i].display->type() == ui::OUTPUT_TYPE_INTERNAL) {
for (size_t i = 0; i < display_states.size(); ++i) {
if (display_states[i].display->type() ==
ui::DISPLAY_CONNECTION_TYPE_INTERNAL) {
has_internal_output_ = true;
break;
}
Expand Down
4 changes: 2 additions & 2 deletions ash/display/projecting_observer_chromeos_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ namespace {

ui::TestDisplaySnapshot* CreateInternalSnapshot() {
ui::TestDisplaySnapshot* output = new ui::TestDisplaySnapshot();
output->set_type(ui::OUTPUT_TYPE_INTERNAL);
output->set_type(ui::DISPLAY_CONNECTION_TYPE_INTERNAL);
return output;
}

ui::TestDisplaySnapshot* CreateVGASnapshot() {
ui::TestDisplaySnapshot* output = new ui::TestDisplaySnapshot();
output->set_type(ui::OUTPUT_TYPE_VGA);
output->set_type(ui::DISPLAY_CONNECTION_TYPE_VGA);
return output;
}

Expand Down
2 changes: 1 addition & 1 deletion ash/shell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ void Shell::Init() {
#if defined(OS_CHROMEOS)
// Pass the initial display state to PowerButtonController.
power_button_controller_->OnDisplayModeChanged(
display_configurator_->cached_outputs());
display_configurator_->cached_displays());
#endif
AddShellObserver(lock_state_controller_.get());

Expand Down
4 changes: 2 additions & 2 deletions ash/wm/lock_state_controller_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1000,14 +1000,14 @@ TEST_F(LockStateControllerTest, HonorPowerButtonInDockedMode) {
ui::DisplayConfigurator::DisplayStateList outputs;
ui::DisplayConfigurator::DisplayState internal_output;
ui::TestDisplaySnapshot internal_display;
internal_display.set_type(ui::OUTPUT_TYPE_INTERNAL);
internal_display.set_type(ui::DISPLAY_CONNECTION_TYPE_INTERNAL);
internal_display.set_modes(modes.get());
internal_output.display = &internal_display;
outputs.push_back(internal_output);

ui::DisplayConfigurator::DisplayState external_output;
ui::TestDisplaySnapshot external_display;
external_display.set_type(ui::OUTPUT_TYPE_HDMI);
external_display.set_type(ui::DISPLAY_CONNECTION_TYPE_HDMI);
external_display.set_modes(modes.get());
external_output.display = &external_display;
outputs.push_back(external_output);
Expand Down
12 changes: 6 additions & 6 deletions ash/wm/power_button_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,15 @@ void PowerButtonController::OnLockButtonEvent(

#if defined(OS_CHROMEOS)
void PowerButtonController::OnDisplayModeChanged(
const ui::DisplayConfigurator::DisplayStateList& outputs) {
const ui::DisplayConfigurator::DisplayStateList& display_states) {
bool internal_display_off = false;
bool external_display_on = false;
for (size_t i = 0; i < outputs.size(); ++i) {
const ui::DisplayConfigurator::DisplayState& output = outputs[i];
if (output.display->type() == ui::OUTPUT_TYPE_INTERNAL) {
if (!output.display->current_mode())
for (size_t i = 0; i < display_states.size(); ++i) {
const ui::DisplayConfigurator::DisplayState& state = display_states[i];
if (state.display->type() == ui::DISPLAY_CONNECTION_TYPE_INTERNAL) {
if (!state.display->current_mode())
internal_display_off = true;
} else if (output.display->current_mode()) {
} else if (state.display->current_mode()) {
external_display_on = true;
}
}
Expand Down
Loading

0 comments on commit bcec7fb

Please sign in to comment.