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
3// found in the LICENSE file.
4// #include <algorithm>
5
6#include "chrome/browser/ui/webui/chromeos/login/login_ui_helpers.h"
7
8#include <algorithm>
9
10#include "base/values.h"
11#include "chrome/common/jstemplate_builder.h"
12#include "grit/browser_resources.h"
13#include "ui/base/resource/resource_bundle.h"
14
15namespace chromeos {
16
17// HTMLOperationsInterface, public:---------------------------------------------
18base::StringPiece HTMLOperationsInterface::GetLoginHTML() {
19  base::StringPiece login_html(
20      ResourceBundle::GetSharedInstance().GetRawDataResource(
21          IDR_LOGIN_HTML));
22  return login_html;
23}
24
25std::string HTMLOperationsInterface::GetFullHTML(
26    base::StringPiece login_html,
27    DictionaryValue* localized_strings) {
28  return jstemplate_builder::GetI18nTemplateHtml(
29      login_html,
30      localized_strings);
31}
32
33RefCountedBytes* HTMLOperationsInterface::CreateHTMLBytes(
34    std::string full_html) {
35  RefCountedBytes* html_bytes = new RefCountedBytes();
36  html_bytes->data.resize(full_html.size());
37  std::copy(full_html.begin(),
38            full_html.end(),
39            html_bytes->data.begin());
40  return html_bytes;
41}
42
43}  // namespace chromeos
44