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

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

Issue 10837331: Options: s/options2/options/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: wut 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_WALLPAPER_THUMBNAIL_SOURCE_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_WALLPAPER_THUMBNAIL_SOURCE_H_
7
8 #include <string>
9
10 #include "base/compiler_specific.h"
11 #include "base/memory/weak_ptr.h"
12 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
13 #include "ui/base/layout.h"
14
15 namespace base {
16 class RefCountedBytes;
17 }
18
19 namespace chromeos {
20
21 class User;
22
23 namespace options {
24
25 // Returns a string consisting of the prefix specified and the index of the
26 // image. For example: chrome://wallpaper/default_2.
27 std::string GetDefaultWallpaperThumbnailURL(int index);
28
29 // Checks if the given URL points to one of the default wallpapers. If it is,
30 // returns true and sets |wallpaper_index| to the corresponding index parsed
31 // from |url|. For example: chrome://wallpaper/default_2 will set
32 // |wallpaper_index| to 2. If not a default wallpaper url, returns false.
33 // |url| and |wallpaper_index| must not be NULL.
34 bool IsDefaultWallpaperURL(const std::string url, int* wallpaper_index);
35
36 // A DataSource for chrome://wallpaper/ URLs.
37 class WallpaperThumbnailSource : public ChromeURLDataManager::DataSource {
38 public:
39 WallpaperThumbnailSource();
40
41 virtual std::string GetMimeType(const std::string&) const OVERRIDE;
42
43 // ChromeURLDataManager::DataSource implementation.
44 virtual void StartDataRequest(const std::string& path,
45 bool is_incognito,
46 int request_id) OVERRIDE;
47
48 private:
49 class ThumbnailEncodingOperation;
50
51 virtual ~WallpaperThumbnailSource();
52
53 void GetCurrentUserThumbnail(const std::string& path,
54 ui::ScaleFactor scale_factor,
55 int request_id);
56
57 void StartCustomThumbnailEncodingOperation(const chromeos::User* user,
58 ui::ScaleFactor scale_factor,
59 int request_id);
60
61 void CancelPendingCustomThumbnailEncodingOperation();
62
63 void SendCurrentUserNullThumbnail(int request_id);
64
65 void SendCurrentUserCustomThumbnail(
66 scoped_refptr<base::RefCountedBytes> data,
67 int request_id);
68
69 void SendCurrentUserDefaultThumbnail(const std::string& path,
70 ui::ScaleFactor scale_factor,
71 int request_id);
72
73 scoped_refptr<ThumbnailEncodingOperation> thumbnail_encoding_op_;
74
75 base::WeakPtrFactory<WallpaperThumbnailSource> weak_ptr_factory_;
76
77 DISALLOW_COPY_AND_ASSIGN(WallpaperThumbnailSource);
78 };
79
80 } // namespace options
81 } // namespace chromeos
82
83 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_WALLPAPER_THUMBNAIL_SOURCE_ H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698