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

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

Issue 10375010: Implement user selected wallpaper feature. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 8 years, 7 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_SET_WALLPAPER_OPTIONS_HANDLER2 _H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_SET_WALLPAPER_OPTIONS_HANDLER2 _H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_SET_WALLPAPER_OPTIONS_HANDLER2 _H_ 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_SET_WALLPAPER_OPTIONS_HANDLER2 _H_
7 7
8 #include "ash/desktop_background/desktop_background_resources.h"
8 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "chrome/browser/ui/select_file_dialog.h"
9 #include "chrome/browser/ui/webui/options2/options_ui2.h" 11 #include "chrome/browser/ui/webui/options2/options_ui2.h"
10 #include "ui/gfx/native_widget_types.h" 12 #include "ui/gfx/native_widget_types.h"
11 13
12 namespace base { 14 namespace base {
13 class DictionaryValue; 15 class DictionaryValue;
14 class ListValue; 16 class ListValue;
15 } 17 }
16 18
17 namespace chromeos { 19 namespace chromeos {
20
21 class WallpaperDelegate {
22 public:
23 // Call javascript function to add/update custom wallpaper thumbnail in
24 // picker UI.
25 virtual void SetCustomWallpaperThumbnail() = 0;
26
27 protected:
28 virtual ~WallpaperDelegate() {}
29 };
30
18 namespace options2 { 31 namespace options2 {
19 32
20 // ChromeOS user image options page UI handler. 33 // ChromeOS user image options page UI handler.
21 class SetWallpaperOptionsHandler : public ::options2::OptionsPageUIHandler{ 34 class SetWallpaperOptionsHandler : public ::options2::OptionsPageUIHandler,
35 public SelectFileDialog::Listener,
36 public WallpaperDelegate {
22 public: 37 public:
23 SetWallpaperOptionsHandler(); 38 SetWallpaperOptionsHandler();
24 virtual ~SetWallpaperOptionsHandler(); 39 virtual ~SetWallpaperOptionsHandler();
25 40
26 // OptionsPageUIHandler implementation. 41 // OptionsPageUIHandler implementation.
27 virtual void GetLocalizedValues( 42 virtual void GetLocalizedValues(
28 base::DictionaryValue* localized_strings) OVERRIDE; 43 base::DictionaryValue* localized_strings) OVERRIDE;
29 44
30 // WebUIMessageHandler implementation. 45 // WebUIMessageHandler implementation.
31 virtual void RegisterMessages() OVERRIDE; 46 virtual void RegisterMessages() OVERRIDE;
32 47
48 // WallpaperDelegate implementation.
49 virtual void SetCustomWallpaperThumbnail() OVERRIDE;
50
33 private: 51 private:
52 // SelectFileDialog::Delegate implementation.
53 virtual void FileSelected(const FilePath& path, int index,
54 void* params) OVERRIDE;
55
34 // Sends list of available default images to the page. 56 // Sends list of available default images to the page.
35 void SendDefaultImages(); 57 void SendDefaultImages();
36 58
59 // Sends layout options for custom wallpaper. Only exposes CENTER,
60 // CENTER_CROPPED, STRETCH to users. Set the selected option to specified
61 // |layout|.
62 void SendLayoutOptions(ash::WallpaperLayout layout);
63
37 // Handles page initialized event. 64 // Handles page initialized event.
38 void HandlePageInitialized(const base::ListValue* args); 65 void HandlePageInitialized(const base::ListValue* args);
39 66
40 // Handles page shown event. 67 // Handles page shown event.
41 void HandlePageShown(const base::ListValue* args); 68 void HandlePageShown(const base::ListValue* args);
42 69
70 // Opens a file selection dialog to choose user image from file.
71 void HandleChooseFile(const base::ListValue* args);
72
73 // Redraws the wallpaper with specified wallpaper layout.
74 void HandleLayoutChanged(const base::ListValue* args);
75
43 // Selects one of the available default wallpapers. 76 // Selects one of the available default wallpapers.
44 void HandleDefaultWallpaper(const base::ListValue* args); 77 void HandleDefaultWallpaper(const base::ListValue* args);
45 78
46 // Sets user wallpaper to a random one from the default wallpapers. 79 // Sets user wallpaper to a random one from the default wallpapers.
47 void HandleRandomWallpaper(const base::ListValue* args); 80 void HandleRandomWallpaper(const base::ListValue* args);
48 81
49 // Returns handle to browser window or NULL if it can't be found. 82 // Returns handle to browser window or NULL if it can't be found.
50 gfx::NativeWindow GetBrowserWindow() const; 83 gfx::NativeWindow GetBrowserWindow() const;
51 84
85 // Shows a dialog box for selecting a file.
86 scoped_refptr<SelectFileDialog> select_file_dialog_;
87
52 base::WeakPtrFactory<SetWallpaperOptionsHandler> weak_factory_; 88 base::WeakPtrFactory<SetWallpaperOptionsHandler> weak_factory_;
53 89
54 DISALLOW_COPY_AND_ASSIGN(SetWallpaperOptionsHandler); 90 DISALLOW_COPY_AND_ASSIGN(SetWallpaperOptionsHandler);
55 }; 91 };
56 92
57 } // namespace options2 93 } // namespace options2
58 } // namespace chromeos 94 } // namespace chromeos
59 95
60 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_SET_WALLPAPER_OPTIONS_HANDL ER2_H_ 96 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_SET_WALLPAPER_OPTIONS_HANDL ER2_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698