WebSocket header continuations test case.
[chromium-blink-merge.git] / components / search_provider_logos / logo_common.h
blob207026b5ffe89cc4173c62d0cdb343cb3b50f7ad
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.
5 #ifndef COMPONENTS_SEARCH_PROVIDER_LOGOS_LOGO_COMMON_H_
6 #define COMPONENTS_SEARCH_PROVIDER_LOGOS_LOGO_COMMON_H_
8 #include <string>
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/ref_counted_memory.h"
12 #include "base/time/time.h"
13 #include "third_party/skia/include/core/SkBitmap.h"
15 namespace search_provider_logos {
17 // The maximum number of milliseconds that a logo can be cached.
18 extern const int64 kMaxTimeToLiveMS;
20 struct LogoMetadata {
21 LogoMetadata();
22 ~LogoMetadata();
24 // For use by the client ----------------------------------------------------
26 // The URL to load when the logo is clicked.
27 std::string on_click_url;
28 // The accessibility text for the logo.
29 std::string alt_text;
30 // The mime type of the logo image.
31 std::string mime_type;
33 // For use by LogoTracker ---------------------------------------------------
35 // The URL from which the logo was downloaded (without the fingerprint param).
36 std::string source_url;
37 // A fingerprint (i.e. hash) identifying the logo. Used when revalidating the
38 // logo with the server.
39 std::string fingerprint;
40 // Whether the logo can be shown optimistically after it's expired while a
41 // fresh logo is being downloaded.
42 bool can_show_after_expiration;
43 // When the logo expires. After this time, the logo will not be used and will
44 // be deleted.
45 base::Time expiration_time;
48 struct EncodedLogo {
49 EncodedLogo();
50 ~EncodedLogo();
52 // The jpeg- or png-encoded image.
53 scoped_refptr<base::RefCountedString> encoded_image;
54 // Metadata about the logo.
55 LogoMetadata metadata;
58 struct Logo {
59 Logo();
60 ~Logo();
62 // The logo image.
63 SkBitmap image;
64 // Metadata about the logo.
65 LogoMetadata metadata;
68 } // namespace search_provider_logos
70 #endif // COMPONENTS_SEARCH_PROVIDER_LOGOS_LOGO_COMMON_H_