google_logo_api.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright 2014 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. #ifndef COMPONENTS_SEARCH_PROVIDER_LOGOS_GOOGLE_LOGO_API_H_
  5. #define COMPONENTS_SEARCH_PROVIDER_LOGOS_GOOGLE_LOGO_API_H_
  6. #include <memory>
  7. #include <string>
  8. #include "base/time/time.h"
  9. #include "components/search_provider_logos/logo_common.h"
  10. #include "url/gurl.h"
  11. namespace search_provider_logos {
  12. // Returns the URL where the Google doodle can be downloaded, e.g.
  13. // https://www.google.com/async/ddljson. This depends on the user's
  14. // Google domain.
  15. GURL GetGoogleDoodleURL(const GURL& google_base_url);
  16. // Implements AppendQueryparamsToLogoURL, defined in logo_common.h. Using this
  17. // relies on the caller having prepared the |logo_url| by calling
  18. // AppendPreliminaryParamsToDoodleURL().
  19. GURL AppendFingerprintParamToDoodleURL(const GURL& logo_url,
  20. const std::string& fingerprint);
  21. // Builds the reference URL for the current requested Doodle preset. This URL
  22. // will have to be processed again to add the fingerprint before making the
  23. // request to the server, see AppendFingerprintParamToDoodleURL().
  24. GURL AppendPreliminaryParamsToDoodleURL(bool gray_background,
  25. bool for_webui_ntp,
  26. const GURL& logo_url);
  27. // Implements ParseLogoResponse, defined in logo_common.h, for Google or
  28. // third-party doodles.
  29. std::unique_ptr<EncodedLogo> ParseDoodleLogoResponse(
  30. const GURL& base_url,
  31. std::unique_ptr<std::string> response,
  32. base::Time response_time,
  33. bool* parsing_failed);
  34. } // namespace search_provider_logos
  35. #endif // COMPONENTS_SEARCH_PROVIDER_LOGOS_GOOGLE_LOGO_API_H_