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

Side by Side Diff: chrome/browser/chromeos/options/network_config_view.cc

Issue 7066002: [ChromeOS] Ensure advanced network config dialog is centered. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test upload after moving change to a different branch. Created 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/chromeos/options/network_config_view.h" 5 #include "chrome/browser/chromeos/options/network_config_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // Clear out the old widgets and build new ones. 128 // Clear out the old widgets and build new ones.
129 RemoveChildView(child_config_view_); 129 RemoveChildView(child_config_view_);
130 delete child_config_view_; 130 delete child_config_view_;
131 // For now, there is only an advanced view for Wi-Fi 802.1X. 131 // For now, there is only an advanced view for Wi-Fi 802.1X.
132 child_config_view_ = new WifiConfigView(this, true /* show_8021x */); 132 child_config_view_ = new WifiConfigView(this, true /* show_8021x */);
133 AddChildView(child_config_view_); 133 AddChildView(child_config_view_);
134 // Resize the window to be able to hold the new widgets. 134 // Resize the window to be able to hold the new widgets.
135 gfx::Size size = views::Window::GetLocalizedContentsSize( 135 gfx::Size size = views::Window::GetLocalizedContentsSize(
136 IDS_JOIN_WIFI_NETWORK_DIALOG_WIDTH_CHARS, 136 IDS_JOIN_WIFI_NETWORK_DIALOG_WIDTH_CHARS,
137 IDS_JOIN_WIFI_NETWORK_DIALOG_ADVANCED_MINIMUM_HEIGHT_LINES); 137 IDS_JOIN_WIFI_NETWORK_DIALOG_ADVANCED_MINIMUM_HEIGHT_LINES);
138 gfx::Rect bounds(size.width(), size.height()); 138 // Get the new bounds with desired size at the same center point.
139 // Window is automatically centered. 139 gfx::Rect bounds = window()->GetBounds();
140 int horiz_padding = bounds.width() - size.width();
141 int vert_padding = bounds.height() - size.height();
142 bounds.Inset(horiz_padding / 2, vert_padding / 2,
143 horiz_padding / 2, vert_padding / 2);
140 window()->SetWindowBounds(bounds, GetNativeWindow()); 144 window()->SetWindowBounds(bounds, GetNativeWindow());
141 Layout(); 145 Layout();
142 child_config_view_->InitFocus(); 146 child_config_view_->InitFocus();
143 } 147 }
144 148
145 void NetworkConfigView::Layout() { 149 void NetworkConfigView::Layout() {
146 child_config_view_->SetBounds(0, 0, width(), height()); 150 child_config_view_->SetBounds(0, 0, width(), height());
147 } 151 }
148 152
149 gfx::Size NetworkConfigView::GetPreferredSize() { 153 gfx::Size NetworkConfigView::GetPreferredSize() {
(...skipping 29 matching lines...) Expand all
179 183
180 int column_set_id = 0; 184 int column_set_id = 0;
181 views::ColumnSet* column_set = layout->AddColumnSet(column_set_id); 185 views::ColumnSet* column_set = layout->AddColumnSet(column_set_id);
182 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::LEADING, 186 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::LEADING,
183 0, views::GridLayout::USE_PREF, 0, 0); 187 0, views::GridLayout::USE_PREF, 0, 0);
184 layout->StartRow(0, column_set_id); 188 layout->StartRow(0, column_set_id);
185 layout->AddView(advanced_button_); 189 layout->AddView(advanced_button_);
186 } 190 }
187 191
188 } // namespace chromeos 192 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698