| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SIGNIN_SCREENLOCK_BRIDGE_H_ | 5 #ifndef CHROME_BROWSER_SIGNIN_SCREENLOCK_BRIDGE_H_ |
| 6 #define CHROME_BROWSER_SIGNIN_SCREENLOCK_BRIDGE_H_ | 6 #define CHROME_BROWSER_SIGNIN_SCREENLOCK_BRIDGE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
| 15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 | 17 |
| 18 namespace gfx { | |
| 19 class Image; | |
| 20 } | |
| 21 | 18 |
| 22 class Profile; | 19 class Profile; |
| 23 | 20 |
| 24 // ScreenlockBridge brings together the screenLockPrivate API and underlying | 21 // ScreenlockBridge brings together the screenLockPrivate API and underlying |
| 25 // support. On ChromeOS, it delegates calls to the ScreenLocker. On other | 22 // support. On ChromeOS, it delegates calls to the ScreenLocker. On other |
| 26 // platforms, it delegates calls to UserManagerUI (and friends). | 23 // platforms, it delegates calls to UserManagerUI (and friends). |
| 27 class ScreenlockBridge { | 24 class ScreenlockBridge { |
| 28 public: | 25 public: |
| 29 class Observer { | 26 class Observer { |
| 30 public: | 27 public: |
| (...skipping 12 matching lines...) Expand all Loading... |
| 43 UserPodCustomIconOptions(); | 40 UserPodCustomIconOptions(); |
| 44 ~UserPodCustomIconOptions(); | 41 ~UserPodCustomIconOptions(); |
| 45 | 42 |
| 46 // Converts parameters to a dictionary values that can be sent to the | 43 // Converts parameters to a dictionary values that can be sent to the |
| 47 // screenlock web UI. | 44 // screenlock web UI. |
| 48 scoped_ptr<base::DictionaryValue> ToDictionaryValue() const; | 45 scoped_ptr<base::DictionaryValue> ToDictionaryValue() const; |
| 49 | 46 |
| 50 // Sets the icon as chrome://theme resource URL. | 47 // Sets the icon as chrome://theme resource URL. |
| 51 void SetIconAsResourceURL(const std::string& url); | 48 void SetIconAsResourceURL(const std::string& url); |
| 52 | 49 |
| 53 // Sets the icon as a gfx::Image. The image will be converted to set of data | 50 // Sets the icon size. If not called, the icon will not be visible. |
| 54 // URLs for each icon representation. Use |SetIconAsResourceURL| instead of | 51 // For animated icon, this should be set to a single frame size, not the |
| 55 // this. | 52 // animation resource size. |
| 56 // TODO(tbarzic): Remove this one once easy unlock app stops using | |
| 57 // screenlockPrivate.showCustomIcon. | |
| 58 void SetIconAsImage(const gfx::Image& image); | |
| 59 | |
| 60 // Sets the icon size. Has to be called if |SetIconAsResourceURL| was used | |
| 61 // to set the icon. For animated icon, this should be set to a single frame | |
| 62 // size, not the animation resource size. | |
| 63 void SetSize(size_t icon_width, size_t icon_height); | 53 void SetSize(size_t icon_width, size_t icon_height); |
| 64 | 54 |
| 65 // If the icon is supposed to be animated, sets the animation parameters. | 55 // If the icon is supposed to be animated, sets the animation parameters. |
| 66 // If set, it expects that the resource set using |SetIcon*| methods | 56 // If set, it expects that the resource set using |SetIconAsResourceURL| |
| 67 // contains horizontally arranged ordered list of animation frames. | 57 // method contains horizontally arranged ordered list of animation frames. |
| 68 // Note that the icon size set in |SetSize| should be a single frame size. | 58 // Note that the icon size set in |SetSize| should be a single frame size. |
| 69 // |resource_width|: Total animation resource width. | 59 // |resource_width|: Total animation resource width. |
| 70 // |frame_length_ms|: Time for which a single animation frame is shown. | 60 // |frame_length_ms|: Time for which a single animation frame is shown. |
| 71 void SetAnimation(size_t resource_width, size_t frame_length_ms); | 61 void SetAnimation(size_t resource_width, size_t frame_length_ms); |
| 72 | 62 |
| 73 // Sets the icon opacity. The values should be in <0, 100] interval, which | 63 // Sets the icon opacity. The values should be in <0, 100] interval, which |
| 74 // will get scaled into <0, 1] interval. The default value is 100. | 64 // will get scaled into <0, 1] interval. The default value is 100. |
| 75 void SetOpacity(size_t opacity); | 65 void SetOpacity(size_t opacity); |
| 76 | 66 |
| 77 // Sets the icon tooltip. If |autoshow| is set the tooltip is automatically | 67 // Sets the icon tooltip. If |autoshow| is set the tooltip is automatically |
| 78 // shown with the icon. | 68 // shown with the icon. |
| 79 void SetTooltip(const base::string16& tooltip, bool autoshow); | 69 void SetTooltip(const base::string16& tooltip, bool autoshow); |
| 80 | 70 |
| 81 // If hardlock on click is set, clicking the icon in the screenlock will | 71 // If hardlock on click is set, clicking the icon in the screenlock will |
| 82 // go to state where password is required for unlock. | 72 // go to state where password is required for unlock. |
| 83 void SetHardlockOnClick(); | 73 void SetHardlockOnClick(); |
| 84 | 74 |
| 85 private: | 75 private: |
| 86 std::string icon_resource_url_; | 76 std::string icon_resource_url_; |
| 87 scoped_ptr<gfx::Image> icon_image_; | |
| 88 | 77 |
| 89 size_t width_; | 78 size_t width_; |
| 90 size_t height_; | 79 size_t height_; |
| 91 | 80 |
| 92 bool animation_set_; | 81 bool animation_set_; |
| 93 size_t animation_resource_width_; | 82 size_t animation_resource_width_; |
| 94 size_t animation_frame_length_ms_; | 83 size_t animation_frame_length_ms_; |
| 95 | 84 |
| 96 // The opacity should be in <0, 100] range. | 85 // The opacity should be in <0, 100] range. |
| 97 size_t opacity_; | 86 size_t opacity_; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 ScreenlockBridge(); | 156 ScreenlockBridge(); |
| 168 ~ScreenlockBridge(); | 157 ~ScreenlockBridge(); |
| 169 | 158 |
| 170 LockHandler* lock_handler_; // Not owned | 159 LockHandler* lock_handler_; // Not owned |
| 171 ObserverList<Observer, true> observers_; | 160 ObserverList<Observer, true> observers_; |
| 172 | 161 |
| 173 DISALLOW_COPY_AND_ASSIGN(ScreenlockBridge); | 162 DISALLOW_COPY_AND_ASSIGN(ScreenlockBridge); |
| 174 }; | 163 }; |
| 175 | 164 |
| 176 #endif // CHROME_BROWSER_SIGNIN_SCREENLOCK_BRIDGE_H_ | 165 #endif // CHROME_BROWSER_SIGNIN_SCREENLOCK_BRIDGE_H_ |
| OLD | NEW |