| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // when g_one_utility_thread_lock from in_process_utility_thread.cc gets | 75 // when g_one_utility_thread_lock from in_process_utility_thread.cc gets |
| 76 // released in an acquired state which is crash condition in debug builds. | 76 // released in an acquired state which is crash condition in debug builds. |
| 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 scoped_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 void OnIconRead(scoped_ptr<ArcAppIcon::ReadResult> read_result); | 88 void OnIconRead(std::unique_ptr<ArcAppIcon::ReadResult> read_result); |
| 89 void Update(const gfx::ImageSkia* image); | 89 void Update(const gfx::ImageSkia* image); |
| 90 void DiscardDecodeRequest(DecodeRequest* request); | 90 void DiscardDecodeRequest(DecodeRequest* request); |
| 91 | 91 |
| 92 content::BrowserContext* context_; | 92 content::BrowserContext* context_; |
| 93 std::string app_id_; | 93 std::string app_id_; |
| 94 const int resource_size_in_dip_; | 94 const int resource_size_in_dip_; |
| 95 Observer* observer_; | 95 Observer* observer_; |
| 96 | 96 |
| 97 Source* source_ = nullptr; // Owned by ImageSkia storage. | 97 Source* source_ = nullptr; // Owned by ImageSkia storage. |
| 98 gfx::ImageSkia image_skia_; | 98 gfx::ImageSkia image_skia_; |
| 99 | 99 |
| 100 // The image wrapper around |image_skia_|. | 100 // The image wrapper around |image_skia_|. |
| 101 // Note: this is reset each time a new representation is loaded. | 101 // Note: this is reset each time a new representation is loaded. |
| 102 gfx::Image image_; | 102 gfx::Image image_; |
| 103 | 103 |
| 104 // Contains pending image decode requests. | 104 // Contains pending image decode requests. |
| 105 ScopedVector<DecodeRequest> decode_requests_; | 105 ScopedVector<DecodeRequest> decode_requests_; |
| 106 | 106 |
| 107 base::WeakPtrFactory<ArcAppIcon> weak_ptr_factory_; | 107 base::WeakPtrFactory<ArcAppIcon> weak_ptr_factory_; |
| 108 | 108 |
| 109 DISALLOW_COPY_AND_ASSIGN(ArcAppIcon); | 109 DISALLOW_COPY_AND_ASSIGN(ArcAppIcon); |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 #endif // CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_ICON_H_ | 112 #endif // CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_ICON_H_ |
| OLD | NEW |