| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/webui/chromeos/network_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/network_ui.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "chromeos/network/network_state.h" | 21 #include "chromeos/network/network_state.h" |
| 22 #include "chromeos/network/network_state_handler.h" | 22 #include "chromeos/network/network_state_handler.h" |
| 23 #include "components/device_event_log/device_event_log.h" | 23 #include "components/device_event_log/device_event_log.h" |
| 24 #include "content/public/browser/web_contents.h" | 24 #include "content/public/browser/web_contents.h" |
| 25 #include "content/public/browser/web_ui.h" | 25 #include "content/public/browser/web_ui.h" |
| 26 #include "content/public/browser/web_ui_data_source.h" | 26 #include "content/public/browser/web_ui_data_source.h" |
| 27 #include "content/public/browser/web_ui_message_handler.h" | 27 #include "content/public/browser/web_ui_message_handler.h" |
| 28 #include "third_party/cros_system_api/dbus/service_constants.h" | 28 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 29 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
| 30 #include "ui/chromeos/strings/grit/ui_chromeos_strings.h" | 30 #include "ui/chromeos/strings/grit/ui_chromeos_strings.h" |
| 31 #include "ui/views/widget/widget_parent.h" |
| 31 | 32 |
| 32 namespace chromeos { | 33 namespace chromeos { |
| 33 | 34 |
| 34 namespace { | 35 namespace { |
| 35 | 36 |
| 36 bool GetServicePathFromGuid(const std::string& guid, | 37 bool GetServicePathFromGuid(const std::string& guid, |
| 37 std::string* service_path) { | 38 std::string* service_path) { |
| 38 const NetworkState* network = | 39 const NetworkState* network = |
| 39 NetworkHandler::Get()->network_state_handler()->GetNetworkStateFromGuid( | 40 NetworkHandler::Get()->network_state_handler()->GetNetworkStateFromGuid( |
| 40 guid); | 41 guid); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 web_ui()->CallJavascriptFunctionUnsafe("NetworkUI.getShillPropertiesResult", | 138 web_ui()->CallJavascriptFunctionUnsafe("NetworkUI.getShillPropertiesResult", |
| 138 return_arg_list); | 139 return_arg_list); |
| 139 } | 140 } |
| 140 | 141 |
| 141 void AddNetwork(const base::ListValue* args) { | 142 void AddNetwork(const base::ListValue* args) { |
| 142 std::string onc_type; | 143 std::string onc_type; |
| 143 args->GetString(0, &onc_type); | 144 args->GetString(0, &onc_type); |
| 144 std::string shill_type = (onc_type == ::onc::network_type::kVPN) | 145 std::string shill_type = (onc_type == ::onc::network_type::kVPN) |
| 145 ? shill::kTypeVPN | 146 ? shill::kTypeVPN |
| 146 : shill::kTypeWifi; | 147 : shill::kTypeWifi; |
| 147 NetworkConfigView::ShowForType( | 148 views::WidgetParent widget_parent; |
| 148 shill_type, web_ui()->GetWebContents()->GetTopLevelNativeWindow()); | 149 widget_parent.native_parent = |
| 150 web_ui()->GetWebContents()->GetTopLevelNativeWindow(); |
| 151 NetworkConfigView::ShowForType(shill_type, widget_parent); |
| 149 } | 152 } |
| 150 | 153 |
| 151 base::WeakPtrFactory<NetworkConfigMessageHandler> weak_ptr_factory_; | 154 base::WeakPtrFactory<NetworkConfigMessageHandler> weak_ptr_factory_; |
| 152 | 155 |
| 153 DISALLOW_COPY_AND_ASSIGN(NetworkConfigMessageHandler); | 156 DISALLOW_COPY_AND_ASSIGN(NetworkConfigMessageHandler); |
| 154 }; | 157 }; |
| 155 | 158 |
| 156 } // namespace | 159 } // namespace |
| 157 | 160 |
| 158 // static | 161 // static |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 html->SetDefaultResource(IDR_NETWORK_UI_HTML); | 221 html->SetDefaultResource(IDR_NETWORK_UI_HTML); |
| 219 | 222 |
| 220 content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(), | 223 content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(), |
| 221 html); | 224 html); |
| 222 } | 225 } |
| 223 | 226 |
| 224 NetworkUI::~NetworkUI() { | 227 NetworkUI::~NetworkUI() { |
| 225 } | 228 } |
| 226 | 229 |
| 227 } // namespace chromeos | 230 } // namespace chromeos |
| OLD | NEW |