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/enterprise_enrollment_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/enterprise_enrollment_ui.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 resource_bundle.GetRawDataResource(IDR_ENTERPRISE_ENROLLMENT_HTML)); | 131 resource_bundle.GetRawDataResource(IDR_ENTERPRISE_ENROLLMENT_HTML)); |
132 response = | 132 response = |
133 jstemplate_builder::GetI18nTemplateHtml(html, localized_strings_.get()); | 133 jstemplate_builder::GetI18nTemplateHtml(html, localized_strings_.get()); |
134 } else if (path == kEnterpriseEnrollmentGaiaLoginPath) { | 134 } else if (path == kEnterpriseEnrollmentGaiaLoginPath) { |
135 static const base::StringPiece html(resource_bundle.GetRawDataResource( | 135 static const base::StringPiece html(resource_bundle.GetRawDataResource( |
136 IDR_GAIA_LOGIN_HTML)); | 136 IDR_GAIA_LOGIN_HTML)); |
137 response = | 137 response = |
138 jstemplate_builder::GetI18nTemplateHtml(html, localized_strings_.get()); | 138 jstemplate_builder::GetI18nTemplateHtml(html, localized_strings_.get()); |
139 } | 139 } |
140 | 140 |
141 // Send the response. | 141 SendResponse(request_id, base::RefCountedString::TakeString(&response)); |
142 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes()); | |
143 html_bytes->data.resize(response.size()); | |
144 std::copy(response.begin(), response.end(), html_bytes->data.begin()); | |
145 SendResponse(request_id, html_bytes); | |
146 } | 142 } |
147 | 143 |
148 std::string EnterpriseEnrollmentDataSource::GetMimeType( | 144 std::string EnterpriseEnrollmentDataSource::GetMimeType( |
149 const std::string& path) const { | 145 const std::string& path) const { |
150 return "text/html"; | 146 return "text/html"; |
151 } | 147 } |
152 | 148 |
153 EnterpriseEnrollmentDataSource::~EnterpriseEnrollmentDataSource() {} | 149 EnterpriseEnrollmentDataSource::~EnterpriseEnrollmentDataSource() {} |
154 | 150 |
155 EnterpriseEnrollmentUI::EnterpriseEnrollmentUI(TabContents* contents) | 151 EnterpriseEnrollmentUI::EnterpriseEnrollmentUI(TabContents* contents) |
(...skipping 17 matching lines...) Expand all Loading... |
173 // Set up the data source, so the enrollment page can be loaded. | 169 // Set up the data source, so the enrollment page can be loaded. |
174 tab_contents()->profile()->GetChromeURLDataManager()->AddDataSource( | 170 tab_contents()->profile()->GetChromeURLDataManager()->AddDataSource( |
175 new EnterpriseEnrollmentDataSource(localized_strings.release())); | 171 new EnterpriseEnrollmentDataSource(localized_strings.release())); |
176 } | 172 } |
177 | 173 |
178 EnterpriseEnrollmentScreenActor* EnterpriseEnrollmentUI::GetActor() { | 174 EnterpriseEnrollmentScreenActor* EnterpriseEnrollmentUI::GetActor() { |
179 return handler_; | 175 return handler_; |
180 } | 176 } |
181 | 177 |
182 } // namespace chromeos | 178 } // namespace chromeos |
OLD | NEW |