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

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: 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"
12 #include "content/public/browser/notification_registrar.h"
10 #include "ui/gfx/native_widget_types.h" 13 #include "ui/gfx/native_widget_types.h"
11 14
12 namespace base { 15 namespace base {
13 class DictionaryValue; 16 class DictionaryValue;
14 class ListValue; 17 class ListValue;
15 } 18 }
16 19
17 namespace chromeos { 20 namespace chromeos {
18 namespace options2 { 21 namespace options2 {
19 22
20 // ChromeOS user image options page UI handler. 23 // ChromeOS user image options page UI handler.
21 class SetWallpaperOptionsHandler : public ::options2::OptionsPageUIHandler{ 24 class SetWallpaperOptionsHandler : public ::options2::OptionsPageUIHandler,
25 public SelectFileDialog::Listener {
22 public: 26 public:
23 SetWallpaperOptionsHandler(); 27 SetWallpaperOptionsHandler();
24 virtual ~SetWallpaperOptionsHandler(); 28 virtual ~SetWallpaperOptionsHandler();
25 29
26 // OptionsPageUIHandler implementation. 30 // OptionsPageUIHandler implementation.
27 virtual void GetLocalizedValues( 31 virtual void GetLocalizedValues(
28 base::DictionaryValue* localized_strings) OVERRIDE; 32 base::DictionaryValue* localized_strings) OVERRIDE;
29 33
30 // WebUIMessageHandler implementation. 34 // WebUIMessageHandler implementation.
31 virtual void RegisterMessages() OVERRIDE; 35 virtual void RegisterMessages() OVERRIDE;
32 36
33 private: 37 private:
34 // Sends list of available default images to the page. 38 // Sends list of available default images to the page.
35 void SendDefaultImages(); 39 void SendDefaultImages();
36 40
41 // Sends layout options for custome wallpaper. Only exposed CENTER,
flackr 2012/05/04 19:06:17 s/custome/custom
bshe 2012/05/08 22:22:18 Done.
42 // CENTER_CROPPED, STRETCH to users. Set the selected option to specified
43 // |layout|.
44 void SendLayoutOptions(ash::WallpaperLayout layout);
45
37 // Handles page initialized event. 46 // Handles page initialized event.
38 void HandlePageInitialized(const base::ListValue* args); 47 void HandlePageInitialized(const base::ListValue* args);
39 48
40 // Handles page shown event. 49 // Handles page shown event.
41 void HandlePageShown(const base::ListValue* args); 50 void HandlePageShown(const base::ListValue* args);
42 51
52 // Opens a file selection dialog to choose user image from file.
53 void HandleChooseFile(const base::ListValue* args);
54
55 // SelectFileDialog::Delegate implementation.
56 virtual void FileSelected(
57 const FilePath& path,
58 int index, void* params) OVERRIDE;
59
60 // Redraw the wallpaper with specified wallpaper layout.
61 void HandleLayoutChanged(const base::ListValue* args);
62
43 // Selects one of the available default wallpapers. 63 // Selects one of the available default wallpapers.
44 void HandleDefaultWallpaper(const base::ListValue* args); 64 void HandleDefaultWallpaper(const base::ListValue* args);
45 65
46 // Sets user wallpaper to a random one from the default wallpapers. 66 // Sets user wallpaper to a random one from the default wallpapers.
47 void HandleRandomWallpaper(const base::ListValue* args); 67 void HandleRandomWallpaper(const base::ListValue* args);
48 68
69 // Call javascript function to add/update custom wallpaper thumbnail in
70 // picker UI.
71 void SetCustomWallpaperThumb();
James Hawkins 2012/05/06 15:49:50 'Thumb' is not an appropriate abbreviation for 'th
bshe 2012/05/08 22:22:18 Done.
72
73 // content::NotificationObserver implementation.
74 virtual void Observe(int type,
75 const content::NotificationSource& source,
76 const content::NotificationDetails& details) OVERRIDE;
77
49 // Returns handle to browser window or NULL if it can't be found. 78 // Returns handle to browser window or NULL if it can't be found.
50 gfx::NativeWindow GetBrowserWindow() const; 79 gfx::NativeWindow GetBrowserWindow() const;
51 80
81 scoped_refptr<SelectFileDialog> select_file_dialog_;
flackr 2012/05/04 19:06:17 Comment.
bshe 2012/05/08 22:22:18 Done.
82
83 content::NotificationRegistrar registrar_;
84
52 base::WeakPtrFactory<SetWallpaperOptionsHandler> weak_factory_; 85 base::WeakPtrFactory<SetWallpaperOptionsHandler> weak_factory_;
53 86
54 DISALLOW_COPY_AND_ASSIGN(SetWallpaperOptionsHandler); 87 DISALLOW_COPY_AND_ASSIGN(SetWallpaperOptionsHandler);
55 }; 88 };
56 89
57 } // namespace options2 90 } // namespace options2
58 } // namespace chromeos 91 } // namespace chromeos
59 92
60 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_SET_WALLPAPER_OPTIONS_HANDL ER2_H_ 93 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_SET_WALLPAPER_OPTIONS_HANDL ER2_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698