OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 12 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
13 #include "chrome/browser/chromeos/options/network_property_ui_data.h" | 13 #include "chrome/browser/chromeos/options/network_property_ui_data.h" |
14 #include "chrome/browser/chromeos/options/vpn_config_view.h" | 14 #include "chrome/browser/chromeos/options/vpn_config_view.h" |
15 #include "chrome/browser/chromeos/options/wifi_config_view.h" | 15 #include "chrome/browser/chromeos/options/wifi_config_view.h" |
16 #include "chrome/browser/chromeos/options/wimax_config_view.h" | 16 #include "chrome/browser/chromeos/options/wimax_config_view.h" |
17 #include "chrome/browser/profiles/profile_manager.h" | 17 #include "chrome/browser/profiles/profile_manager.h" |
18 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
19 #include "chrome/browser/ui/browser_finder.h" | 19 #include "chrome/browser/ui/browser_finder.h" |
20 #include "chrome/browser/ui/browser_window.h" | 20 #include "chrome/browser/ui/browser_window.h" |
21 #include "chrome/browser/ui/host_desktop.h" | 21 #include "chrome/browser/ui/host_desktop.h" |
22 #include "chrome/grit/generated_resources.h" | 22 #include "chrome/grit/generated_resources.h" |
23 #include "chrome/grit/locale_settings.h" | 23 #include "chrome/grit/locale_settings.h" |
24 #include "chrome/grit/theme_resources.h" | 24 #include "chrome/grit/theme_resources.h" |
25 #include "chromeos/login/login_state.h" | 25 #include "chromeos/login/login_state.h" |
26 #include "chromeos/network/network_state.h" | 26 #include "chromeos/network/network_state.h" |
27 #include "chromeos/network/network_state_handler.h" | 27 #include "chromeos/network/network_state_handler.h" |
28 #include "components/device_event_log/device_event_log.h" | |
29 #include "components/user_manager/user.h" | 28 #include "components/user_manager/user.h" |
30 #include "ui/accessibility/ax_view_state.h" | 29 #include "ui/accessibility/ax_view_state.h" |
31 #include "ui/aura/window_event_dispatcher.h" | 30 #include "ui/aura/window_event_dispatcher.h" |
32 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
33 #include "ui/base/resource/resource_bundle.h" | 32 #include "ui/base/resource/resource_bundle.h" |
34 #include "ui/gfx/geometry/rect.h" | 33 #include "ui/gfx/geometry/rect.h" |
35 #include "ui/gfx/image/image.h" | 34 #include "ui/gfx/image/image.h" |
36 #include "ui/views/controls/button/label_button.h" | 35 #include "ui/views/controls/button/label_button.h" |
37 #include "ui/views/controls/image_view.h" | 36 #include "ui/views/controls/image_view.h" |
38 #include "ui/views/layout/layout_constants.h" | 37 #include "ui/views/layout/layout_constants.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 if (!network) { | 129 if (!network) { |
131 LOG(ERROR) << "NetworkConfigView::Show called with invalid service_path"; | 130 LOG(ERROR) << "NetworkConfigView::Show called with invalid service_path"; |
132 return; | 131 return; |
133 } | 132 } |
134 if (!view->InitWithNetworkState(network)) { | 133 if (!view->InitWithNetworkState(network)) { |
135 LOG(ERROR) << "NetworkConfigView::Show called with invalid network type: " | 134 LOG(ERROR) << "NetworkConfigView::Show called with invalid network type: " |
136 << network->type(); | 135 << network->type(); |
137 delete view; | 136 delete view; |
138 return; | 137 return; |
139 } | 138 } |
140 NET_LOG(USER) << "NetworkConfigView::Show: " << service_path; | |
141 view->ShowDialog(parent); | 139 view->ShowDialog(parent); |
142 } | 140 } |
143 | 141 |
144 // static | 142 // static |
145 void NetworkConfigView::ShowForType(const std::string& type, | 143 void NetworkConfigView::ShowForType(const std::string& type, |
146 gfx::NativeWindow parent) { | 144 gfx::NativeWindow parent) { |
147 if (GetActiveDialog() != NULL) | 145 if (GetActiveDialog() != NULL) |
148 return; | 146 return; |
149 NetworkConfigView* view = new NetworkConfigView(); | 147 NetworkConfigView* view = new NetworkConfigView(); |
150 if (!view->InitWithType(type)) { | 148 if (!view->InitWithType(type)) { |
151 LOG(ERROR) << "NetworkConfigView::ShowForType called with invalid type: " | 149 LOG(ERROR) << "NetworkConfigView::ShowForType called with invalid type: " |
152 << type; | 150 << type; |
153 delete view; | 151 delete view; |
154 return; | 152 return; |
155 } | 153 } |
156 NET_LOG(USER) << "NetworkConfigView::ShowForType: " << type; | |
157 view->ShowDialog(parent); | 154 view->ShowDialog(parent); |
158 } | 155 } |
159 | 156 |
160 gfx::NativeWindow NetworkConfigView::GetNativeWindow() const { | 157 gfx::NativeWindow NetworkConfigView::GetNativeWindow() const { |
161 return GetWidget()->GetNativeWindow(); | 158 return GetWidget()->GetNativeWindow(); |
162 } | 159 } |
163 | 160 |
164 base::string16 NetworkConfigView::GetDialogButtonLabel( | 161 base::string16 NetworkConfigView::GetDialogButtonLabel( |
165 ui::DialogButton button) const { | 162 ui::DialogButton button) const { |
166 if (button == ui::DIALOG_BUTTON_OK) { | 163 if (button == ui::DIALOG_BUTTON_OK) { |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 image_view_ = new views::ImageView(); | 351 image_view_ = new views::ImageView(); |
355 // Disable |image_view_| so mouse events propagate to the parent. | 352 // Disable |image_view_| so mouse events propagate to the parent. |
356 image_view_->SetEnabled(false); | 353 image_view_->SetEnabled(false); |
357 image_view_->SetImage(image_); | 354 image_view_->SetImage(image_); |
358 image_view_->SetTooltipText( | 355 image_view_->SetTooltipText( |
359 l10n_util::GetStringUTF16(IDS_OPTIONS_CONTROLLED_SETTING_POLICY)); | 356 l10n_util::GetStringUTF16(IDS_OPTIONS_CONTROLLED_SETTING_POLICY)); |
360 AddChildView(image_view_); | 357 AddChildView(image_view_); |
361 } | 358 } |
362 | 359 |
363 } // namespace chromeos | 360 } // namespace chromeos |
OLD | NEW |