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/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" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "chrome/browser/chromeos/version_loader.h" | 24 #include "chrome/browser/chromeos/version_loader.h" |
25 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
26 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 26 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
27 #include "chrome/common/url_constants.h" | 27 #include "chrome/common/url_constants.h" |
28 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
29 #include "content/public/browser/web_contents.h" | 29 #include "content/public/browser/web_contents.h" |
30 #include "content/public/browser/web_ui.h" | 30 #include "content/public/browser/web_ui.h" |
31 #include "content/public/browser/web_ui_message_handler.h" | 31 #include "content/public/browser/web_ui_message_handler.h" |
32 #include "googleurl/src/gurl.h" | 32 #include "googleurl/src/gurl.h" |
33 #include "grit/browser_resources.h" | 33 #include "grit/browser_resources.h" |
| 34 #include "ui/base/layout.h" |
34 #include "ui/base/resource/resource_bundle.h" | 35 #include "ui/base/resource/resource_bundle.h" |
35 | 36 |
36 using content::WebContents; | 37 using content::WebContents; |
37 using content::WebUIMessageHandler; | 38 using content::WebUIMessageHandler; |
38 | 39 |
39 namespace { | 40 namespace { |
40 | 41 |
41 // Host page JS API callback names. | 42 // Host page JS API callback names. |
42 const char kJsCallbackGetRegistrationUrl[] = "getRegistrationUrl"; | 43 const char kJsCallbackGetRegistrationUrl[] = "getRegistrationUrl"; |
43 const char kJsCallbackUserInfo[] = "getUserInfo"; | 44 const char kJsCallbackUserInfo[] = "getUserInfo"; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 // OOBE wizard lifetime and when device has not been registered yet. | 161 // OOBE wizard lifetime and when device has not been registered yet. |
161 if (!chromeos::WizardController::default_controller() || | 162 if (!chromeos::WizardController::default_controller() || |
162 chromeos::WizardController::IsDeviceRegistered()) { | 163 chromeos::WizardController::IsDeviceRegistered()) { |
163 scoped_refptr<base::RefCountedBytes> empty_bytes(new base::RefCountedBytes); | 164 scoped_refptr<base::RefCountedBytes> empty_bytes(new base::RefCountedBytes); |
164 SendResponse(request_id, empty_bytes); | 165 SendResponse(request_id, empty_bytes); |
165 return; | 166 return; |
166 } | 167 } |
167 | 168 |
168 scoped_refptr<base::RefCountedMemory> html_bytes( | 169 scoped_refptr<base::RefCountedMemory> html_bytes( |
169 ResourceBundle::GetSharedInstance().LoadDataResourceBytes( | 170 ResourceBundle::GetSharedInstance().LoadDataResourceBytes( |
170 IDR_HOST_REGISTRATION_PAGE_HTML)); | 171 IDR_HOST_REGISTRATION_PAGE_HTML, |
| 172 ui::SCALE_FACTOR_NONE)); |
171 | 173 |
172 SendResponse(request_id, html_bytes); | 174 SendResponse(request_id, html_bytes); |
173 } | 175 } |
174 | 176 |
175 //////////////////////////////////////////////////////////////////////////////// | 177 //////////////////////////////////////////////////////////////////////////////// |
176 // | 178 // |
177 // RegisterPageHandler | 179 // RegisterPageHandler |
178 // | 180 // |
179 //////////////////////////////////////////////////////////////////////////////// | 181 //////////////////////////////////////////////////////////////////////////////// |
180 RegisterPageHandler::RegisterPageHandler() { | 182 RegisterPageHandler::RegisterPageHandler() { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 RegisterPageUI::RegisterPageUI(content::WebUI* web_ui) | 278 RegisterPageUI::RegisterPageUI(content::WebUI* web_ui) |
277 : WebUIController(web_ui) { | 279 : WebUIController(web_ui) { |
278 RegisterPageHandler* handler = new RegisterPageHandler(); | 280 RegisterPageHandler* handler = new RegisterPageHandler(); |
279 web_ui->AddMessageHandler(handler); | 281 web_ui->AddMessageHandler(handler); |
280 RegisterPageUIHTMLSource* html_source = new RegisterPageUIHTMLSource(); | 282 RegisterPageUIHTMLSource* html_source = new RegisterPageUIHTMLSource(); |
281 | 283 |
282 // Set up the chrome://register/ source. | 284 // Set up the chrome://register/ source. |
283 Profile* profile = Profile::FromWebUI(web_ui); | 285 Profile* profile = Profile::FromWebUI(web_ui); |
284 ChromeURLDataManager::AddDataSource(profile, html_source); | 286 ChromeURLDataManager::AddDataSource(profile, html_source); |
285 } | 287 } |
OLD | NEW |