OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_SEARCH_PROVIDER_LOGOS_LOGO_COMMON_H_ | 5 #ifndef COMPONENTS_SEARCH_PROVIDER_LOGOS_LOGO_COMMON_H_ |
6 #define COMPONENTS_SEARCH_PROVIDER_LOGOS_LOGO_COMMON_H_ | 6 #define COMPONENTS_SEARCH_PROVIDER_LOGOS_LOGO_COMMON_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/ref_counted_memory.h" | 13 #include "base/memory/ref_counted_memory.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "third_party/skia/include/core/SkBitmap.h" | 15 #include "third_party/skia/include/core/SkBitmap.h" |
16 | 16 |
17 namespace search_provider_logos { | 17 namespace search_provider_logos { |
18 | 18 |
19 // The maximum number of milliseconds that a logo can be cached. | 19 // The maximum number of milliseconds that a logo can be cached. |
20 extern const int64_t kMaxTimeToLiveMS; | 20 extern const int64_t kMaxTimeToLiveMS; |
21 | 21 |
22 struct LogoMetadata { | 22 struct LogoMetadata { |
23 LogoMetadata(); | 23 LogoMetadata(); |
| 24 LogoMetadata(const LogoMetadata& other); |
24 ~LogoMetadata(); | 25 ~LogoMetadata(); |
25 | 26 |
26 // For use by the client ---------------------------------------------------- | 27 // For use by the client ---------------------------------------------------- |
27 | 28 |
28 // The URL to load when the logo is clicked. | 29 // The URL to load when the logo is clicked. |
29 std::string on_click_url; | 30 std::string on_click_url; |
30 // The accessibility text for the logo. | 31 // The accessibility text for the logo. |
31 std::string alt_text; | 32 std::string alt_text; |
32 // The mime type of the logo image. | 33 // The mime type of the logo image. |
33 std::string mime_type; | 34 std::string mime_type; |
(...skipping 12 matching lines...) Expand all Loading... |
46 // Whether the logo can be shown optimistically after it's expired while a | 47 // Whether the logo can be shown optimistically after it's expired while a |
47 // fresh logo is being downloaded. | 48 // fresh logo is being downloaded. |
48 bool can_show_after_expiration; | 49 bool can_show_after_expiration; |
49 // When the logo expires. After this time, the logo will not be used and will | 50 // When the logo expires. After this time, the logo will not be used and will |
50 // be deleted. | 51 // be deleted. |
51 base::Time expiration_time; | 52 base::Time expiration_time; |
52 }; | 53 }; |
53 | 54 |
54 struct EncodedLogo { | 55 struct EncodedLogo { |
55 EncodedLogo(); | 56 EncodedLogo(); |
| 57 EncodedLogo(const EncodedLogo& other); |
56 ~EncodedLogo(); | 58 ~EncodedLogo(); |
57 | 59 |
58 // The jpeg- or png-encoded image. | 60 // The jpeg- or png-encoded image. |
59 scoped_refptr<base::RefCountedString> encoded_image; | 61 scoped_refptr<base::RefCountedString> encoded_image; |
60 // Metadata about the logo. | 62 // Metadata about the logo. |
61 LogoMetadata metadata; | 63 LogoMetadata metadata; |
62 }; | 64 }; |
63 | 65 |
64 struct Logo { | 66 struct Logo { |
65 Logo(); | 67 Logo(); |
66 ~Logo(); | 68 ~Logo(); |
67 | 69 |
68 // The logo image. | 70 // The logo image. |
69 SkBitmap image; | 71 SkBitmap image; |
70 // Metadata about the logo. | 72 // Metadata about the logo. |
71 LogoMetadata metadata; | 73 LogoMetadata metadata; |
72 }; | 74 }; |
73 | 75 |
74 } // namespace search_provider_logos | 76 } // namespace search_provider_logos |
75 | 77 |
76 #endif // COMPONENTS_SEARCH_PROVIDER_LOGOS_LOGO_COMMON_H_ | 78 #endif // COMPONENTS_SEARCH_PROVIDER_LOGOS_LOGO_COMMON_H_ |
OLD | NEW |