color_internals_ui.cc 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright 2022 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 "ash/webui/color_internals/color_internals_ui.h"
  5. #include "ash/webui/color_internals/url_constants.h"
  6. #include "ash/webui/grit/ash_color_internals_resources.h"
  7. #include "ash/webui/grit/ash_color_internals_resources_map.h"
  8. #include "content/public/browser/web_contents.h"
  9. #include "content/public/browser/web_ui.h"
  10. #include "content/public/browser/web_ui_data_source.h"
  11. namespace ash {
  12. ColorInternalsUI::ColorInternalsUI(content::WebUI* web_ui)
  13. : ui::MojoWebUIController(web_ui) {
  14. content::WebUIDataSource* data_source =
  15. content::WebUIDataSource::CreateAndAdd(
  16. web_ui->GetWebContents()->GetBrowserContext(),
  17. kChromeUIColorInternalsHost);
  18. data_source->AddResourcePath("", IDR_ASH_COLOR_INTERNALS_INDEX_HTML);
  19. data_source->AddResourcePath(
  20. "color_internals_tokens.json",
  21. IDR_WEBUI_UI_CHROMEOS_STYLES_COLOR_INTERNALS_TOKENS_JSON);
  22. data_source->AddResourcePaths(base::make_span(
  23. kAshColorInternalsResources, kAshColorInternalsResourcesSize));
  24. }
  25. ColorInternalsUI::~ColorInternalsUI() = default;
  26. WEB_UI_CONTROLLER_TYPE_IMPL(ColorInternalsUI)
  27. } // namespace ash