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

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

Issue 2831023003: Refactor AddScrollListItem() in system menu detailed views (Closed)
Patch Set: Cleanup Created 3 years, 8 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "ash/strings/grit/ash_strings.h" 9 #include "ash/strings/grit/ash_strings.h"
10 #include "ash/system/network/network_icon.h" 10 #include "ash/system/network/network_icon.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // disabling of mobile radio. The toggle will get re-enabled in the next 124 // disabling of mobile radio. The toggle will get re-enabled in the next
125 // call to NetworkListView::Update(). 125 // call to NetworkListView::Update().
126 toggle_->SetEnabled(false); 126 toggle_->SetEnabled(false);
127 OnToggleToggled(toggle_->is_on()); 127 OnToggleToggled(toggle_->is_on());
128 } 128 }
129 129
130 private: 130 private:
131 void InitializeLayout() { 131 void InitializeLayout() {
132 TrayPopupUtils::ConfigureAsStickyHeader(this); 132 TrayPopupUtils::ConfigureAsStickyHeader(this);
133 SetLayoutManager(new views::FillLayout); 133 SetLayoutManager(new views::FillLayout);
134 container_ = TrayPopupUtils::CreateSubHeaderRowView(); 134 container_ = TrayPopupUtils::CreateSubHeaderRowView(true);
135 AddChildView(container_); 135 AddChildView(container_);
136 136
137 views::Label* label = TrayPopupUtils::CreateDefaultLabel(); 137 views::Label* label = TrayPopupUtils::CreateDefaultLabel();
138 style()->SetupLabel(label); 138 style()->SetupLabel(label);
139 label->SetText(l10n_util::GetStringUTF16(title_id_)); 139 label->SetText(l10n_util::GetStringUTF16(title_id_));
140 container_->AddView(TriView::Container::CENTER, label); 140 container_->AddView(TriView::Container::CENTER, label);
141 } 141 }
142 142
143 void AddToggleButton(bool enabled) { 143 void AddToggleButton(bool enabled) {
144 toggle_ = TrayPopupUtils::CreateToggleButton(this, title_id_); 144 toggle_ = TrayPopupUtils::CreateToggleButton(this, title_id_);
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 if (found == last_network_info_map_.end()) { 671 if (found == last_network_info_map_.end()) {
672 // If we cannot find |info| in |last_network_info_map_|, just return true 672 // If we cannot find |info| in |last_network_info_map_|, just return true
673 // since this is a new network so we have nothing to compare. 673 // since this is a new network so we have nothing to compare.
674 return true; 674 return true;
675 } else { 675 } else {
676 return *found->second != info; 676 return *found->second != info;
677 } 677 }
678 } 678 }
679 679
680 } // namespace ash 680 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698