| 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/search/hotword_service.h" | 5 #include "chrome/browser/search/hotword_service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 user_manager::UserManager::Get()->AddSessionStateObserver( | 395 user_manager::UserManager::Get()->AddSessionStateObserver( |
| 396 session_observer_.get()); | 396 session_observer_.get()); |
| 397 } | 397 } |
| 398 #endif | 398 #endif |
| 399 | 399 |
| 400 // Register with the device observer list to update the microphone | 400 // Register with the device observer list to update the microphone |
| 401 // availability. | 401 // availability. |
| 402 content::BrowserThread::PostTask( | 402 content::BrowserThread::PostTask( |
| 403 content::BrowserThread::UI, FROM_HERE, | 403 content::BrowserThread::UI, FROM_HERE, |
| 404 base::Bind(&HotwordService::InitializeMicrophoneObserver, | 404 base::Bind(&HotwordService::InitializeMicrophoneObserver, |
| 405 base::Unretained(this))); | 405 weak_factory_.GetWeakPtr())); |
| 406 } | 406 } |
| 407 | 407 |
| 408 HotwordService::~HotwordService() { | 408 HotwordService::~HotwordService() { |
| 409 #if defined(OS_CHROMEOS) | 409 #if defined(OS_CHROMEOS) |
| 410 if (user_manager::UserManager::IsInitialized() && session_observer_) { | 410 if (user_manager::UserManager::IsInitialized() && session_observer_) { |
| 411 user_manager::UserManager::Get()->RemoveSessionStateObserver( | 411 user_manager::UserManager::Get()->RemoveSessionStateObserver( |
| 412 session_observer_.get()); | 412 session_observer_.get()); |
| 413 } | 413 } |
| 414 #endif | 414 #endif |
| 415 } | 415 } |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 // Only support multiple profiles and profile switching in ChromeOS. | 875 // Only support multiple profiles and profile switching in ChromeOS. |
| 876 if (user_manager::UserManager::IsInitialized()) { | 876 if (user_manager::UserManager::IsInitialized()) { |
| 877 user_manager::User* user = | 877 user_manager::User* user = |
| 878 user_manager::UserManager::Get()->GetActiveUser(); | 878 user_manager::UserManager::Get()->GetActiveUser(); |
| 879 if (user && user->is_profile_created()) | 879 if (user && user->is_profile_created()) |
| 880 return profile_ == ProfileManager::GetActiveUserProfile(); | 880 return profile_ == ProfileManager::GetActiveUserProfile(); |
| 881 } | 881 } |
| 882 #endif | 882 #endif |
| 883 return true; | 883 return true; |
| 884 } | 884 } |
| OLD | NEW |