| OLD | NEW |
| 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 "chrome/browser/ui/webui/options/chromeos/display_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/chromeos/display_options_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 73 } |
| 74 | 74 |
| 75 int64_t GetDisplayIdFromDictionary(const base::DictionaryValue* dictionary, | 75 int64_t GetDisplayIdFromDictionary(const base::DictionaryValue* dictionary, |
| 76 const std::string& key) { | 76 const std::string& key) { |
| 77 const base::Value* arg; | 77 const base::Value* arg; |
| 78 if (!dictionary->Get(key, &arg)) | 78 if (!dictionary->Get(key, &arg)) |
| 79 return display::kInvalidDisplayId; | 79 return display::kInvalidDisplayId; |
| 80 return GetDisplayIdFromValue(arg); | 80 return GetDisplayIdFromValue(arg); |
| 81 } | 81 } |
| 82 | 82 |
| 83 base::string16 GetColorProfileName(ui::ColorCalibrationProfile profile) { | 83 base::string16 GetColorProfileName(display::ColorCalibrationProfile profile) { |
| 84 switch (profile) { | 84 switch (profile) { |
| 85 case ui::COLOR_PROFILE_STANDARD: | 85 case display::COLOR_PROFILE_STANDARD: |
| 86 return l10n_util::GetStringUTF16( | 86 return l10n_util::GetStringUTF16( |
| 87 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_COLOR_PROFILE_STANDARD); | 87 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_COLOR_PROFILE_STANDARD); |
| 88 case ui::COLOR_PROFILE_DYNAMIC: | 88 case display::COLOR_PROFILE_DYNAMIC: |
| 89 return l10n_util::GetStringUTF16( | 89 return l10n_util::GetStringUTF16( |
| 90 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_COLOR_PROFILE_DYNAMIC); | 90 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_COLOR_PROFILE_DYNAMIC); |
| 91 case ui::COLOR_PROFILE_MOVIE: | 91 case display::COLOR_PROFILE_MOVIE: |
| 92 return l10n_util::GetStringUTF16( | 92 return l10n_util::GetStringUTF16( |
| 93 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_COLOR_PROFILE_MOVIE); | 93 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_COLOR_PROFILE_MOVIE); |
| 94 case ui::COLOR_PROFILE_READING: | 94 case display::COLOR_PROFILE_READING: |
| 95 return l10n_util::GetStringUTF16( | 95 return l10n_util::GetStringUTF16( |
| 96 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_COLOR_PROFILE_READING); | 96 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_COLOR_PROFILE_READING); |
| 97 case ui::NUM_COLOR_PROFILES: | 97 case display::NUM_COLOR_PROFILES: |
| 98 break; | 98 break; |
| 99 } | 99 } |
| 100 | 100 |
| 101 NOTREACHED(); | 101 NOTREACHED(); |
| 102 return base::string16(); | 102 return base::string16(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 int GetIntOrDouble(const base::DictionaryValue* dict, | 105 int GetIntOrDouble(const base::DictionaryValue* dict, |
| 106 const std::string& field) { | 106 const std::string& field) { |
| 107 double double_result = 0; | 107 double double_result = 0; |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 LOG(ERROR) << "Invalid profile_value"; | 551 LOG(ERROR) << "Invalid profile_value"; |
| 552 return; | 552 return; |
| 553 } | 553 } |
| 554 | 554 |
| 555 int profile_id; | 555 int profile_id; |
| 556 if (!base::StringToInt(profile_value, &profile_id)) { | 556 if (!base::StringToInt(profile_value, &profile_id)) { |
| 557 LOG(ERROR) << "Invalid profile: " << profile_value; | 557 LOG(ERROR) << "Invalid profile: " << profile_value; |
| 558 return; | 558 return; |
| 559 } | 559 } |
| 560 | 560 |
| 561 if (profile_id < ui::COLOR_PROFILE_STANDARD || | 561 if (profile_id < display::COLOR_PROFILE_STANDARD || |
| 562 profile_id > ui::COLOR_PROFILE_READING) { | 562 profile_id > display::COLOR_PROFILE_READING) { |
| 563 LOG(ERROR) << "Invalid profile_id: " << profile_id; | 563 LOG(ERROR) << "Invalid profile_id: " << profile_id; |
| 564 return; | 564 return; |
| 565 } | 565 } |
| 566 | 566 |
| 567 content::RecordAction( | 567 content::RecordAction( |
| 568 base::UserMetricsAction("Options_DisplaySetColorProfile")); | 568 base::UserMetricsAction("Options_DisplaySetColorProfile")); |
| 569 GetDisplayManager()->SetColorCalibrationProfile( | 569 GetDisplayManager()->SetColorCalibrationProfile( |
| 570 display_id, static_cast<ui::ColorCalibrationProfile>(profile_id)); | 570 display_id, static_cast<display::ColorCalibrationProfile>(profile_id)); |
| 571 | 571 |
| 572 SendAllDisplayInfo(); | 572 SendAllDisplayInfo(); |
| 573 } | 573 } |
| 574 | 574 |
| 575 void DisplayOptionsHandler::HandleSetUnifiedDesktopEnabled( | 575 void DisplayOptionsHandler::HandleSetUnifiedDesktopEnabled( |
| 576 const base::ListValue* args) { | 576 const base::ListValue* args) { |
| 577 DCHECK(GetDisplayManager()->unified_desktop_enabled()); | 577 DCHECK(GetDisplayManager()->unified_desktop_enabled()); |
| 578 bool enable = false; | 578 bool enable = false; |
| 579 if (!args->GetBoolean(0, &enable)) | 579 if (!args->GetBoolean(0, &enable)) |
| 580 NOTREACHED(); | 580 NOTREACHED(); |
| 581 | 581 |
| 582 GetDisplayManager()->SetDefaultMultiDisplayModeForCurrentDisplays( | 582 GetDisplayManager()->SetDefaultMultiDisplayModeForCurrentDisplays( |
| 583 enable ? display::DisplayManager::UNIFIED | 583 enable ? display::DisplayManager::UNIFIED |
| 584 : display::DisplayManager::EXTENDED); | 584 : display::DisplayManager::EXTENDED); |
| 585 } | 585 } |
| 586 | 586 |
| 587 } // namespace options | 587 } // namespace options |
| 588 } // namespace chromeos | 588 } // namespace chromeos |
| OLD | NEW |