metafile_agent.cc 578 B

123456789101112131415161718192021222324252627282930
  1. // Copyright 2021 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 "printing/metafile_agent.h"
  5. #include <string>
  6. #include "base/no_destructor.h"
  7. namespace printing {
  8. namespace {
  9. std::string& GetAgentImpl() {
  10. static base::NoDestructor<std::string> instance;
  11. return *instance;
  12. }
  13. } // namespace
  14. void SetAgent(const std::string& user_agent) {
  15. GetAgentImpl() = user_agent;
  16. }
  17. const std::string& GetAgent() {
  18. return GetAgentImpl();
  19. }
  20. } // namespace printing