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

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

Issue 8726008: Disable network "Connect" dialog UI in case of policy-managed networks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years 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
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"
11 #include "chrome/browser/chromeos/options/vpn_config_view.h" 11 #include "chrome/browser/chromeos/options/vpn_config_view.h"
12 #include "chrome/browser/chromeos/options/wifi_config_view.h" 12 #include "chrome/browser/chromeos/options/wifi_config_view.h"
13 #include "grit/chromium_strings.h" 13 #include "grit/chromium_strings.h"
14 #include "grit/generated_resources.h" 14 #include "grit/generated_resources.h"
15 #include "grit/locale_settings.h" 15 #include "grit/locale_settings.h"
16 #include "grit/theme_resources.h"
16 #include "ui/base/accessibility/accessible_view_state.h" 17 #include "ui/base/accessibility/accessible_view_state.h"
17 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
19 #include "ui/base/resource/resource_bundle.h"
20 #include "ui/gfx/image/image.h"
18 #include "ui/gfx/rect.h" 21 #include "ui/gfx/rect.h"
19 #include "ui/views/controls/button/text_button.h" 22 #include "ui/views/controls/button/text_button.h"
23 #include "ui/views/controls/image_view.h"
20 #include "ui/views/layout/grid_layout.h" 24 #include "ui/views/layout/grid_layout.h"
21 #include "ui/views/layout/layout_constants.h" 25 #include "ui/views/layout/layout_constants.h"
22 #include "ui/views/widget/widget.h" 26 #include "ui/views/widget/widget.h"
23 27
24 namespace chromeos { 28 namespace chromeos {
25 29
26 // static 30 // static
27 const int ChildNetworkConfigView::kInputFieldMinWidth = 270; 31 const int ChildNetworkConfigView::kInputFieldMinWidth = 270;
28 32
29 NetworkConfigView::NetworkConfigView(Network* network) 33 NetworkConfigView::NetworkConfigView(Network* network)
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 advanced_button_container_->SetLayoutManager(layout); 184 advanced_button_container_->SetLayoutManager(layout);
181 185
182 int column_set_id = 0; 186 int column_set_id = 0;
183 views::ColumnSet* column_set = layout->AddColumnSet(column_set_id); 187 views::ColumnSet* column_set = layout->AddColumnSet(column_set_id);
184 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::LEADING, 188 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::LEADING,
185 0, views::GridLayout::USE_PREF, 0, 0); 189 0, views::GridLayout::USE_PREF, 0, 0);
186 layout->StartRow(0, column_set_id); 190 layout->StartRow(0, column_set_id);
187 layout->AddView(advanced_button_); 191 layout->AddView(advanced_button_);
188 } 192 }
189 193
194 ControlledSettingIndicatorView::ControlledSettingIndicatorView()
195 : managed_(false),
196 image_view_(NULL) {
197 Init();
198 }
199
200 ControlledSettingIndicatorView::ControlledSettingIndicatorView(
201 const NetworkPropertyUIData& ui_data)
202 : managed_(false),
203 image_view_(NULL) {
204 Init();
205 Update(ui_data);
206 }
207
208 ControlledSettingIndicatorView::~ControlledSettingIndicatorView() {}
209
210 void ControlledSettingIndicatorView::Update(
211 const NetworkPropertyUIData& ui_data) {
212 if (managed_ == ui_data.managed())
213 return;
214
215 managed_ = ui_data.managed();
216 PreferredSizeChanged();
217 }
218
219 gfx::Size ControlledSettingIndicatorView::GetPreferredSize() {
220 if (!IsVisible())
221 return gfx::Size();
222
223 return image_view_->GetPreferredSize();
224 }
225
226 bool ControlledSettingIndicatorView::IsVisible() const {
227 return managed_ && views::View::IsVisible();
228 }
229
230 void ControlledSettingIndicatorView::Layout() {
231 image_view_->SetBounds(0, 0, width(), height());
232 }
233
234 void ControlledSettingIndicatorView::OnMouseEntered(
235 const views::MouseEvent& event) {
236 image_view_->SetImage(color_image_);
237 }
238
239 void ControlledSettingIndicatorView::OnMouseExited(
240 const views::MouseEvent& event) {
241 image_view_->SetImage(gray_image_);
242 }
243
244 void ControlledSettingIndicatorView::Init() {
245 color_image_ = ResourceBundle::GetSharedInstance().GetImageNamed(
246 IDR_CONTROLLED_SETTING_MANDATORY).ToSkBitmap();
247 gray_image_ = ResourceBundle::GetSharedInstance().GetImageNamed(
248 IDR_CONTROLLED_SETTING_MANDATORY_GRAY).ToSkBitmap();
249 image_view_ = new views::ImageView();
250 // Disable |image_view_| so mouse events propagate to the parent.
251 image_view_->SetEnabled(false);
252 image_view_->SetImage(gray_image_);
253 image_view_->SetTooltipText(
254 l10n_util::GetStringUTF16(IDS_OPTIONS_CONTROLLED_SETTING_POLICY));
255 AddChildView(image_view_);
256 }
257
190 } // namespace chromeos 258 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/options/network_config_view.h ('k') | chrome/browser/chromeos/options/vpn_config_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698