Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(783)

Unified Diff: ash/system/chromeos/network/network_state_list_detailed_view.cc

Issue 1469733003: system tray ui change for AllowOnlyPolicyNetworksToConnect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/system/chromeos/network/network_state_list_detailed_view.cc
diff --git a/ash/system/chromeos/network/network_state_list_detailed_view.cc b/ash/system/chromeos/network/network_state_list_detailed_view.cc
index f806dcd8699cd6cb07759977831dedc484a23abf..936e6901483e09d652a66623fcc8ec0b608310d0 100644
--- a/ash/system/chromeos/network/network_state_list_detailed_view.cc
+++ b/ash/system/chromeos/network/network_state_list_detailed_view.cc
@@ -31,7 +31,9 @@
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "chromeos/chromeos_switches.h"
+#include "chromeos/login/login_state.h"
#include "chromeos/network/device_state.h"
+#include "chromeos/network/managed_network_configuration_handler.h"
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
#include "grit/ash_resources.h"
@@ -59,6 +61,7 @@
#include "ui/views/widget/widget.h"
using chromeos::DeviceState;
+using chromeos::LoginState;
using chromeos::NetworkHandler;
using chromeos::NetworkState;
using chromeos::NetworkStateHandler;
@@ -93,6 +96,23 @@ views::View* CreateInfoBubbleLine(const base::string16& text_label,
return view;
}
+bool PolicyProhibitsUnmanaged() {
+ if (!LoginState::IsInitialized() || !LoginState::Get()->IsUserLoggedIn())
+ return false;
+ bool policy_prohibites_unmanaged = false;
+ const base::DictionaryValue* global_network_config =
+ NetworkHandler::Get()
+ ->managed_network_configuration_handler()
+ ->GetGlobalConfigFromPolicy(
+ std::string() /* no username hash, device policy */);
+ if (global_network_config) {
+ global_network_config->GetBooleanWithoutPathExpansion(
+ ::onc::global_network_config::kAllowOnlyPolicyNetworksToConnect,
+ &policy_prohibites_unmanaged);
+ }
+ return policy_prohibites_unmanaged;
+}
+
} // namespace
//------------------------------------------------------------------------------
@@ -455,10 +475,17 @@ void NetworkStateListDetailedView::CreateNetworkExtra() {
layout->SetDefaultFlex(1);
bottom_row->SetLayoutManager(layout);
+ bool policy_prohibites_unmanaged = PolicyProhibitsUnmanaged();
stevenjb 2015/11/23 22:05:53 s/prohibites/prohibits/ Also, this appears to be j
+
if (list_type_ != LIST_TYPE_VPN) {
other_wifi_ = new TrayPopupLabelButton(
this, rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_OTHER_WIFI));
bottom_row->AddChildView(other_wifi_);
+ if (policy_prohibites_unmanaged) {
+ other_wifi_->SetEnabled(false);
+ other_wifi_->SetTooltipText(l10n_util::GetStringUTF16(
+ IDS_ASH_STATUS_TRAY_NETWORK_PROHIBITED_OTHER));
+ }
turn_on_wifi_ = new TrayPopupLabelButton(
this, rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_TURN_ON_WIFI));
@@ -785,6 +812,7 @@ views::View* NetworkStateListDetailedView::CreateViewForNetwork(
view->SetBorder(
views::Border::CreateEmptyBorder(0, kTrayPopupPaddingHorizontal, 0, 0));
views::View* controlled_icon = CreateControlledByExtensionView(info);
+ view->set_tooltip(info.tooltip);
if (controlled_icon)
view->AddChildView(controlled_icon);
return view;
@@ -805,6 +833,7 @@ void NetworkStateListDetailedView::UpdateViewForNetwork(
HoverHighlightView* highlight = static_cast<HoverHighlightView*>(view);
highlight->AddIconAndLabel(info.image, info.label, info.highlight);
views::View* controlled_icon = CreateControlledByExtensionView(info);
+ highlight->set_tooltip(info.tooltip);
if (controlled_icon)
view->AddChildView(controlled_icon);
}
« no previous file with comments | « ash/ash.gyp ('k') | ui/chromeos/BUILD.gn » ('j') | ui/chromeos/network/network_list.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698