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

Side by Side Diff: chrome/browser/ui/webui/settings/chromeos/change_picture_handler.h

Issue 1575543003: Settings People Revamp: Implement parts of ChromeOS Change Picture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix change_picture_handler to accomodate origin/master changes Created 4 years, 11 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_SETTINGS_CHROMEOS_CHANGE_PICTURE_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CHANGE_PICTURE_OPTIONS_HANDLER_ H_ 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_CHANGE_PICTURE_HANDLER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/scoped_observer.h"
9 #include "chrome/browser/chromeos/camera_presence_notifier.h" 10 #include "chrome/browser/chromeos/camera_presence_notifier.h"
10 #include "chrome/browser/image_decoder.h" 11 #include "chrome/browser/image_decoder.h"
11 #include "chrome/browser/ui/webui/options/options_ui.h" 12 #include "chrome/browser/ui/webui/settings/md_settings_ui.h"
12 #include "content/public/browser/notification_observer.h" 13 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h" 14 #include "content/public/browser/notification_registrar.h"
14 #include "ui/gfx/image/image_skia.h" 15 #include "ui/gfx/image/image_skia.h"
15 #include "ui/gfx/native_widget_types.h" 16 #include "ui/gfx/native_widget_types.h"
16 #include "ui/shell_dialogs/select_file_dialog.h" 17 #include "ui/shell_dialogs/select_file_dialog.h"
17 18
18 namespace base { 19 namespace base {
19 class DictionaryValue; 20 class DictionaryValue;
20 class ListValue; 21 class ListValue;
21 } 22 }
22 23
23 namespace user_manager { 24 namespace user_manager {
24 class User; 25 class User;
25 } 26 }
26 27
27 namespace chromeos { 28 namespace chromeos {
28 29
29 namespace options { 30 namespace settings {
30 31
31 // ChromeOS user image options page UI handler. 32 // ChromeOS user image settings page UI handler.
32 class ChangePictureOptionsHandler : public ::options::OptionsPageUIHandler, 33 class ChangePictureHandler : public ::settings::SettingsPageUIHandler,
33 public ui::SelectFileDialog::Listener, 34 public ui::SelectFileDialog::Listener,
34 public content::NotificationObserver, 35 public content::NotificationObserver,
35 public ImageDecoder::ImageRequest, 36 public ImageDecoder::ImageRequest,
36 public CameraPresenceNotifier::Observer { 37 public CameraPresenceNotifier::Observer {
37 public: 38 public:
38 ChangePictureOptionsHandler(); 39 ChangePictureHandler();
39 ~ChangePictureOptionsHandler() override; 40 ~ChangePictureHandler() override;
40
41 // OptionsPageUIHandler implementation.
42 void GetLocalizedValues(base::DictionaryValue* localized_strings) override;
43 41
44 // WebUIMessageHandler implementation. 42 // WebUIMessageHandler implementation.
45 void RegisterMessages() override; 43 void RegisterMessages() override;
46 44
47 // CameraPresenceNotifier::Observer implementation: 45 // CameraPresenceNotifier::Observer implementation:
48 void OnCameraPresenceCheckDone(bool is_camera_present) override; 46 void OnCameraPresenceCheckDone(bool is_camera_present) override;
49 47
50 private: 48 private:
51 // Sends list of available default images to the page. 49 // Sends list of available default images to the page.
52 void SendDefaultImages(); 50 void SendDefaultImages();
(...skipping 29 matching lines...) Expand all
82 80
83 // Handles 'discard-photo' button click. 81 // Handles 'discard-photo' button click.
84 void HandleDiscardPhoto(const base::ListValue* args); 82 void HandleDiscardPhoto(const base::ListValue* args);
85 83
86 // Gets the list of available user images and sends it to the page. 84 // Gets the list of available user images and sends it to the page.
87 void HandleGetAvailableImages(const base::ListValue* args); 85 void HandleGetAvailableImages(const base::ListValue* args);
88 86
89 // Handles page initialized event. 87 // Handles page initialized event.
90 void HandlePageInitialized(const base::ListValue* args); 88 void HandlePageInitialized(const base::ListValue* args);
91 89
92 // Handles page shown event.
93 void HandlePageShown(const base::ListValue* args);
94
95 // Handles page hidden event.
96 void HandlePageHidden(const base::ListValue* args);
97
98 // Selects one of the available images as user's. 90 // Selects one of the available images as user's.
99 void HandleSelectImage(const base::ListValue* args); 91 void HandleSelectImage(const base::ListValue* args);
100 92
101 // SelectFileDialog::Delegate implementation. 93 // SelectFileDialog::Delegate implementation.
102 void FileSelected(const base::FilePath& path, 94 void FileSelected(const base::FilePath& path,
103 int index, 95 int index,
104 void* params) override; 96 void* params) override;
105 97
106 // content::NotificationObserver implementation. 98 // content::NotificationObserver implementation.
107 void Observe(int type, 99 void Observe(int type,
(...skipping 24 matching lines...) Expand all
132 int previous_image_index_; 124 int previous_image_index_;
133 125
134 // Last user photo, if taken. 126 // Last user photo, if taken.
135 gfx::ImageSkia user_photo_; 127 gfx::ImageSkia user_photo_;
136 128
137 // Data URL for |user_photo_|. 129 // Data URL for |user_photo_|.
138 std::string user_photo_data_url_; 130 std::string user_photo_data_url_;
139 131
140 content::NotificationRegistrar registrar_; 132 content::NotificationRegistrar registrar_;
141 133
142 DISALLOW_COPY_AND_ASSIGN(ChangePictureOptionsHandler); 134 ScopedObserver<CameraPresenceNotifier, ChangePictureHandler> camera_observer_;
135
136 DISALLOW_COPY_AND_ASSIGN(ChangePictureHandler);
143 }; 137 };
144 138
145 } // namespace options 139 } // namespace settings
146 } // namespace chromeos 140 } // namespace chromeos
147 141
148 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CHANGE_PICTURE_OPTIONS_HANDL ER_H_ 142 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_CHANGE_PICTURE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698