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

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: deps 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
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
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.
528 bool show_connection_warning = 531 bool show_connection_warning =
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): Create a UIProxyConfigService for mash. This will require
532 show_connection_warning || NetworkHandler::Get() 535 // the mojo pref service to work with Local State. http://crbug.com/718072
533 ->ui_proxy_config_service() 536 if (Shell::GetAshConfig() != Config::MASH) {
534 ->HasDefaultNetworkProxyConfigured(); 537 show_connection_warning =
535 538 show_connection_warning || NetworkHandler::Get()
539 ->ui_proxy_config_service()
stevenjb 2017/05/03 22:11:39 We could just test ui_proxy_config_service() and t
James Cook 2017/05/03 22:29:32 Done.
540 ->HasDefaultNetworkProxyConfigured();
541 }
536 if (show_connection_warning) { 542 if (show_connection_warning) {
537 if (!connection_warning_) 543 if (!connection_warning_)
538 connection_warning_ = CreateConnectionWarning(); 544 connection_warning_ = CreateConnectionWarning();
539 PlaceViewAtIndex(connection_warning_, index++); 545 PlaceViewAtIndex(connection_warning_, index++);
540 } 546 }
541 547
542 // First add high-priority networks (not Wi-Fi nor cellular). 548 // First add high-priority networks (not Wi-Fi nor cellular).
543 std::unique_ptr<std::set<std::string>> new_guids = 549 std::unique_ptr<std::set<std::string>> new_guids =
544 UpdateNetworkChildren(NetworkInfo::Type::UNKNOWN, index); 550 UpdateNetworkChildren(NetworkInfo::Type::UNKNOWN, index);
545 index += new_guids->size(); 551 index += new_guids->size();
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::DETAILED_VIEW_LABEL); 822 TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::DETAILED_VIEW_LABEL);
817 style.SetupLabel(label); 823 style.SetupLabel(label);
818 connection_warning->AddView(TriView::Container::CENTER, label); 824 connection_warning->AddView(TriView::Container::CENTER, label);
819 825
820 // Nothing to the right of the text. 826 // Nothing to the right of the text.
821 connection_warning->SetContainerVisible(TriView::Container::END, false); 827 connection_warning->SetContainerVisible(TriView::Container::END, false);
822 return connection_warning; 828 return connection_warning;
823 } 829 }
824 830
825 } // namespace ash 831 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698