Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: chrome/browser/ui/webui/options2/chromeos/wallpaper_source.h

Issue 10824006: Revert 148272 - Refactor the wallpaper encoding to another file/class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_WEBUI_OPTIONS2_CHROMEOS_WALLPAPER_SOURCE_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_WALLPAPER_SOURCE_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_WALLPAPER_SOURCE_H_ 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_WALLPAPER_SOURCE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/ref_counted_memory.h" 11 #include "base/memory/ref_counted_memory.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 13 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
14 #include "third_party/skia/include/core/SkBitmap.h" 14 #include "third_party/skia/include/core/SkBitmap.h"
15 15
16 namespace chromeos { 16 namespace chromeos {
17
18 class SimplePngEncoder;
19
20 namespace options2 { 17 namespace options2 {
21 18
22 // A DataSource for chrome://wallpaper/ URL, provides current user's wallpaper. 19 // A DataSource for chrome://wallpaper/ URL, provides current user's wallpaper.
23 class WallpaperImageSource : public ChromeURLDataManager::DataSource { 20 class WallpaperImageSource : public ChromeURLDataManager::DataSource {
24 public: 21 public:
25 WallpaperImageSource(); 22 WallpaperImageSource();
26 23
27 // ChromeURLDataManager::DataSource implementation. 24 // ChromeURLDataManager::DataSource implementation.
28 virtual void StartDataRequest(const std::string& path, 25 virtual void StartDataRequest(const std::string& path,
29 bool is_incognito, 26 bool is_incognito,
30 int request_id) OVERRIDE; 27 int request_id) OVERRIDE;
31 virtual std::string GetMimeType(const std::string&) const OVERRIDE; 28 virtual std::string GetMimeType(const std::string&) const OVERRIDE;
32 29
33 private: 30 private:
34 class WallpaperEncodingOperation; 31 class WallpaperEncodingOperation;
35 32
36 virtual ~WallpaperImageSource(); 33 virtual ~WallpaperImageSource();
37 34
38 // Get wallpaper for request identified by |request_id| in UI thread 35 // Get wallpaper for request identified by |request_id| in UI thread
39 // and pass it to encoding phase. 36 // and pass it to encoding phase.
40 void GetCurrentUserWallpaper(int request_id); 37 void GetCurrentUserWallpaper(int request_id);
41 38
42 // Callback is called when image is obtained from UI thread to 39 // Callback is called when image is obtained from UI thread to
43 // encode and send reply to request identified by |request_id|. 40 // encode and send reply to request identified by |request_id|.
44 void ImageAcquired(SkBitmap image, int request_id); 41 void ImageAcquired(SkBitmap image, int request_id);
45 42
46 // Cancel current image encoding operation. 43 // Cancel current image encoding operation.
47 void CancelPendingEncodingOperation(); 44 void CancelPendingEncodingOperation();
48 45
49 // Callback to call if we cancel the wallpaper encode operation. 46 // Send image stored in |data| as a reply to request
50 void CancelCallback(int request_id);
51
52 // Send image stored in |data| as a reply to request
53 // identifed by |request_id|. 47 // identifed by |request_id|.
54 void SendCurrentUserWallpaper(int request_id, 48 void SendCurrentUserWallpaper(int request_id,
55 scoped_refptr<base::RefCountedBytes> data); 49 scoped_refptr<base::RefCountedBytes> data);
56 50
57 scoped_refptr<SimplePngEncoder> png_encoder_; 51 scoped_refptr<WallpaperEncodingOperation> wallpaper_encoding_op_;
58 52
59 base::WeakPtrFactory<WallpaperImageSource> weak_ptr_factory_; 53 base::WeakPtrFactory<WallpaperImageSource> weak_ptr_factory_;
60 54
61 DISALLOW_COPY_AND_ASSIGN(WallpaperImageSource); 55 DISALLOW_COPY_AND_ASSIGN(WallpaperImageSource);
62 }; 56 };
63 57
64 } // namespace options2 58 } // namespace options2
65 } // namespace chromeos 59 } // namespace chromeos
66 60
67 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_WALLPAPER_SOURCE_H_ 61 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_WALLPAPER_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698