| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 result->SetString("id", icon_id); | 68 result->SetString("id", icon_id); |
| 69 | 69 |
| 70 if (!tooltip_.empty()) { | 70 if (!tooltip_.empty()) { |
| 71 base::DictionaryValue* tooltip_options = new base::DictionaryValue(); | 71 base::DictionaryValue* tooltip_options = new base::DictionaryValue(); |
| 72 tooltip_options->SetString("text", tooltip_); | 72 tooltip_options->SetString("text", tooltip_); |
| 73 tooltip_options->SetBoolean("autoshow", autoshow_tooltip_); | 73 tooltip_options->SetBoolean("autoshow", autoshow_tooltip_); |
| 74 result->Set("tooltip", tooltip_options); | 74 result->Set("tooltip", tooltip_options); |
| 75 } | 75 } |
| 76 | 76 |
| 77 if (!aria_label_.empty()) |
| 78 result->SetString("ariaLabel", aria_label_); |
| 79 |
| 77 if (hardlock_on_click_) | 80 if (hardlock_on_click_) |
| 78 result->SetBoolean("hardlockOnClick", true); | 81 result->SetBoolean("hardlockOnClick", true); |
| 79 | 82 |
| 80 return result.Pass(); | 83 return result.Pass(); |
| 81 } | 84 } |
| 82 | 85 |
| 83 void ScreenlockBridge::UserPodCustomIconOptions::SetIcon( | 86 void ScreenlockBridge::UserPodCustomIconOptions::SetIcon( |
| 84 ScreenlockBridge::UserPodCustomIcon icon) { | 87 ScreenlockBridge::UserPodCustomIcon icon) { |
| 85 icon_ = icon; | 88 icon_ = icon; |
| 86 } | 89 } |
| 87 | 90 |
| 88 void ScreenlockBridge::UserPodCustomIconOptions::SetTooltip( | 91 void ScreenlockBridge::UserPodCustomIconOptions::SetTooltip( |
| 89 const base::string16& tooltip, | 92 const base::string16& tooltip, |
| 90 bool autoshow) { | 93 bool autoshow) { |
| 91 tooltip_ = tooltip; | 94 tooltip_ = tooltip; |
| 92 autoshow_tooltip_ = autoshow; | 95 autoshow_tooltip_ = autoshow; |
| 93 } | 96 } |
| 94 | 97 |
| 98 void ScreenlockBridge::UserPodCustomIconOptions::SetAriaLabel( |
| 99 const base::string16& aria_label) { |
| 100 aria_label_ = aria_label; |
| 101 } |
| 102 |
| 95 void ScreenlockBridge::UserPodCustomIconOptions::SetHardlockOnClick() { | 103 void ScreenlockBridge::UserPodCustomIconOptions::SetHardlockOnClick() { |
| 96 hardlock_on_click_ = true; | 104 hardlock_on_click_ = true; |
| 97 } | 105 } |
| 98 | 106 |
| 99 // static | 107 // static |
| 100 std::string ScreenlockBridge::GetAuthenticatedUserEmail(Profile* profile) { | 108 std::string ScreenlockBridge::GetAuthenticatedUserEmail(Profile* profile) { |
| 101 // |profile| has to be a signed-in profile with SigninManager already | 109 // |profile| has to be a signed-in profile with SigninManager already |
| 102 // created. Otherwise, just crash to collect stack. | 110 // created. Otherwise, just crash to collect stack. |
| 103 SigninManagerBase* signin_manager = | 111 SigninManagerBase* signin_manager = |
| 104 SigninManagerFactory::GetForProfileIfExists(profile); | 112 SigninManagerFactory::GetForProfileIfExists(profile); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 lock_handler_->Unlock(GetAuthenticatedUserEmail(profile)); | 154 lock_handler_->Unlock(GetAuthenticatedUserEmail(profile)); |
| 147 } | 155 } |
| 148 | 156 |
| 149 void ScreenlockBridge::AddObserver(Observer* observer) { | 157 void ScreenlockBridge::AddObserver(Observer* observer) { |
| 150 observers_.AddObserver(observer); | 158 observers_.AddObserver(observer); |
| 151 } | 159 } |
| 152 | 160 |
| 153 void ScreenlockBridge::RemoveObserver(Observer* observer) { | 161 void ScreenlockBridge::RemoveObserver(Observer* observer) { |
| 154 observers_.RemoveObserver(observer); | 162 observers_.RemoveObserver(observer); |
| 155 } | 163 } |
| OLD | NEW |