Chromium Code Reviews| 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_CHROMEOS_LOGIN_USER_IMAGE_SCREEN_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_USER_IMAGE_SCREEN_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_USER_IMAGE_SCREEN_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_USER_IMAGE_SCREEN_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "chrome/browser/chromeos/login/screens/user_image_view.h" | 13 #include "chrome/browser/chromeos/login/screens/user_image_view.h" |
| 14 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" | 14 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" |
| 15 #include "ui/gfx/image/image_skia.h" | 15 #include "ui/gfx/image/image_skia.h" |
| 16 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
| 17 | 17 |
| 18 namespace chromeos { | 18 namespace chromeos { |
| 19 | 19 |
| 20 // WebUI implementation of UserImageScreenActor. It is used to interact | 20 // WebUI implementation of UserImageScreenActor. It is used to interact |
|
achuithb
2017/02/08 20:05:56
There's no more UserImageScreenActor, right?
jdufault
2017/02/10 20:32:23
Done.
| |
| 21 // with JS page part allowing user to select avatar. | 21 // with JS page part allowing user to select avatar. |
| 22 class UserImageScreenHandler : public UserImageView, public BaseScreenHandler { | 22 class UserImageScreenHandler : public UserImageView, public BaseScreenHandler { |
| 23 public: | 23 public: |
| 24 UserImageScreenHandler(); | 24 UserImageScreenHandler(); |
| 25 ~UserImageScreenHandler() override; | 25 ~UserImageScreenHandler() override; |
| 26 | 26 |
| 27 private: | |
| 27 // BaseScreenHandler implementation: | 28 // BaseScreenHandler implementation: |
| 28 void Initialize() override; | 29 void Initialize() override; |
| 29 void DeclareLocalizedValues( | 30 void DeclareLocalizedValues( |
| 30 ::login::LocalizedValuesBuilder* builder) override; | 31 ::login::LocalizedValuesBuilder* builder) override; |
| 31 | 32 |
| 32 // WebUIMessageHandler implementation: | 33 // WebUIMessageHandler implementation: |
| 33 void RegisterMessages() override; | 34 void RegisterMessages() override; |
| 34 | 35 |
| 35 // UserImageView implementation: | 36 // UserImageView implementation: |
| 36 void Bind(UserImageModel& model) override; | 37 void Bind(UserImageScreen* screen) override; |
| 37 void Unbind() override; | 38 void Unbind() override; |
| 38 void Show() override; | 39 void Show() override; |
| 39 void Hide() override; | 40 void Hide() override; |
| 40 void HideCurtain() override; | 41 void HideCurtain() override; |
| 41 | 42 |
| 42 private: | |
| 43 // Sends image data to the page. | 43 // Sends image data to the page. |
| 44 void HandleGetImages(); | 44 void HandleGetImages(); |
| 45 | 45 |
| 46 // Screen ready to be shown. | 46 // Screen ready to be shown. |
| 47 void HandleScreenReady(); | 47 void HandleScreenReady(); |
| 48 | 48 |
| 49 // Handles photo taken with WebRTC UI. | 49 // Handles photo taken with WebRTC UI. |
| 50 void HandlePhotoTaken(const std::string& image_url); | 50 void HandlePhotoTaken(const std::string& image_url); |
| 51 | 51 |
| 52 // Handles 'take-photo' button click. | 52 // Handles 'take-photo' button click. |
| 53 void HandleTakePhoto(); | 53 void HandleTakePhoto(); |
| 54 | 54 |
| 55 // Handles 'discard-photo' button click. | 55 // Handles 'discard-photo' button click. |
| 56 void HandleDiscardPhoto(); | 56 void HandleDiscardPhoto(); |
| 57 | 57 |
| 58 // Handles clicking on default user image. | 58 // Handles clicking on default user image. |
| 59 void HandleSelectImage(const std::string& image_url, | 59 void HandleSelectImage(const std::string& image_url, |
| 60 const std::string& image_type, | 60 const std::string& image_type, |
| 61 bool is_user_selection); | 61 bool is_user_selection); |
| 62 | 62 |
| 63 // Called when user accept the image closing the screen. | 63 // Called when user accept the image closing the screen. |
| 64 void HandleImageAccepted(); | 64 void HandleImageAccepted(); |
| 65 | 65 |
| 66 // Called when the user image screen has been loaded and shown. | 66 // Called when the user image screen has been loaded and shown. |
| 67 void HandleScreenShown(); | 67 void HandleScreenShown(); |
| 68 | 68 |
| 69 UserImageModel* model_; | 69 UserImageScreen* screen_ = nullptr; |
| 70 | 70 |
| 71 // Keeps whether screen should be shown right after initialization. | 71 // Keeps whether screen should be shown right after initialization. |
| 72 bool show_on_init_; | 72 bool show_on_init_ = false; |
| 73 | 73 |
| 74 // Keeps whether screen has loaded all default images and redy to be shown. | 74 // Keeps whether screen has loaded all default images and redy to be shown. |
| 75 bool is_ready_; | 75 bool is_ready_ = false; |
| 76 | 76 |
| 77 base::Time screen_show_time_; | 77 base::Time screen_show_time_; |
| 78 | 78 |
| 79 DISALLOW_COPY_AND_ASSIGN(UserImageScreenHandler); | 79 DISALLOW_COPY_AND_ASSIGN(UserImageScreenHandler); |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 } // namespace chromeos | 82 } // namespace chromeos |
| 83 | 83 |
| 84 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_USER_IMAGE_SCREEN_HANDLER_H_ | 84 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_USER_IMAGE_SCREEN_HANDLER_H_ |
| OLD | NEW |