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" |
28 #include "components/user_manager/user.h" | 29 #include "components/user_manager/user.h" |
29 #include "ui/accessibility/ax_view_state.h" | 30 #include "ui/accessibility/ax_view_state.h" |
30 #include "ui/aura/window_event_dispatcher.h" | 31 #include "ui/aura/window_event_dispatcher.h" |
31 #include "ui/base/l10n/l10n_util.h" | 32 #include "ui/base/l10n/l10n_util.h" |
32 #include "ui/base/resource/resource_bundle.h" | 33 #include "ui/base/resource/resource_bundle.h" |
33 #include "ui/gfx/geometry/rect.h" | 34 #include "ui/gfx/geometry/rect.h" |
34 #include "ui/gfx/image/image.h" | 35 #include "ui/gfx/image/image.h" |
35 #include "ui/views/controls/button/label_button.h" | 36 #include "ui/views/controls/button/label_button.h" |
36 #include "ui/views/controls/image_view.h" | 37 #include "ui/views/controls/image_view.h" |
37 #include "ui/views/layout/layout_constants.h" | 38 #include "ui/views/layout/layout_constants.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 if (!network) { | 130 if (!network) { |
130 LOG(ERROR) << "NetworkConfigView::Show called with invalid service_path"; | 131 LOG(ERROR) << "NetworkConfigView::Show called with invalid service_path"; |
131 return; | 132 return; |
132 } | 133 } |
133 if (!view->InitWithNetworkState(network)) { | 134 if (!view->InitWithNetworkState(network)) { |
134 LOG(ERROR) << "NetworkConfigView::Show called with invalid network type: " | 135 LOG(ERROR) << "NetworkConfigView::Show called with invalid network type: " |
135 << network->type(); | 136 << network->type(); |
136 delete view; | 137 delete view; |
137 return; | 138 return; |
138 } | 139 } |
| 140 NET_LOG(USER) << "NetworkConfigView::Show: " << service_path; |
139 view->ShowDialog(parent); | 141 view->ShowDialog(parent); |
140 } | 142 } |
141 | 143 |
142 // static | 144 // static |
143 void NetworkConfigView::ShowForType(const std::string& type, | 145 void NetworkConfigView::ShowForType(const std::string& type, |
144 gfx::NativeWindow parent) { | 146 gfx::NativeWindow parent) { |
145 if (GetActiveDialog() != NULL) | 147 if (GetActiveDialog() != NULL) |
146 return; | 148 return; |
147 NetworkConfigView* view = new NetworkConfigView(); | 149 NetworkConfigView* view = new NetworkConfigView(); |
148 if (!view->InitWithType(type)) { | 150 if (!view->InitWithType(type)) { |
149 LOG(ERROR) << "NetworkConfigView::ShowForType called with invalid type: " | 151 LOG(ERROR) << "NetworkConfigView::ShowForType called with invalid type: " |
150 << type; | 152 << type; |
151 delete view; | 153 delete view; |
152 return; | 154 return; |
153 } | 155 } |
| 156 NET_LOG(USER) << "NetworkConfigView::ShowForType: " << type; |
154 view->ShowDialog(parent); | 157 view->ShowDialog(parent); |
155 } | 158 } |
156 | 159 |
157 gfx::NativeWindow NetworkConfigView::GetNativeWindow() const { | 160 gfx::NativeWindow NetworkConfigView::GetNativeWindow() const { |
158 return GetWidget()->GetNativeWindow(); | 161 return GetWidget()->GetNativeWindow(); |
159 } | 162 } |
160 | 163 |
161 base::string16 NetworkConfigView::GetDialogButtonLabel( | 164 base::string16 NetworkConfigView::GetDialogButtonLabel( |
162 ui::DialogButton button) const { | 165 ui::DialogButton button) const { |
163 if (button == ui::DIALOG_BUTTON_OK) { | 166 if (button == ui::DIALOG_BUTTON_OK) { |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 image_view_ = new views::ImageView(); | 354 image_view_ = new views::ImageView(); |
352 // Disable |image_view_| so mouse events propagate to the parent. | 355 // Disable |image_view_| so mouse events propagate to the parent. |
353 image_view_->SetEnabled(false); | 356 image_view_->SetEnabled(false); |
354 image_view_->SetImage(image_); | 357 image_view_->SetImage(image_); |
355 image_view_->SetTooltipText( | 358 image_view_->SetTooltipText( |
356 l10n_util::GetStringUTF16(IDS_OPTIONS_CONTROLLED_SETTING_POLICY)); | 359 l10n_util::GetStringUTF16(IDS_OPTIONS_CONTROLLED_SETTING_POLICY)); |
357 AddChildView(image_view_); | 360 AddChildView(image_view_); |
358 } | 361 } |
359 | 362 |
360 } // namespace chromeos | 363 } // namespace chromeos |
OLD | NEW |