| OLD | NEW |
| 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_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 "chrome/browser/chromeos/camera_presence_notifier.h" | 8 #include "chrome/browser/chromeos/camera_presence_notifier.h" |
| 9 #include "chrome/browser/image_decoder.h" | 9 #include "chrome/browser/image_decoder.h" |
| 10 #include "chrome/browser/ui/webui/options/options_ui.h" | 10 #include "chrome/browser/ui/webui/options/options_ui.h" |
| 11 #include "content/public/browser/notification_observer.h" | 11 #include "content/public/browser/notification_observer.h" |
| 12 #include "content/public/browser/notification_registrar.h" | 12 #include "content/public/browser/notification_registrar.h" |
| 13 #include "ui/gfx/image/image_skia.h" | 13 #include "ui/gfx/image/image_skia.h" |
| 14 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
| 15 #include "ui/shell_dialogs/select_file_dialog.h" | 15 #include "ui/shell_dialogs/select_file_dialog.h" |
| 16 | 16 |
| 17 namespace base { | 17 namespace base { |
| 18 class DictionaryValue; | 18 class DictionaryValue; |
| 19 class ListValue; | 19 class ListValue; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace user_manager { |
| 23 class User; |
| 24 } |
| 25 |
| 22 namespace chromeos { | 26 namespace chromeos { |
| 23 | 27 |
| 24 class User; | |
| 25 | |
| 26 namespace options { | 28 namespace options { |
| 27 | 29 |
| 28 // ChromeOS user image options page UI handler. | 30 // ChromeOS user image options page UI handler. |
| 29 class ChangePictureOptionsHandler : public ::options::OptionsPageUIHandler, | 31 class ChangePictureOptionsHandler : public ::options::OptionsPageUIHandler, |
| 30 public ui::SelectFileDialog::Listener, | 32 public ui::SelectFileDialog::Listener, |
| 31 public content::NotificationObserver, | 33 public content::NotificationObserver, |
| 32 public ImageDecoder::Delegate, | 34 public ImageDecoder::Delegate, |
| 33 public CameraPresenceNotifier::Observer { | 35 public CameraPresenceNotifier::Observer { |
| 34 public: | 36 public: |
| 35 ChangePictureOptionsHandler(); | 37 ChangePictureOptionsHandler(); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // Returns handle to browser window or NULL if it can't be found. | 114 // Returns handle to browser window or NULL if it can't be found. |
| 113 gfx::NativeWindow GetBrowserWindow() const; | 115 gfx::NativeWindow GetBrowserWindow() const; |
| 114 | 116 |
| 115 // Overriden from ImageDecoder::Delegate: | 117 // Overriden from ImageDecoder::Delegate: |
| 116 virtual void OnImageDecoded(const ImageDecoder* decoder, | 118 virtual void OnImageDecoded(const ImageDecoder* decoder, |
| 117 const SkBitmap& decoded_image) OVERRIDE; | 119 const SkBitmap& decoded_image) OVERRIDE; |
| 118 virtual void OnDecodeImageFailed(const ImageDecoder* decoder) OVERRIDE; | 120 virtual void OnDecodeImageFailed(const ImageDecoder* decoder) OVERRIDE; |
| 119 | 121 |
| 120 // Returns user related to current WebUI. If this user doesn't exist, | 122 // Returns user related to current WebUI. If this user doesn't exist, |
| 121 // returns active user. | 123 // returns active user. |
| 122 User* GetUser() const; | 124 user_manager::User* GetUser() const; |
| 123 | 125 |
| 124 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; | 126 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; |
| 125 | 127 |
| 126 // Previous user image from camera/file and its data URL. | 128 // Previous user image from camera/file and its data URL. |
| 127 gfx::ImageSkia previous_image_; | 129 gfx::ImageSkia previous_image_; |
| 128 std::string previous_image_url_; | 130 std::string previous_image_url_; |
| 129 | 131 |
| 130 // Index of the previous user image. | 132 // Index of the previous user image. |
| 131 int previous_image_index_; | 133 int previous_image_index_; |
| 132 | 134 |
| 133 // Last user photo, if taken. | 135 // Last user photo, if taken. |
| 134 gfx::ImageSkia user_photo_; | 136 gfx::ImageSkia user_photo_; |
| 135 | 137 |
| 136 // Data URL for |user_photo_|. | 138 // Data URL for |user_photo_|. |
| 137 std::string user_photo_data_url_; | 139 std::string user_photo_data_url_; |
| 138 | 140 |
| 139 content::NotificationRegistrar registrar_; | 141 content::NotificationRegistrar registrar_; |
| 140 | 142 |
| 141 // Last ImageDecoder instance used to decode an image blob received by | 143 // Last ImageDecoder instance used to decode an image blob received by |
| 142 // HandlePhotoTaken. | 144 // HandlePhotoTaken. |
| 143 scoped_refptr<ImageDecoder> image_decoder_; | 145 scoped_refptr<ImageDecoder> image_decoder_; |
| 144 | 146 |
| 145 DISALLOW_COPY_AND_ASSIGN(ChangePictureOptionsHandler); | 147 DISALLOW_COPY_AND_ASSIGN(ChangePictureOptionsHandler); |
| 146 }; | 148 }; |
| 147 | 149 |
| 148 } // namespace options | 150 } // namespace options |
| 149 } // namespace chromeos | 151 } // namespace chromeos |
| 150 | 152 |
| 151 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CHANGE_PICTURE_OPTIONS_HANDL
ER_H_ | 153 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CHANGE_PICTURE_OPTIONS_HANDL
ER_H_ |
| OLD | NEW |