| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_WALLPAPER_WALLPAPER_RESIZER_H_ | 5 #ifndef COMPONENTS_WALLPAPER_WALLPAPER_RESIZER_H_ |
| 6 #define COMPONENTS_WALLPAPER_WALLPAPER_RESIZER_H_ | 6 #define COMPONENTS_WALLPAPER_WALLPAPER_RESIZER_H_ |
| 7 | 7 |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
| 10 #include "components/wallpaper/wallpaper_layout.h" | 10 #include "components/wallpaper/wallpaper_layout.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 // Add/Remove observers. | 50 // Add/Remove observers. |
| 51 void AddObserver(WallpaperResizerObserver* observer); | 51 void AddObserver(WallpaperResizerObserver* observer); |
| 52 void RemoveObserver(WallpaperResizerObserver* observer); | 52 void RemoveObserver(WallpaperResizerObserver* observer); |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 // Copies |resized_bitmap| to |image_| and notifies observers after Resize() | 55 // Copies |resized_bitmap| to |image_| and notifies observers after Resize() |
| 56 // has finished running. | 56 // has finished running. |
| 57 void OnResizeFinished(SkBitmap* resized_bitmap); | 57 void OnResizeFinished(SkBitmap* resized_bitmap); |
| 58 | 58 |
| 59 ObserverList<WallpaperResizerObserver> observers_; | 59 base::ObserverList<WallpaperResizerObserver> observers_; |
| 60 | 60 |
| 61 // Image that should currently be used for wallpaper. It initially | 61 // Image that should currently be used for wallpaper. It initially |
| 62 // contains the original image and is updated to contain the resized | 62 // contains the original image and is updated to contain the resized |
| 63 // image by OnResizeFinished(). | 63 // image by OnResizeFinished(). |
| 64 gfx::ImageSkia image_; | 64 gfx::ImageSkia image_; |
| 65 | 65 |
| 66 // Unique identifier corresponding to the original (i.e. pre-resize) |image_|. | 66 // Unique identifier corresponding to the original (i.e. pre-resize) |image_|. |
| 67 uint32_t original_image_id_; | 67 uint32_t original_image_id_; |
| 68 | 68 |
| 69 gfx::Size target_size_; | 69 gfx::Size target_size_; |
| 70 | 70 |
| 71 WallpaperLayout layout_; | 71 WallpaperLayout layout_; |
| 72 | 72 |
| 73 base::SequencedWorkerPool* worker_pool_; | 73 base::SequencedWorkerPool* worker_pool_; |
| 74 | 74 |
| 75 base::WeakPtrFactory<WallpaperResizer> weak_ptr_factory_; | 75 base::WeakPtrFactory<WallpaperResizer> weak_ptr_factory_; |
| 76 | 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(WallpaperResizer); | 77 DISALLOW_COPY_AND_ASSIGN(WallpaperResizer); |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 } // namespace wallpaper | 80 } // namespace wallpaper |
| 81 | 81 |
| 82 #endif // COMPONENTS_WALLPAPER_WALLPAPER_RESIZER_H_ | 82 #endif // COMPONENTS_WALLPAPER_WALLPAPER_RESIZER_H_ |
| OLD | NEW |