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

Side by Side Diff: chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.h

Issue 8879048: [cros] Change Picture prefs page: DOM initialization moved to separate handler from Initialize. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes. Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_OPTIONS_CHROMEOS_CHANGE_PICTURE_OPTIONS_HANDLER_ H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CHANGE_PICTURE_OPTIONS_HANDLER_ H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CHANGE_PICTURE_OPTIONS_HANDLER_ H_ 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CHANGE_PICTURE_OPTIONS_HANDLER_ H_
7 7
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "chrome/browser/chromeos/options/take_photo_dialog.h" 9 #include "chrome/browser/chromeos/options/take_photo_dialog.h"
10 #include "chrome/browser/ui/select_file_dialog.h" 10 #include "chrome/browser/ui/select_file_dialog.h"
(...skipping 10 matching lines...) Expand all
21 21
22 // ChromeOS user image options page UI handler. 22 // ChromeOS user image options page UI handler.
23 class ChangePictureOptionsHandler : public OptionsPageUIHandler, 23 class ChangePictureOptionsHandler : public OptionsPageUIHandler,
24 public SelectFileDialog::Listener, 24 public SelectFileDialog::Listener,
25 public TakePhotoDialog::Delegate { 25 public TakePhotoDialog::Delegate {
26 public: 26 public:
27 ChangePictureOptionsHandler(); 27 ChangePictureOptionsHandler();
28 virtual ~ChangePictureOptionsHandler(); 28 virtual ~ChangePictureOptionsHandler();
29 29
30 // OptionsPageUIHandler implementation. 30 // OptionsPageUIHandler implementation.
31 virtual void Initialize() OVERRIDE;
32 virtual void GetLocalizedValues( 31 virtual void GetLocalizedValues(
33 base::DictionaryValue* localized_strings) OVERRIDE; 32 base::DictionaryValue* localized_strings) OVERRIDE;
34 33
35 // WebUIMessageHandler implementation. 34 // WebUIMessageHandler implementation.
36 virtual void RegisterMessages() OVERRIDE; 35 virtual void RegisterMessages() OVERRIDE;
37 36
38 private: 37 private:
39 // Sends list of available default images to the page. 38 // Sends list of available default images to the page.
40 void SendAvailableImages(); 39 void SendDefaultImages();
41 40
42 // Sends current selection to the page. 41 // Sends current selection to the page.
43 void SendSelectedImage(); 42 void SendSelectedImage();
44 43
45 // Sends the profile image to the page. If |should_select| is true then 44 // Sends the profile image to the page. If |should_select| is true then
46 // the profile image element is selected. 45 // the profile image element is selected.
47 void SendProfileImage(const SkBitmap& image, bool should_select); 46 void SendProfileImage(const SkBitmap& image, bool should_select);
48 47
49 // Starts profile image update and shows the last downloaded profile image, 48 // Starts profile image update and shows the last downloaded profile image,
50 // if any, on the page. Shouldn't be called before |SendProfileImage|. 49 // if any, on the page. Shouldn't be called before |SendProfileImage|.
51 void UpdateProfileImage(); 50 void UpdateProfileImage();
52 51
53 // Starts camera presence check. 52 // Starts camera presence check.
54 void CheckCameraPresence(); 53 void CheckCameraPresence();
55 54
56 // Updates UI with camera presence state. 55 // Updates UI with camera presence state.
57 void SetCameraPresent(bool present); 56 void SetCameraPresent(bool present);
58 57
59 // Opens a file selection dialog to choose user image from file. 58 // Opens a file selection dialog to choose user image from file.
60 void HandleChooseFile(const base::ListValue* args); 59 void HandleChooseFile(const base::ListValue* args);
61 60
62 // Opens the camera capture dialog. 61 // Opens the camera capture dialog.
63 void HandleTakePhoto(const base::ListValue* args); 62 void HandleTakePhoto(const base::ListValue* args);
64 63
65 // Gets the list of available user images and sends it to the page. 64 // Gets the list of available user images and sends it to the page.
66 void HandleGetAvailableImages(const base::ListValue* args); 65 void HandleGetAvailableImages(const base::ListValue* args);
67 66
67 // Handles page initialized event.
68 void HandlePageInitialized(const base::ListValue* args);
69
68 // Handles page shown event. 70 // Handles page shown event.
69 void HandleOnPageShown(const base::ListValue* args); 71 void HandlePageShown(const base::ListValue* args);
70 72
71 // Selects one of the available images as user's. 73 // Selects one of the available images as user's.
72 void HandleSelectImage(const base::ListValue* args); 74 void HandleSelectImage(const base::ListValue* args);
73 75
74 // SelectFileDialog::Delegate implementation. 76 // SelectFileDialog::Delegate implementation.
75 virtual void FileSelected( 77 virtual void FileSelected(
76 const FilePath& path, 78 const FilePath& path,
77 int index, void* params) OVERRIDE; 79 int index, void* params) OVERRIDE;
78 80
79 // TakePhotoDialog::Delegate implementation. 81 // TakePhotoDialog::Delegate implementation.
(...skipping 22 matching lines...) Expand all
102 content::NotificationRegistrar registrar_; 104 content::NotificationRegistrar registrar_;
103 105
104 base::WeakPtrFactory<ChangePictureOptionsHandler> weak_factory_; 106 base::WeakPtrFactory<ChangePictureOptionsHandler> weak_factory_;
105 107
106 DISALLOW_COPY_AND_ASSIGN(ChangePictureOptionsHandler); 108 DISALLOW_COPY_AND_ASSIGN(ChangePictureOptionsHandler);
107 }; 109 };
108 110
109 } // namespace chromeos 111 } // namespace chromeos
110 112
111 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CHANGE_PICTURE_OPTIONS_HANDL ER_H_ 113 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CHANGE_PICTURE_OPTIONS_HANDL ER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698