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

Side by Side Diff: chrome/browser/chromeos/login/screens/user_image_screen_actor.h

Issue 14063017: Move logic in UserImageScreen from UserImageScreenHandler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 7 years, 8 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 | 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_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_SCREEN_ACTOR_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_SCREEN_ACTOR_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_SCREEN_ACTOR_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_SCREEN_ACTOR_H_
7 7
8 #include <string>
9
8 class SkBitmap; 10 class SkBitmap;
9 11
10 namespace gfx { 12 namespace gfx {
11 class ImageSkia; 13 class ImageSkia;
12 } 14 }
13 15
14 namespace chromeos { 16 namespace chromeos {
15 17
16 // Interface for dependency injection between UserImageScreen and its actual 18 // Interface for dependency injection between UserImageScreen and its actual
17 // representation, either views based or WebUI. 19 // representation, either views based or WebUI.
18 class UserImageScreenActor { 20 class UserImageScreenActor {
19 public: 21 public:
20 class Delegate { 22 class Delegate {
21 public: 23 public:
22 virtual ~Delegate() {} 24 virtual ~Delegate() {}
23 25
24 // Called when user accepts photo as login user image. 26 // Called when user accepts photo as login user image.
25 virtual void OnPhotoTaken(const gfx::ImageSkia& image) = 0; 27 virtual void OnPhotoTaken(const std::string& raw_data) = 0;
26 // Called when user accepts Profile image as login user image. 28 // Called to check camera presence.
27 virtual void OnProfileImageSelected() = 0; 29 virtual void CheckCameraPresence() = 0;
28 // Called when user accepts one of the default images as login user 30 // Called when user selects some image
29 // image. 31 virtual void OnImageSelected(const std::string& image_url,
30 virtual void OnDefaultImageSelected(int index) = 0; 32 const std::string& image_type) = 0;
33 // Called when user accepts currently selected image
34 virtual void OnImageAccepted() = 0;
35
31 // Called when actor is destroyed so there's no dead reference to it. 36 // Called when actor is destroyed so there's no dead reference to it.
32 virtual void OnActorDestroyed(UserImageScreenActor* actor) = 0; 37 virtual void OnActorDestroyed(UserImageScreenActor* actor) = 0;
38
39 virtual bool profile_picture_absent() = 0;
40 virtual int selected_image() = 0;
41 virtual std::string profile_picture_data_url() = 0;
42
33 }; 43 };
34 44
35 virtual ~UserImageScreenActor() {} 45 virtual ~UserImageScreenActor() {}
36 46
37 // Sets screen this actor belongs to. 47 // Sets screen this actor belongs to.
38 virtual void SetDelegate(Delegate* screen) = 0; 48 virtual void SetDelegate(Delegate* screen) = 0;
39 49
40 // Prepare the contents to showing. 50 // Prepare the contents to showing.
41 virtual void PrepareToShow() = 0; 51 virtual void PrepareToShow() = 0;
42 52
43 // Shows the contents of the screen. 53 // Shows the contents of the screen.
44 virtual void Show() = 0; 54 virtual void Show() = 0;
45 55
46 // Hides the contents of the screen. 56 // Hides the contents of the screen.
47 virtual void Hide() = 0; 57 virtual void Hide() = 0;
48 58
49 // Selects image with the index specified. 59 // Selects image with the index specified.
50 virtual void SelectImage(int index) = 0; 60 virtual void SelectImage(int index) = 0;
51 61
52 // Starts camera presence check. 62 // Sends profile image as a data URL to the page.
53 virtual void CheckCameraPresence() = 0; 63 virtual void SendProfileImage(const std::string& data_url) = 0;
64
65 // Indicates that there is no custom profile image for the user.
66 virtual void OnProfileImageAbsent() = 0;
54 67
55 // Enables or disables profile picture. 68 // Enables or disables profile picture.
56 virtual void SetProfilePictureEnabled(bool enabled) = 0; 69 virtual void SetProfilePictureEnabled(bool enabled) = 0;
57 70
58 // Inserts profile image in the list for user to select. 71 // Sends result of camera check
59 virtual void AddProfileImage(const gfx::ImageSkia& image) {} 72 virtual void SetCameraPresent(bool enabled) = 0;
60
61 // Indicates that there is no custom profile image for the user.
62 virtual void OnProfileImageAbsent() {}
63 }; 73 };
64 74
65 } // namespace chromeos 75 } // namespace chromeos
66 76
67 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_SCREEN_ACTOR_H_ 77 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_SCREEN_ACTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698