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_OPTIONS2_CHROMEOS_CHANGE_PICTURE_OPTIONS_HANDLER
_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_CHANGE_PICTURE_OPTIONS_HANDLER
_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_CHANGE_PICTURE_OPTIONS_HANDLER
_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_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/image_decoder.h" | 10 #include "chrome/browser/image_decoder.h" |
11 #include "chrome/browser/ui/select_file_dialog.h" | |
12 #include "chrome/browser/ui/webui/options2/options_ui.h" | 11 #include "chrome/browser/ui/webui/options2/options_ui.h" |
13 #include "content/public/browser/notification_registrar.h" | 12 #include "content/public/browser/notification_registrar.h" |
| 13 #include "ui/base/dialogs/select_file_dialog.h" |
14 #include "ui/gfx/image/image_skia.h" | 14 #include "ui/gfx/image/image_skia.h" |
15 #include "ui/gfx/native_widget_types.h" | 15 #include "ui/gfx/native_widget_types.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 chromeos { | 22 namespace chromeos { |
23 namespace options2 { | 23 namespace options2 { |
24 | 24 |
25 // ChromeOS user image options page UI handler. | 25 // ChromeOS user image options page UI handler. |
26 class ChangePictureOptionsHandler : public ::options2::OptionsPageUIHandler, | 26 class ChangePictureOptionsHandler : public ::options2::OptionsPageUIHandler, |
27 public SelectFileDialog::Listener, | 27 public ui::SelectFileDialog::Listener, |
28 public TakePhotoDialog::Delegate, | 28 public TakePhotoDialog::Delegate, |
29 public ImageDecoder::Delegate { | 29 public ImageDecoder::Delegate { |
30 public: | 30 public: |
31 ChangePictureOptionsHandler(); | 31 ChangePictureOptionsHandler(); |
32 virtual ~ChangePictureOptionsHandler(); | 32 virtual ~ChangePictureOptionsHandler(); |
33 | 33 |
34 // OptionsPageUIHandler implementation. | 34 // OptionsPageUIHandler implementation. |
35 virtual void GetLocalizedValues( | 35 virtual void GetLocalizedValues( |
36 base::DictionaryValue* localized_strings) OVERRIDE; | 36 base::DictionaryValue* localized_strings) OVERRIDE; |
37 | 37 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 void OnCameraPresenceCheckDone(); | 97 void OnCameraPresenceCheckDone(); |
98 | 98 |
99 // Returns handle to browser window or NULL if it can't be found. | 99 // Returns handle to browser window or NULL if it can't be found. |
100 gfx::NativeWindow GetBrowserWindow() const; | 100 gfx::NativeWindow GetBrowserWindow() const; |
101 | 101 |
102 // Overriden from ImageDecoder::Delegate: | 102 // Overriden from ImageDecoder::Delegate: |
103 virtual void OnImageDecoded(const ImageDecoder* decoder, | 103 virtual void OnImageDecoded(const ImageDecoder* decoder, |
104 const SkBitmap& decoded_image) OVERRIDE; | 104 const SkBitmap& decoded_image) OVERRIDE; |
105 virtual void OnDecodeImageFailed(const ImageDecoder* decoder) OVERRIDE; | 105 virtual void OnDecodeImageFailed(const ImageDecoder* decoder) OVERRIDE; |
106 | 106 |
107 scoped_refptr<SelectFileDialog> select_file_dialog_; | 107 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; |
108 | 108 |
109 // Previous user image from camera/file and its data URL. | 109 // Previous user image from camera/file and its data URL. |
110 gfx::ImageSkia previous_image_; | 110 gfx::ImageSkia previous_image_; |
111 std::string previous_image_data_url_; | 111 std::string previous_image_data_url_; |
112 | 112 |
113 // Index of the previous user image. | 113 // Index of the previous user image. |
114 int previous_image_index_; | 114 int previous_image_index_; |
115 | 115 |
116 // Last user photo, if taken. | 116 // Last user photo, if taken. |
117 gfx::ImageSkia user_photo_; | 117 gfx::ImageSkia user_photo_; |
118 | 118 |
119 // Data URL for |user_photo_|. | 119 // Data URL for |user_photo_|. |
120 std::string user_photo_data_url_; | 120 std::string user_photo_data_url_; |
121 | 121 |
122 content::NotificationRegistrar registrar_; | 122 content::NotificationRegistrar registrar_; |
123 | 123 |
124 base::WeakPtrFactory<ChangePictureOptionsHandler> weak_factory_; | 124 base::WeakPtrFactory<ChangePictureOptionsHandler> weak_factory_; |
125 | 125 |
126 // Last ImageDecoder instance used to decode an image blob received by | 126 // Last ImageDecoder instance used to decode an image blob received by |
127 // HandlePhotoTaken. | 127 // HandlePhotoTaken. |
128 scoped_refptr<ImageDecoder> image_decoder_; | 128 scoped_refptr<ImageDecoder> image_decoder_; |
129 | 129 |
130 DISALLOW_COPY_AND_ASSIGN(ChangePictureOptionsHandler); | 130 DISALLOW_COPY_AND_ASSIGN(ChangePictureOptionsHandler); |
131 }; | 131 }; |
132 | 132 |
133 } // namespace options2 | 133 } // namespace options2 |
134 } // namespace chromeos | 134 } // namespace chromeos |
135 | 135 |
136 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_CHANGE_PICTURE_OPTIONS_HAND
LER_H_ | 136 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_CHANGE_PICTURE_OPTIONS_HAND
LER_H_ |
OLD | NEW |