Add abhijeet.k@samsung.com to AUTHORS list.
[chromium-blink-merge.git] / components / auto_login_parser / auto_login_parser.h
blobbd2f28f999696c6780ed06099ba80b9a6fcc9736
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.
5 #ifndef COMPONENTS_AUTO_LOGIN_PARSER_AUTO_LOGIN_PARSER_H_
6 #define COMPONENTS_AUTO_LOGIN_PARSER_AUTO_LOGIN_PARSER_H_
8 #include <string>
10 namespace net {
11 class URLRequest;
14 namespace auto_login_parser {
16 enum RealmRestriction {
17 ONLY_GOOGLE_COM,
18 ALLOW_ANY_REALM
21 struct HeaderData {
22 HeaderData();
23 ~HeaderData();
25 // "realm" string from x-auto-login (e.g. "com.google").
26 std::string realm;
28 // "account" string from x-auto-login.
29 std::string account;
31 // "args" string from x-auto-login to be passed to MergeSession. This string
32 // should be considered opaque and not be cracked open to look inside.
33 std::string args;
36 // Returns whether parsing succeeded. Parameter |header_data| will not be
37 // modified if parsing fails.
38 bool ParseHeader(const std::string& header,
39 RealmRestriction realm_restriction,
40 HeaderData* header_data);
42 // Helper function that also retrieves the header from the response of the
43 // given URLRequest.
44 bool ParserHeaderInResponse(net::URLRequest* request,
45 RealmRestriction realm_restriction,
46 HeaderData* header_data);
48 } // namespace auto_login_parser
50 #endif // COMPONENTS_AUTO_LOGIN_PARSER_AUTO_LOGIN_PARSER_H_