Commit bc32dfbb authored by msw's avatar msw Committed by Commit bot

mash: Fix Chrome crash accessing chrome://settings.

Avoid Shell and PowerStatus access for display/power options.

BUG=646558,548429,644348
TEST=No crash accessing chrome://settings in chrome --mash.
R=stevenjb@chromium.org

Review-Url: https://codereview.chromium.org/2341783005
Cr-Commit-Position: refs/heads/master@{#418731}
parent 7eaa2e7f
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/values.h" #include "base/values.h"
#include "chrome/browser/chromeos/display/display_preferences.h" #include "chrome/browser/chromeos/display/display_preferences.h"
#include "chrome/browser/ui/ash/ash_util.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "chromeos/chromeos_switches.h" #include "chromeos/chromeos_switches.h"
#include "content/public/browser/user_metrics.h" #include "content/public/browser/user_metrics.h"
...@@ -191,13 +192,14 @@ base::DictionaryValue* ConvertBoundsToValue(const gfx::Rect& bounds) { ...@@ -191,13 +192,14 @@ base::DictionaryValue* ConvertBoundsToValue(const gfx::Rect& bounds) {
} // namespace } // namespace
DisplayOptionsHandler::DisplayOptionsHandler() { DisplayOptionsHandler::DisplayOptionsHandler() {
// ash::Shell doesn't exist in Athena. // TODO(mash) Support Chrome display settings in Mash. crbug.com/548429
// See: http://crbug.com/416961 if (!chrome::IsRunningInMash())
ash::Shell::GetInstance()->window_tree_host_manager()->AddObserver(this); ash::Shell::GetInstance()->window_tree_host_manager()->AddObserver(this);
} }
DisplayOptionsHandler::~DisplayOptionsHandler() { DisplayOptionsHandler::~DisplayOptionsHandler() {
// ash::Shell doesn't exist in Athena. // TODO(mash) Support Chrome display settings in Mash. crbug.com/548429
if (!chrome::IsRunningInMash())
ash::Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); ash::Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this);
} }
...@@ -373,6 +375,10 @@ void DisplayOptionsHandler::SendAllDisplayInfo() { ...@@ -373,6 +375,10 @@ void DisplayOptionsHandler::SendAllDisplayInfo() {
} }
void DisplayOptionsHandler::UpdateDisplaySettingsEnabled() { void DisplayOptionsHandler::UpdateDisplaySettingsEnabled() {
// TODO(mash) Support Chrome display settings in Mash. crbug.com/548429
if (chrome::IsRunningInMash())
return;
ash::DisplayManager* display_manager = GetDisplayManager(); ash::DisplayManager* display_manager = GetDisplayManager();
bool disable_multi_display_layout = bool disable_multi_display_layout =
base::CommandLine::ForCurrentProcess()->HasSwitch( base::CommandLine::ForCurrentProcess()->HasSwitch(
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/values.h" #include "base/values.h"
#include "chrome/browser/ui/ash/ash_util.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui.h"
...@@ -24,9 +25,11 @@ namespace chromeos { ...@@ -24,9 +25,11 @@ namespace chromeos {
namespace options { namespace options {
PowerHandler::PowerHandler() { PowerHandler::PowerHandler() {
this->show_power_status_ = switches::PowerOverlayEnabled() || // TODO(mash): Support Chrome power settings in Mash. crbug.com/644348
this->show_power_status_ = !chrome::IsRunningInMash() &&
(switches::PowerOverlayEnabled() ||
(PowerStatus::Get()->IsBatteryPresent() && (PowerStatus::Get()->IsBatteryPresent() &&
PowerStatus::Get()->SupportsDualRoleDevices()); PowerStatus::Get()->SupportsDualRoleDevices()));
} }
PowerHandler::~PowerHandler() { PowerHandler::~PowerHandler() {
......
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