| 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/register_page_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/register_page_ui.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/string_piece.h" | 13 #include "base/string_piece.h" |
| 14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/browser/chromeos/cros/cros_library.h" | 17 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 18 #include "chrome/browser/chromeos/cros/network_library.h" | 18 #include "chrome/browser/chromeos/cros/network_library.h" |
| 19 #include "chrome/browser/chromeos/customization_document.h" | 19 #include "chrome/browser/chromeos/customization_document.h" |
| 20 #include "chrome/browser/chromeos/login/wizard_controller.h" | 20 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 21 #include "chrome/browser/chromeos/system/runtime_environment.h" | 21 #include "chrome/browser/chromeos/system/runtime_environment.h" |
| 22 #include "chrome/browser/chromeos/system/statistics_provider.h" | 22 #include "chrome/browser/chromeos/system/statistics_provider.h" |
| 23 #include "chrome/browser/chromeos/version_loader.h" | 23 #include "chrome/browser/chromeos/version_loader.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 25 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 26 #include "chrome/common/url_constants.h" | 26 #include "chrome/common/url_constants.h" |
| 27 #include "content/browser/tab_contents/tab_contents.h" | |
| 28 #include "content/public/browser/browser_thread.h" | 27 #include "content/public/browser/browser_thread.h" |
| 28 #include "content/public/browser/web_contents.h" |
| 29 #include "googleurl/src/gurl.h" | 29 #include "googleurl/src/gurl.h" |
| 30 #include "grit/browser_resources.h" | 30 #include "grit/browser_resources.h" |
| 31 #include "ui/base/resource/resource_bundle.h" | 31 #include "ui/base/resource/resource_bundle.h" |
| 32 | 32 |
| 33 using content::WebContents; |
| 34 |
| 33 namespace { | 35 namespace { |
| 34 | 36 |
| 35 // Host page JS API callback names. | 37 // Host page JS API callback names. |
| 36 const char kJsCallbackGetRegistrationUrl[] = "getRegistrationUrl"; | 38 const char kJsCallbackGetRegistrationUrl[] = "getRegistrationUrl"; |
| 37 const char kJsCallbackUserInfo[] = "getUserInfo"; | 39 const char kJsCallbackUserInfo[] = "getUserInfo"; |
| 38 | 40 |
| 39 // Host page JS API function names. | 41 // Host page JS API function names. |
| 40 const char kJsApiSetRegistrationUrl[] = "setRegistrationUrl"; | 42 const char kJsApiSetRegistrationUrl[] = "setRegistrationUrl"; |
| 41 const char kJsApiSetUserInfo[] = "setUserInfo"; | 43 const char kJsApiSetUserInfo[] = "setUserInfo"; |
| 42 const char kJsApiSkipRegistration[] = "skipRegistration"; | 44 const char kJsApiSkipRegistration[] = "skipRegistration"; |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 web_ui()->CallJavascriptFunction(kJsApiSetUserInfo, value); | 285 web_ui()->CallJavascriptFunction(kJsApiSetUserInfo, value); |
| 284 #endif | 286 #endif |
| 285 } | 287 } |
| 286 | 288 |
| 287 //////////////////////////////////////////////////////////////////////////////// | 289 //////////////////////////////////////////////////////////////////////////////// |
| 288 // | 290 // |
| 289 // RegisterPageUI | 291 // RegisterPageUI |
| 290 // | 292 // |
| 291 //////////////////////////////////////////////////////////////////////////////// | 293 //////////////////////////////////////////////////////////////////////////////// |
| 292 | 294 |
| 293 RegisterPageUI::RegisterPageUI(TabContents* contents) : ChromeWebUI(contents) { | 295 RegisterPageUI::RegisterPageUI(WebContents* contents) : ChromeWebUI(contents) { |
| 294 RegisterPageHandler* handler = new RegisterPageHandler(); | 296 RegisterPageHandler* handler = new RegisterPageHandler(); |
| 295 AddMessageHandler(handler); | 297 AddMessageHandler(handler); |
| 296 RegisterPageUIHTMLSource* html_source = new RegisterPageUIHTMLSource(); | 298 RegisterPageUIHTMLSource* html_source = new RegisterPageUIHTMLSource(); |
| 297 | 299 |
| 298 // Set up the chrome://register/ source. | 300 // Set up the chrome://register/ source. |
| 299 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); | 301 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); |
| 300 profile->GetChromeURLDataManager()->AddDataSource(html_source); | 302 profile->GetChromeURLDataManager()->AddDataSource(html_source); |
| 301 } | 303 } |
| OLD | NEW |