| 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 #include "chrome/browser/signin/screenlock_bridge.h" | 5 #include "chrome/browser/signin/screenlock_bridge.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "chrome/browser/profiles/profile_window.h" | 9 #include "chrome/browser/profiles/profile_window.h" |
| 10 #include "chrome/browser/signin/signin_manager_factory.h" | 10 #include "chrome/browser/signin/signin_manager_factory.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 return g_screenlock_bridge_bridge_instance.Pointer(); | 30 return g_screenlock_bridge_bridge_instance.Pointer(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 ScreenlockBridge::UserPodCustomIconOptions::UserPodCustomIconOptions() | 33 ScreenlockBridge::UserPodCustomIconOptions::UserPodCustomIconOptions() |
| 34 : width_(0u), | 34 : width_(0u), |
| 35 height_(0u), | 35 height_(0u), |
| 36 animation_set_(false), | 36 animation_set_(false), |
| 37 animation_resource_width_(0u), | 37 animation_resource_width_(0u), |
| 38 animation_frame_length_ms_(0u), | 38 animation_frame_length_ms_(0u), |
| 39 opacity_(100u), | 39 opacity_(100u), |
| 40 autoshow_tooltip_(false) { | 40 autoshow_tooltip_(false), |
| 41 hardlock_on_click_(false) { |
| 41 } | 42 } |
| 42 | 43 |
| 43 ScreenlockBridge::UserPodCustomIconOptions::~UserPodCustomIconOptions() {} | 44 ScreenlockBridge::UserPodCustomIconOptions::~UserPodCustomIconOptions() {} |
| 44 | 45 |
| 45 scoped_ptr<base::DictionaryValue> | 46 scoped_ptr<base::DictionaryValue> |
| 46 ScreenlockBridge::UserPodCustomIconOptions::ToDictionaryValue() const { | 47 ScreenlockBridge::UserPodCustomIconOptions::ToDictionaryValue() const { |
| 47 scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue()); | 48 scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue()); |
| 48 if (!icon_image_ && icon_resource_url_.empty()) | 49 if (!icon_image_ && icon_resource_url_.empty()) |
| 49 return result.Pass(); | 50 return result.Pass(); |
| 50 | 51 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 79 result->SetInteger("opacity", opacity_); | 80 result->SetInteger("opacity", opacity_); |
| 80 | 81 |
| 81 if (animation_set_) { | 82 if (animation_set_) { |
| 82 base::DictionaryValue* animation = new base::DictionaryValue(); | 83 base::DictionaryValue* animation = new base::DictionaryValue(); |
| 83 animation->SetInteger("resourceWidth", | 84 animation->SetInteger("resourceWidth", |
| 84 animation_resource_width_); | 85 animation_resource_width_); |
| 85 animation->SetInteger("frameLengthMs", | 86 animation->SetInteger("frameLengthMs", |
| 86 animation_frame_length_ms_); | 87 animation_frame_length_ms_); |
| 87 result->Set("animation", animation); | 88 result->Set("animation", animation); |
| 88 } | 89 } |
| 90 |
| 91 if (hardlock_on_click_) |
| 92 result->SetBoolean("hardlockOnClick", true); |
| 93 |
| 89 return result.Pass(); | 94 return result.Pass(); |
| 90 } | 95 } |
| 91 | 96 |
| 92 void ScreenlockBridge::UserPodCustomIconOptions::SetIconAsResourceURL( | 97 void ScreenlockBridge::UserPodCustomIconOptions::SetIconAsResourceURL( |
| 93 const std::string& url) { | 98 const std::string& url) { |
| 94 DCHECK(!icon_image_); | 99 DCHECK(!icon_image_); |
| 95 | 100 |
| 96 icon_resource_url_ = url; | 101 icon_resource_url_ = url; |
| 97 } | 102 } |
| 98 | 103 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 123 opacity_ = opacity; | 128 opacity_ = opacity; |
| 124 } | 129 } |
| 125 | 130 |
| 126 void ScreenlockBridge::UserPodCustomIconOptions::SetTooltip( | 131 void ScreenlockBridge::UserPodCustomIconOptions::SetTooltip( |
| 127 const base::string16& tooltip, | 132 const base::string16& tooltip, |
| 128 bool autoshow) { | 133 bool autoshow) { |
| 129 tooltip_ = tooltip; | 134 tooltip_ = tooltip; |
| 130 autoshow_tooltip_ = autoshow; | 135 autoshow_tooltip_ = autoshow; |
| 131 } | 136 } |
| 132 | 137 |
| 138 void ScreenlockBridge::UserPodCustomIconOptions::SetHardlockOnClick() { |
| 139 hardlock_on_click_ = true; |
| 140 } |
| 141 |
| 133 // static | 142 // static |
| 134 std::string ScreenlockBridge::GetAuthenticatedUserEmail(Profile* profile) { | 143 std::string ScreenlockBridge::GetAuthenticatedUserEmail(Profile* profile) { |
| 135 // |profile| has to be a signed-in profile with SigninManager already | 144 // |profile| has to be a signed-in profile with SigninManager already |
| 136 // created. Otherwise, just crash to collect stack. | 145 // created. Otherwise, just crash to collect stack. |
| 137 SigninManagerBase* signin_manager = | 146 SigninManagerBase* signin_manager = |
| 138 SigninManagerFactory::GetForProfileIfExists(profile); | 147 SigninManagerFactory::GetForProfileIfExists(profile); |
| 139 return signin_manager->GetAuthenticatedUsername(); | 148 return signin_manager->GetAuthenticatedUsername(); |
| 140 } | 149 } |
| 141 | 150 |
| 142 ScreenlockBridge::ScreenlockBridge() : lock_handler_(NULL) { | 151 ScreenlockBridge::ScreenlockBridge() : lock_handler_(NULL) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 173 lock_handler_->Unlock(GetAuthenticatedUserEmail(profile)); | 182 lock_handler_->Unlock(GetAuthenticatedUserEmail(profile)); |
| 174 } | 183 } |
| 175 | 184 |
| 176 void ScreenlockBridge::AddObserver(Observer* observer) { | 185 void ScreenlockBridge::AddObserver(Observer* observer) { |
| 177 observers_.AddObserver(observer); | 186 observers_.AddObserver(observer); |
| 178 } | 187 } |
| 179 | 188 |
| 180 void ScreenlockBridge::RemoveObserver(Observer* observer) { | 189 void ScreenlockBridge::RemoveObserver(Observer* observer) { |
| 181 observers_.RemoveObserver(observer); | 190 observers_.RemoveObserver(observer); |
| 182 } | 191 } |
| OLD | NEW |