| OLD | NEW |
| 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/ui/webui/chromeos/choose_mobile_network_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
| 14 #include "base/string_piece.h" | 14 #include "base/string_piece.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "chrome/browser/chromeos/cros/cros_library.h" | 16 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 17 #include "chrome/browser/chromeos/cros/network_library.h" | 17 #include "chrome/browser/chromeos/cros/network_library.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 19 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 20 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" | 20 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" |
| 21 #include "chrome/common/jstemplate_builder.h" | 21 #include "chrome/common/jstemplate_builder.h" |
| 22 #include "chrome/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" |
| 23 #include "content/browser/tab_contents/tab_contents.h" | |
| 24 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 24 #include "content/public/browser/web_contents.h" |
| 25 #include "grit/browser_resources.h" | 25 #include "grit/browser_resources.h" |
| 26 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
| 27 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
| 28 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
| 29 | 29 |
| 30 using content::WebContents; |
| 31 |
| 30 namespace chromeos { | 32 namespace chromeos { |
| 31 | 33 |
| 32 namespace { | 34 namespace { |
| 33 | 35 |
| 34 // JS API callbacks names. | 36 // JS API callbacks names. |
| 35 const char kJsApiCancel[] = "cancel"; | 37 const char kJsApiCancel[] = "cancel"; |
| 36 const char kJsApiConnect[] = "connect"; | 38 const char kJsApiConnect[] = "connect"; |
| 37 const char kJsApiPageReady[] = "pageReady"; | 39 const char kJsApiPageReady[] = "pageReady"; |
| 38 | 40 |
| 39 // Page JS API function names. | 41 // Page JS API function names. |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 if (has_pending_results_) { | 201 if (has_pending_results_) { |
| 200 web_ui()->CallJavascriptFunction(kJsApiShowNetworks, networks_list_); | 202 web_ui()->CallJavascriptFunction(kJsApiShowNetworks, networks_list_); |
| 201 networks_list_.Clear(); | 203 networks_list_.Clear(); |
| 202 has_pending_results_ = false; | 204 has_pending_results_ = false; |
| 203 } | 205 } |
| 204 is_page_ready_ = true; | 206 is_page_ready_ = true; |
| 205 } | 207 } |
| 206 | 208 |
| 207 } // namespace | 209 } // namespace |
| 208 | 210 |
| 209 ChooseMobileNetworkUI::ChooseMobileNetworkUI(TabContents* contents) | 211 ChooseMobileNetworkUI::ChooseMobileNetworkUI(WebContents* contents) |
| 210 : ChromeWebUI(contents) { | 212 : ChromeWebUI(contents) { |
| 211 ChooseMobileNetworkHandler* handler = new ChooseMobileNetworkHandler(); | 213 ChooseMobileNetworkHandler* handler = new ChooseMobileNetworkHandler(); |
| 212 AddMessageHandler(handler); | 214 AddMessageHandler(handler); |
| 213 // Set up the "chrome://choose-mobile-network" source. | 215 // Set up the "chrome://choose-mobile-network" source. |
| 214 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); | 216 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); |
| 215 profile->GetChromeURLDataManager()->AddDataSource( | 217 profile->GetChromeURLDataManager()->AddDataSource( |
| 216 CreateChooseMobileNetworkUIHTMLSource()); | 218 CreateChooseMobileNetworkUIHTMLSource()); |
| 217 } | 219 } |
| 218 | 220 |
| 219 } // namespace chromeos | 221 } // namespace chromeos |
| OLD | NEW |