| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 static void DisableSafeDecodingForTesting(); | 77 static void DisableSafeDecodingForTesting(); |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 class Source; | 80 class Source; |
| 81 class DecodeRequest; | 81 class DecodeRequest; |
| 82 struct ReadResult; | 82 struct ReadResult; |
| 83 | 83 |
| 84 void RequestIcon(ui::ScaleFactor scale_factor); | 84 void RequestIcon(ui::ScaleFactor scale_factor); |
| 85 static std::unique_ptr<ArcAppIcon::ReadResult> ReadOnFileThread( | 85 static std::unique_ptr<ArcAppIcon::ReadResult> ReadOnFileThread( |
| 86 ui::ScaleFactor scale_factor, | 86 ui::ScaleFactor scale_factor, |
| 87 const base::FilePath& path); | 87 const base::FilePath& path, |
| 88 const base::FilePath& default_app_path); |
| 88 void OnIconRead(std::unique_ptr<ArcAppIcon::ReadResult> read_result); | 89 void OnIconRead(std::unique_ptr<ArcAppIcon::ReadResult> read_result); |
| 89 void Update(const gfx::ImageSkia* image); | 90 void Update(const gfx::ImageSkia* image); |
| 90 void DiscardDecodeRequest(DecodeRequest* request); | 91 void DiscardDecodeRequest(DecodeRequest* request); |
| 91 | 92 |
| 92 content::BrowserContext* context_; | 93 content::BrowserContext* context_; |
| 93 std::string app_id_; | 94 std::string app_id_; |
| 94 const int resource_size_in_dip_; | 95 const int resource_size_in_dip_; |
| 95 Observer* observer_; | 96 Observer* observer_; |
| 96 | 97 |
| 97 Source* source_ = nullptr; // Owned by ImageSkia storage. | 98 Source* source_ = nullptr; // Owned by ImageSkia storage. |
| 98 gfx::ImageSkia image_skia_; | 99 gfx::ImageSkia image_skia_; |
| 99 | 100 |
| 100 // The image wrapper around |image_skia_|. | 101 // The image wrapper around |image_skia_|. |
| 101 // Note: this is reset each time a new representation is loaded. | 102 // Note: this is reset each time a new representation is loaded. |
| 102 gfx::Image image_; | 103 gfx::Image image_; |
| 103 | 104 |
| 104 // Contains pending image decode requests. | 105 // Contains pending image decode requests. |
| 105 ScopedVector<DecodeRequest> decode_requests_; | 106 ScopedVector<DecodeRequest> decode_requests_; |
| 106 | 107 |
| 107 base::WeakPtrFactory<ArcAppIcon> weak_ptr_factory_; | 108 base::WeakPtrFactory<ArcAppIcon> weak_ptr_factory_; |
| 108 | 109 |
| 109 DISALLOW_COPY_AND_ASSIGN(ArcAppIcon); | 110 DISALLOW_COPY_AND_ASSIGN(ArcAppIcon); |
| 110 }; | 111 }; |
| 111 | 112 |
| 112 #endif // CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_ICON_H_ | 113 #endif // CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_ICON_H_ |
| OLD | NEW |