OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_ICON_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_ICON_H_ |
6 #define CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_ICON_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_ICON_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // processing yet by the time when a test exits. This might cause situation | 75 // processing yet by the time when a test exits. This might cause situation |
76 // when g_one_utility_thread_lock from in_process_utility_thread.cc gets | 76 // when g_one_utility_thread_lock from in_process_utility_thread.cc gets |
77 // released in an acquired state which is crash condition in debug builds. | 77 // released in an acquired state which is crash condition in debug builds. |
78 static void DisableSafeDecodingForTesting(); | 78 static void DisableSafeDecodingForTesting(); |
79 | 79 |
80 private: | 80 private: |
81 class Source; | 81 class Source; |
82 class DecodeRequest; | 82 class DecodeRequest; |
83 struct ReadResult; | 83 struct ReadResult; |
84 | 84 |
85 void RequestIcon(ui::ScaleFactor scale_factor); | 85 void MaybeRequestIcon(ui::ScaleFactor scale_factor); |
86 static std::unique_ptr<ArcAppIcon::ReadResult> ReadOnFileThread( | 86 static std::unique_ptr<ArcAppIcon::ReadResult> ReadOnFileThread( |
87 ui::ScaleFactor scale_factor, | 87 ui::ScaleFactor scale_factor, |
88 const base::FilePath& path, | 88 const base::FilePath& path, |
89 const base::FilePath& default_app_path); | 89 const base::FilePath& default_app_path); |
90 void OnIconRead(std::unique_ptr<ArcAppIcon::ReadResult> read_result); | 90 void OnIconRead(std::unique_ptr<ArcAppIcon::ReadResult> read_result); |
91 void Update(const gfx::ImageSkia* image); | 91 void Update(const gfx::ImageSkia* image); |
92 void DiscardDecodeRequest(DecodeRequest* request); | 92 void DiscardDecodeRequest(DecodeRequest* request); |
93 | 93 |
94 content::BrowserContext* context_; | 94 content::BrowserContext* context_; |
95 std::string app_id_; | 95 std::string app_id_; |
96 const int resource_size_in_dip_; | 96 const int resource_size_in_dip_; |
97 Observer* observer_; | 97 Observer* observer_; |
98 | 98 |
99 Source* source_ = nullptr; // Owned by ImageSkia storage. | 99 Source* source_ = nullptr; // Owned by ImageSkia storage. |
100 gfx::ImageSkia image_skia_; | 100 gfx::ImageSkia image_skia_; |
101 | 101 |
102 // The image wrapper around |image_skia_|. | 102 // The image wrapper around |image_skia_|. |
103 // Note: this is reset each time a new representation is loaded. | 103 // Note: this is reset each time a new representation is loaded. |
104 gfx::Image image_; | 104 gfx::Image image_; |
105 | 105 |
106 // Contains pending image decode requests. | 106 // Contains pending image decode requests. |
107 std::vector<std::unique_ptr<DecodeRequest>> decode_requests_; | 107 std::vector<std::unique_ptr<DecodeRequest>> decode_requests_; |
108 | 108 |
109 base::WeakPtrFactory<ArcAppIcon> weak_ptr_factory_; | 109 base::WeakPtrFactory<ArcAppIcon> weak_ptr_factory_; |
110 | 110 |
111 DISALLOW_COPY_AND_ASSIGN(ArcAppIcon); | 111 DISALLOW_COPY_AND_ASSIGN(ArcAppIcon); |
112 }; | 112 }; |
113 | 113 |
114 #endif // CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_ICON_H_ | 114 #endif // CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_ICON_H_ |
OLD | NEW |