auto_login_parser.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright (c) 2013 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 ANDROID_WEBVIEW_BROWSER_RENDERER_HOST_AUTO_LOGIN_PARSER_H_
  5. #define ANDROID_WEBVIEW_BROWSER_RENDERER_HOST_AUTO_LOGIN_PARSER_H_
  6. #include <string>
  7. namespace android_webview {
  8. enum RealmRestriction {
  9. ONLY_GOOGLE_COM,
  10. ALLOW_ANY_REALM
  11. };
  12. struct HeaderData {
  13. HeaderData();
  14. ~HeaderData();
  15. // "realm" string from x-auto-login (e.g. "com.google").
  16. std::string realm;
  17. // "account" string from x-auto-login.
  18. std::string account;
  19. // "args" string from x-auto-login to be passed to MergeSession. This string
  20. // should be considered opaque and not be cracked open to look inside.
  21. std::string args;
  22. };
  23. // Returns whether parsing succeeded. Parameter |header_data| will not be
  24. // modified if parsing fails.
  25. bool ParseHeader(const std::string& header,
  26. RealmRestriction realm_restriction,
  27. HeaderData* header_data);
  28. } // namespace android_webview
  29. #endif // ANDROID_WEBVIEW_BROWSER_RENDERER_HOST_AUTO_LOGIN_PARSER_H_