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

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: fix shared build 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..65b8ceab781e7b2250c91257100446f598f5ff65 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;
@@ -456,9 +459,25 @@ void NetworkStateListDetailedView::CreateNetworkExtra() {
bottom_row->SetLayoutManager(layout);
if (list_type_ != LIST_TYPE_VPN) {
+ const base::DictionaryValue* global_network_config =
+ NetworkHandler::Get()
+ ->managed_network_configuration_handler()
+ ->GetGlobalConfigFromPolicy(
+ std::string() /* no username hash, device policy */);
+ bool policy_prohibites_unmanaged = false;
+ global_network_config &&
stevenjb 2015/11/23 18:10:34 if (global_network_config) { ... }
fqj 2015/11/23 19:21:47 Done.
+ global_network_config->GetBooleanWithoutPathExpansion(
+ ::onc::global_network_config::kAllowOnlyPolicyNetworksToConnect,
+ &policy_prohibites_unmanaged);
stevenjb 2015/11/23 18:10:34 Let's wrap the above in an anonymous function: bo
fqj 2015/11/23 19:21:47 Done.
stevenjb 2015/11/23 20:39:32 Sorry, I think I confused you with "anonymous func
other_wifi_ = new TrayPopupLabelButton(
this, rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_OTHER_WIFI));
bottom_row->AddChildView(other_wifi_);
+ if (policy_prohibites_unmanaged && LoginState::IsInitialized() &&
+ LoginState::Get()->IsUserLoggedIn()) {
+ 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 +804,7 @@ views::View* NetworkStateListDetailedView::CreateViewForNetwork(
view->SetBorder(
views::Border::CreateEmptyBorder(0, kTrayPopupPaddingHorizontal, 0, 0));
views::View* controlled_icon = CreateControlledByExtensionView(info);
+ view->SetTooltipText(info.tooltip);
if (controlled_icon)
view->AddChildView(controlled_icon);
return view;
@@ -805,6 +825,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->SetTooltipText(info.tooltip);
if (controlled_icon)
view->AddChildView(controlled_icon);
}

Powered by Google App Engine
This is Rietveld 408576698