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

Side by Side Diff: ash/system/network/network_list.cc

Issue 2861773003: chromeos: Fix crash when clicking on networking menu under mash (Closed)
Patch Set: review comments Created 3 years, 7 months 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 unified diff | Download patch
« no previous file with comments | « ash/mus/window_manager_application.cc ('k') | ash/system/network/tray_network_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ash/system/network/network_list.h" 5 #include "ash/system/network/network_list.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "ash/public/cpp/config.h"
9 #include "ash/shell.h" 10 #include "ash/shell.h"
10 #include "ash/shell_port.h" 11 #include "ash/shell_port.h"
11 #include "ash/strings/grit/ash_strings.h" 12 #include "ash/strings/grit/ash_strings.h"
12 #include "ash/system/network/network_icon.h" 13 #include "ash/system/network/network_icon.h"
13 #include "ash/system/network/network_icon_animation.h" 14 #include "ash/system/network/network_icon_animation.h"
14 #include "ash/system/network/network_info.h" 15 #include "ash/system/network/network_info.h"
15 #include "ash/system/network/network_state_list_detailed_view.h" 16 #include "ash/system/network/network_state_list_detailed_view.h"
16 #include "ash/system/networking_config_delegate.h" 17 #include "ash/system/networking_config_delegate.h"
17 #include "ash/system/tray/fixed_sized_image_view.h" 18 #include "ash/system/tray/fixed_sized_image_view.h"
18 #include "ash/system/tray/hover_highlight_view.h" 19 #include "ash/system/tray/hover_highlight_view.h"
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 container()->ScrollRectToVisible(selected_view->bounds()); 519 container()->ScrollRectToVisible(selected_view->bounds());
519 } 520 }
520 521
521 std::unique_ptr<std::set<std::string>> 522 std::unique_ptr<std::set<std::string>>
522 NetworkListView::UpdateNetworkListEntries() { 523 NetworkListView::UpdateNetworkListEntries() {
523 NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler(); 524 NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler();
524 525
525 // Keep an index where the next child should be inserted. 526 // Keep an index where the next child should be inserted.
526 int index = 0; 527 int index = 0;
527 528
528 bool show_connection_warning = 529 // Show a warning that the connection might be monitored if connected to a VPN
530 // or if the default network has a proxy installed.
531 const bool using_vpn =
529 !!NetworkHandler::Get()->network_state_handler()->ConnectedNetworkByType( 532 !!NetworkHandler::Get()->network_state_handler()->ConnectedNetworkByType(
530 NetworkTypePattern::VPN()); 533 NetworkTypePattern::VPN());
531 show_connection_warning = 534 // TODO(jamescook): Eliminate the null check by creating UIProxyConfigService
532 show_connection_warning || NetworkHandler::Get() 535 // under mash. This will require the mojo pref service to work with prefs in
533 ->ui_proxy_config_service() 536 // Local State. http://crbug.com/718072
534 ->HasDefaultNetworkProxyConfigured(); 537 const bool using_proxy = NetworkHandler::Get()->ui_proxy_config_service() &&
535 538 NetworkHandler::Get()
536 if (show_connection_warning) { 539 ->ui_proxy_config_service()
540 ->HasDefaultNetworkProxyConfigured();
541 if (using_vpn || using_proxy) {
537 if (!connection_warning_) 542 if (!connection_warning_)
538 connection_warning_ = CreateConnectionWarning(); 543 connection_warning_ = CreateConnectionWarning();
539 PlaceViewAtIndex(connection_warning_, index++); 544 PlaceViewAtIndex(connection_warning_, index++);
540 } 545 }
541 546
542 // First add high-priority networks (not Wi-Fi nor cellular). 547 // First add high-priority networks (not Wi-Fi nor cellular).
543 std::unique_ptr<std::set<std::string>> new_guids = 548 std::unique_ptr<std::set<std::string>> new_guids =
544 UpdateNetworkChildren(NetworkInfo::Type::UNKNOWN, index); 549 UpdateNetworkChildren(NetworkInfo::Type::UNKNOWN, index);
545 index += new_guids->size(); 550 index += new_guids->size();
546 551
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::DETAILED_VIEW_LABEL); 821 TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::DETAILED_VIEW_LABEL);
817 style.SetupLabel(label); 822 style.SetupLabel(label);
818 connection_warning->AddView(TriView::Container::CENTER, label); 823 connection_warning->AddView(TriView::Container::CENTER, label);
819 824
820 // Nothing to the right of the text. 825 // Nothing to the right of the text.
821 connection_warning->SetContainerVisible(TriView::Container::END, false); 826 connection_warning->SetContainerVisible(TriView::Container::END, false);
822 return connection_warning; 827 return connection_warning;
823 } 828 }
824 829
825 } // namespace ash 830 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/window_manager_application.cc ('k') | ash/system/network/tray_network_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698