| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/api/braille_display_private/braille_display_
private_api.h" | 5 #include "chrome/browser/extensions/api/braille_display_private/braille_display_
private_api.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "chrome/browser/extensions/api/braille_display_private/braille_controll
er.h" | 8 #include "chrome/browser/extensions/api/braille_display_private/braille_controll
er.h" |
| 9 #include "chrome/browser/extensions/extension_system.h" | 9 #include "chrome/browser/extensions/extension_system.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 scoped_ptr<Event> event(new Event( | 75 scoped_ptr<Event> event(new Event( |
| 76 OnKeyEvent::kEventName, OnKeyEvent::Create(key_event))); | 76 OnKeyEvent::kEventName, OnKeyEvent::Create(key_event))); |
| 77 event_delegate_->BroadcastEvent(event.Pass()); | 77 event_delegate_->BroadcastEvent(event.Pass()); |
| 78 } | 78 } |
| 79 | 79 |
| 80 bool BrailleDisplayPrivateAPI::IsProfileActive() { | 80 bool BrailleDisplayPrivateAPI::IsProfileActive() { |
| 81 #if defined(OS_CHROMEOS) | 81 #if defined(OS_CHROMEOS) |
| 82 Profile* active_profile; | 82 Profile* active_profile; |
| 83 chromeos::ScreenLocker* screen_locker = | 83 chromeos::ScreenLocker* screen_locker = |
| 84 chromeos::ScreenLocker::default_screen_locker(); | 84 chromeos::ScreenLocker::default_screen_locker(); |
| 85 if (screen_locker && screen_locker->locked()) | 85 if (screen_locker && screen_locker->locked()) { |
| 86 active_profile = chromeos::ProfileHelper::GetSigninProfile(); | 86 active_profile = chromeos::ProfileHelper::GetSigninProfile(); |
| 87 else | 87 } else { |
| 88 active_profile = ProfileManager::GetDefaultProfile(); | 88 // Since we are creating one instance per profile / user, we should be fine |
| 89 // comparing against the active user. That said - if we ever change that, |
| 90 // this code will need to be changed. |
| 91 active_profile = ProfileManager::GetActiveUserProfile(); |
| 92 } |
| 89 return profile_->IsSameProfile(active_profile); | 93 return profile_->IsSameProfile(active_profile); |
| 90 #else // !defined(OS_CHROMEOS) | 94 #else // !defined(OS_CHROMEOS) |
| 91 return true; | 95 return true; |
| 92 #endif | 96 #endif |
| 93 } | 97 } |
| 94 | 98 |
| 95 void BrailleDisplayPrivateAPI::SetEventDelegateForTest( | 99 void BrailleDisplayPrivateAPI::SetEventDelegateForTest( |
| 96 scoped_ptr<EventDelegate> delegate) { | 100 scoped_ptr<EventDelegate> delegate) { |
| 97 event_delegate_ = delegate.Pass(); | 101 event_delegate_ = delegate.Pass(); |
| 98 } | 102 } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 170 |
| 167 void BrailleDisplayPrivateWriteDotsFunction::Work() { | 171 void BrailleDisplayPrivateWriteDotsFunction::Work() { |
| 168 BrailleController::GetInstance()->WriteDots(params_->cells); | 172 BrailleController::GetInstance()->WriteDots(params_->cells); |
| 169 } | 173 } |
| 170 | 174 |
| 171 bool BrailleDisplayPrivateWriteDotsFunction::Respond() { | 175 bool BrailleDisplayPrivateWriteDotsFunction::Respond() { |
| 172 return true; | 176 return true; |
| 173 } | 177 } |
| 174 } // namespace api | 178 } // namespace api |
| 175 } // namespace extensions | 179 } // namespace extensions |
| OLD | NEW |