x_callback_url.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright 2016 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 IOS_CHROME_COMMON_X_CALLBACK_URL_H_
  5. #define IOS_CHROME_COMMON_X_CALLBACK_URL_H_
  6. #include <map>
  7. #include <string>
  8. #include "base/strings/string_piece.h"
  9. #include "url/gurl.h"
  10. // Returns true if |url| is compliant with the x-callback-url specs.
  11. bool IsXCallbackURL(const GURL& url);
  12. // Returns a GURL compliant with the x-callback-url specs (simple version with
  13. // no parameters set, see XCallbackURLWithParameters for constructing complex
  14. // URLs).
  15. GURL CreateXCallbackURL(base::StringPiece scheme, base::StringPiece action);
  16. // Returns a GURL compliant with the x-callback-url specs.
  17. // See http://x-callback-url.com/specifications/ for specifications.
  18. // |scheme| must not be empty, all other parameters may be.
  19. GURL CreateXCallbackURLWithParameters(
  20. base::StringPiece scheme,
  21. base::StringPiece action,
  22. const GURL& success_url,
  23. const GURL& error_url,
  24. const GURL& cancel_url,
  25. const std::map<std::string, std::string>& parameters);
  26. // Extract query parameters from an x-callback-url URL. |x_callback_url| must
  27. // be compliant with the x-callback-url specs.
  28. std::map<std::string, std::string> ExtractQueryParametersFromXCallbackURL(
  29. const GURL& x_callback_url);
  30. #endif // IOS_CHROME_COMMON_X_CALLBACK_URL_H_