Chromium Code Reviews| Index: chrome/browser/ui/webui/options2/chromeos/set_wallpaper_options_handler2.h |
| diff --git a/chrome/browser/ui/webui/options2/chromeos/set_wallpaper_options_handler2.h b/chrome/browser/ui/webui/options2/chromeos/set_wallpaper_options_handler2.h |
| index da162ed4f3b9abe82f0c8f60c9fdd221b61e6526..62e40656525674ca81a26a42831a3c4df1b7f3ad 100644 |
| --- a/chrome/browser/ui/webui/options2/chromeos/set_wallpaper_options_handler2.h |
| +++ b/chrome/browser/ui/webui/options2/chromeos/set_wallpaper_options_handler2.h |
| @@ -5,7 +5,9 @@ |
| #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_SET_WALLPAPER_OPTIONS_HANDLER2_H_ |
| #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_SET_WALLPAPER_OPTIONS_HANDLER2_H_ |
| +#include "ash/desktop_background/desktop_background_resources.h" |
| #include "base/memory/weak_ptr.h" |
| +#include "chrome/browser/ui/select_file_dialog.h" |
| #include "chrome/browser/ui/webui/options2/options_ui2.h" |
| #include "ui/gfx/native_widget_types.h" |
| @@ -15,10 +17,20 @@ class ListValue; |
| } |
| namespace chromeos { |
| + |
| +class WallpaperDelegate { |
| + public: |
| + // Call javascript function to add/update custom wallpaper thumbnail in |
| + // picker UI. |
| + virtual void SetCustomWallpaperThumbnail() = 0; |
|
James Hawkins
2012/05/11 18:13:23
nit: Add protected destructor.
|
| +}; |
| + |
| namespace options2 { |
| // ChromeOS user image options page UI handler. |
| -class SetWallpaperOptionsHandler : public ::options2::OptionsPageUIHandler{ |
| +class SetWallpaperOptionsHandler : public ::options2::OptionsPageUIHandler, |
| + public SelectFileDialog::Listener, |
| + public WallpaperDelegate { |
| public: |
| SetWallpaperOptionsHandler(); |
| virtual ~SetWallpaperOptionsHandler(); |
| @@ -30,16 +42,34 @@ class SetWallpaperOptionsHandler : public ::options2::OptionsPageUIHandler{ |
| // WebUIMessageHandler implementation. |
| virtual void RegisterMessages() OVERRIDE; |
| + // WallpaperDelegate implementation. |
| + virtual void SetCustomWallpaperThumbnail() OVERRIDE; |
| + |
| private: |
| + // SelectFileDialog::Delegate implementation. |
| + virtual void FileSelected(const FilePath& path, int index, |
| + void* params) OVERRIDE; |
| + |
| // Sends list of available default images to the page. |
| void SendDefaultImages(); |
| + // Sends layout options for custom wallpaper. Only exposes CENTER, |
| + // CENTER_CROPPED, STRETCH to users. Set the selected option to specified |
| + // |layout|. |
| + void SendLayoutOptions(ash::WallpaperLayout layout); |
| + |
| // Handles page initialized event. |
| void HandlePageInitialized(const base::ListValue* args); |
| // Handles page shown event. |
| void HandlePageShown(const base::ListValue* args); |
| + // Opens a file selection dialog to choose user image from file. |
| + void HandleChooseFile(const base::ListValue* args); |
| + |
| + // Redraws the wallpaper with specified wallpaper layout. |
| + void HandleLayoutChanged(const base::ListValue* args); |
| + |
| // Selects one of the available default wallpapers. |
| void HandleDefaultWallpaper(const base::ListValue* args); |
| @@ -49,6 +79,9 @@ class SetWallpaperOptionsHandler : public ::options2::OptionsPageUIHandler{ |
| // Returns handle to browser window or NULL if it can't be found. |
| gfx::NativeWindow GetBrowserWindow() const; |
| + // Shows a dialog box for selecting a file. |
| + scoped_refptr<SelectFileDialog> select_file_dialog_; |
| + |
| base::WeakPtrFactory<SetWallpaperOptionsHandler> weak_factory_; |
| DISALLOW_COPY_AND_ASSIGN(SetWallpaperOptionsHandler); |