From 9bbb6b3f5f8973b8c8389858e2f421e36554b831 Mon Sep 17 00:00:00 2001 From: fqj Date: Tue, 17 Nov 2015 14:41:53 -0800 Subject: UI changes to disable button for prohibted technologies This commit grays out the buttons for some specific technologies, and modifies the hint text of system tray for user session if they are prohibited. It also removes the corresponding elements in chrome://settings page. Depends on: https://codereview.chromium.org/1431563005/ BUG=426390 Review URL: https://codereview.chromium.org/1434443002 Cr-Commit-Position: refs/heads/master@{#360186} --- chromeos/network/network_state_handler.cc | 2 ++ chromeos/network/network_state_handler.h | 6 +++++- chromeos/network/shill_property_handler.cc | 5 +++++ chromeos/network/shill_property_handler.h | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) (limited to 'chromeos/network') diff --git a/chromeos/network/network_state_handler.cc b/chromeos/network/network_state_handler.cc index 5007837..e2ea522 100644 --- a/chromeos/network/network_state_handler.cc +++ b/chromeos/network/network_state_handler.cc @@ -114,6 +114,8 @@ NetworkStateHandler::TechnologyState NetworkStateHandler::GetTechnologyState( state = TECHNOLOGY_ENABLED; else if (shill_property_handler_->IsTechnologyEnabling(technology)) state = TECHNOLOGY_ENABLING; + else if (shill_property_handler_->IsTechnologyProhibited(technology)) + state = TECHNOLOGY_PROHIBITED; else if (shill_property_handler_->IsTechnologyUninitialized(technology)) state = TECHNOLOGY_UNINITIALIZED; else if (shill_property_handler_->IsTechnologyAvailable(technology)) diff --git a/chromeos/network/network_state_handler.h b/chromeos/network/network_state_handler.h index a700f82..7dd422c 100644 --- a/chromeos/network/network_state_handler.h +++ b/chromeos/network/network_state_handler.h @@ -74,7 +74,8 @@ class CHROMEOS_EXPORT NetworkStateHandler TECHNOLOGY_AVAILABLE, TECHNOLOGY_UNINITIALIZED, TECHNOLOGY_ENABLING, - TECHNOLOGY_ENABLED + TECHNOLOGY_ENABLED, + TECHNOLOGY_PROHIBITED }; ~NetworkStateHandler() override; @@ -94,6 +95,9 @@ class CHROMEOS_EXPORT NetworkStateHandler bool IsTechnologyEnabled(const NetworkTypePattern& type) const { return GetTechnologyState(type) == TECHNOLOGY_ENABLED; } + bool IsTechnologyProhibited(const NetworkTypePattern& type) const { + return GetTechnologyState(type) == TECHNOLOGY_PROHIBITED; + } // Asynchronously sets the technology enabled property for |type|. Only // NetworkTypePattern::Primitive, ::Mobile and ::Ethernet are supported. diff --git a/chromeos/network/shill_property_handler.cc b/chromeos/network/shill_property_handler.cc index eb73b83..41482be 100644 --- a/chromeos/network/shill_property_handler.cc +++ b/chromeos/network/shill_property_handler.cc @@ -143,6 +143,11 @@ bool ShillPropertyHandler::IsTechnologyEnabling( return enabling_technologies_.count(technology) != 0; } +bool ShillPropertyHandler::IsTechnologyProhibited( + const std::string& technology) const { + return prohibited_technologies_.count(technology) != 0; +} + bool ShillPropertyHandler::IsTechnologyUninitialized( const std::string& technology) const { return uninitialized_technologies_.count(technology) != 0; diff --git a/chromeos/network/shill_property_handler.h b/chromeos/network/shill_property_handler.h index d88ac28..b4b6202 100644 --- a/chromeos/network/shill_property_handler.h +++ b/chromeos/network/shill_property_handler.h @@ -114,6 +114,7 @@ class CHROMEOS_EXPORT ShillPropertyHandler bool IsTechnologyAvailable(const std::string& technology) const; bool IsTechnologyEnabled(const std::string& technology) const; bool IsTechnologyEnabling(const std::string& technology) const; + bool IsTechnologyProhibited(const std::string& technology) const; bool IsTechnologyUninitialized(const std::string& technology) const; // Asynchronously sets the enabled state for |technology|. -- cgit v1.1