| 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/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // Make sure that chrome://register is available only during | 166 // Make sure that chrome://register is available only during |
| 167 // OOBE wizard lifetime and when device has not been registered yet. | 167 // OOBE wizard lifetime and when device has not been registered yet. |
| 168 #if defined(OS_CHROMEOS) | 168 #if defined(OS_CHROMEOS) |
| 169 if (!chromeos::WizardController::default_controller() || | 169 if (!chromeos::WizardController::default_controller() || |
| 170 chromeos::WizardController::IsDeviceRegistered()) { | 170 chromeos::WizardController::IsDeviceRegistered()) { |
| 171 scoped_refptr<RefCountedBytes> empty_bytes(new RefCountedBytes); | 171 scoped_refptr<RefCountedBytes> empty_bytes(new RefCountedBytes); |
| 172 SendResponse(request_id, empty_bytes); | 172 SendResponse(request_id, empty_bytes); |
| 173 return; | 173 return; |
| 174 } | 174 } |
| 175 | 175 |
| 176 static const base::StringPiece register_html( | 176 scoped_refptr<RefCountedMemory> html_bytes( |
| 177 ResourceBundle::GetSharedInstance().GetRawDataResource( | 177 ResourceBundle::GetSharedInstance().LoadDataResourceBytes( |
| 178 IDR_HOST_REGISTRATION_PAGE_HTML)); | 178 IDR_HOST_REGISTRATION_PAGE_HTML)); |
| 179 | 179 |
| 180 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); | |
| 181 html_bytes->data.resize(register_html.size()); | |
| 182 std::copy(register_html.begin(), | |
| 183 register_html.end(), | |
| 184 html_bytes->data.begin()); | |
| 185 | |
| 186 SendResponse(request_id, html_bytes); | 180 SendResponse(request_id, html_bytes); |
| 187 #else | 181 #else |
| 188 scoped_refptr<RefCountedBytes> empty_bytes(new RefCountedBytes); | 182 scoped_refptr<RefCountedBytes> empty_bytes(new RefCountedBytes); |
| 189 SendResponse(request_id, empty_bytes); | 183 SendResponse(request_id, empty_bytes); |
| 190 #endif | 184 #endif |
| 191 } | 185 } |
| 192 | 186 |
| 193 //////////////////////////////////////////////////////////////////////////////// | 187 //////////////////////////////////////////////////////////////////////////////// |
| 194 // | 188 // |
| 195 // RegisterPageHandler | 189 // RegisterPageHandler |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 | 305 |
| 312 RegisterPageUI::RegisterPageUI(TabContents* contents) : ChromeWebUI(contents) { | 306 RegisterPageUI::RegisterPageUI(TabContents* contents) : ChromeWebUI(contents) { |
| 313 RegisterPageHandler* handler = new RegisterPageHandler(); | 307 RegisterPageHandler* handler = new RegisterPageHandler(); |
| 314 AddMessageHandler((handler)->Attach(this)); | 308 AddMessageHandler((handler)->Attach(this)); |
| 315 handler->Init(); | 309 handler->Init(); |
| 316 RegisterPageUIHTMLSource* html_source = new RegisterPageUIHTMLSource(); | 310 RegisterPageUIHTMLSource* html_source = new RegisterPageUIHTMLSource(); |
| 317 | 311 |
| 318 // Set up the chrome://register/ source. | 312 // Set up the chrome://register/ source. |
| 319 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); | 313 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); |
| 320 } | 314 } |
| OLD | NEW |