1 // Copyright 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 STORAGE_COMMON_DATABASE_DATABASE_IDENTIFIER_H_
6 #define STORAGE_COMMON_DATABASE_DATABASE_IDENTIFIER_H_
10 #include "base/basictypes.h"
11 #include "base/strings/string_piece.h"
12 #include "storage/common/storage_common_export.h"
17 STORAGE_COMMON_EXPORT
std::string
GetIdentifierFromOrigin(
19 STORAGE_COMMON_EXPORT GURL
GetOriginFromIdentifier(
20 const std::string
& identifier
);
22 class STORAGE_COMMON_EXPORT DatabaseIdentifier
{
24 static const DatabaseIdentifier
UniqueFileIdentifier();
25 static DatabaseIdentifier
CreateFromOrigin(const GURL
& origin
);
26 static DatabaseIdentifier
Parse(const std::string
& identifier
);
27 ~DatabaseIdentifier();
29 std::string
ToString() const;
30 GURL
ToOrigin() const;
32 std::string
scheme() const { return scheme_
; }
33 std::string
hostname() const { return hostname_
; }
34 int port() const { return port_
; }
35 bool is_unique() const { return is_unique_
; }
39 DatabaseIdentifier(const std::string
& scheme
,
40 const std::string
& hostname
,
46 std::string hostname_
;
52 } // namespace storage
54 #endif // STORAGE_COMMON_DATABASE_DATABASE_IDENTIFIER_H_