| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/speech/tts_extension_loader_chromeos.h" | 5 #include "chrome/browser/speech/tts_extension_loader_chromeos.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 9 #include "chrome/browser/extensions/component_loader.h" | 9 #include "chrome/browser/extensions/component_loader.h" |
| 10 #include "chrome/browser/extensions/event_router.h" | 10 #include "chrome/browser/extensions/event_router.h" |
| 11 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
| 12 #include "chrome/browser/extensions/extension_system.h" | 12 #include "chrome/browser/extensions/extension_system.h" |
| 13 #include "chrome/browser/profiles/incognito_helpers.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/profiles/profile_dependency_manager.h" | 15 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 15 #include "chrome/browser/profiles/profile_keyed_service.h" | 16 #include "chrome/browser/profiles/profile_keyed_service.h" |
| 16 #include "chrome/browser/profiles/profile_keyed_service_factory.h" | 17 #include "chrome/browser/profiles/profile_keyed_service_factory.h" |
| 17 #include "chrome/browser/speech/extension_api/tts_engine_extension_api.h" | 18 #include "chrome/browser/speech/extension_api/tts_engine_extension_api.h" |
| 18 #include "chrome/browser/speech/tts_controller.h" | 19 #include "chrome/browser/speech/tts_controller.h" |
| 19 #include "chrome/common/extensions/extension_constants.h" | 20 #include "chrome/common/extensions/extension_constants.h" |
| 20 #include "grit/browser_resources.h" | 21 #include "grit/browser_resources.h" |
| 21 | 22 |
| 22 // Factory to load one instance of TtsExtensionLoaderChromeOs per profile. | 23 // Factory to load one instance of TtsExtensionLoaderChromeOs per profile. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 34 private: | 35 private: |
| 35 friend struct DefaultSingletonTraits<TtsExtensionLoaderChromeOsFactory>; | 36 friend struct DefaultSingletonTraits<TtsExtensionLoaderChromeOsFactory>; |
| 36 | 37 |
| 37 TtsExtensionLoaderChromeOsFactory() : ProfileKeyedServiceFactory( | 38 TtsExtensionLoaderChromeOsFactory() : ProfileKeyedServiceFactory( |
| 38 "TtsExtensionLoaderChromeOs", | 39 "TtsExtensionLoaderChromeOs", |
| 39 ProfileDependencyManager::GetInstance()) | 40 ProfileDependencyManager::GetInstance()) |
| 40 {} | 41 {} |
| 41 | 42 |
| 42 virtual ~TtsExtensionLoaderChromeOsFactory() {} | 43 virtual ~TtsExtensionLoaderChromeOsFactory() {} |
| 43 | 44 |
| 44 virtual bool ServiceRedirectedInIncognito() const OVERRIDE { | 45 virtual content::BrowserContext* GetBrowserContextToUse( |
| 46 content::BrowserContext* context) const OVERRIDE{ |
| 45 // If given an incognito profile (including the Chrome OS login | 47 // If given an incognito profile (including the Chrome OS login |
| 46 // profile), share the service with the original profile. | 48 // profile), share the service with the original profile. |
| 47 return true; | 49 return chrome::GetBrowserContextRedirectedInIncognito(context); |
| 48 } | 50 } |
| 49 | 51 |
| 50 virtual ProfileKeyedService* BuildServiceInstanceFor( | 52 virtual ProfileKeyedService* BuildServiceInstanceFor( |
| 51 content::BrowserContext* profile) const OVERRIDE { | 53 content::BrowserContext* profile) const OVERRIDE { |
| 52 return new TtsExtensionLoaderChromeOs(static_cast<Profile*>(profile)); | 54 return new TtsExtensionLoaderChromeOs(static_cast<Profile*>(profile)); |
| 53 } | 55 } |
| 54 }; | 56 }; |
| 55 | 57 |
| 56 TtsExtensionLoaderChromeOs* | 58 TtsExtensionLoaderChromeOs* |
| 57 TtsExtensionLoaderChromeOs::GetInstance(Profile* profile) { | 59 TtsExtensionLoaderChromeOs::GetInstance(Profile* profile) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 116 |
| 115 if (!IsTtsLoadedInThisProfile()) | 117 if (!IsTtsLoadedInThisProfile()) |
| 116 return; | 118 return; |
| 117 | 119 |
| 118 if (tts_state_ == TTS_LOADING) { | 120 if (tts_state_ == TTS_LOADING) { |
| 119 LOG(INFO) << "TTS component extension loaded, retrying queued utterances."; | 121 LOG(INFO) << "TTS component extension loaded, retrying queued utterances."; |
| 120 tts_state_ = TTS_LOADED; | 122 tts_state_ = TTS_LOADED; |
| 121 TtsController::GetInstance()->RetrySpeakingQueuedUtterances(); | 123 TtsController::GetInstance()->RetrySpeakingQueuedUtterances(); |
| 122 } | 124 } |
| 123 } | 125 } |
| OLD | NEW |