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/speech/extension_api/tts_engine_extension_observer.h" | 5 #include "chrome/browser/speech/extension_api/tts_engine_extension_observer.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/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/extensions/extension_system_factory.h" | 10 #include "chrome/browser/extensions/extension_system_factory.h" |
11 #include "chrome/browser/profiles/incognito_helpers.h" | 11 #include "chrome/browser/profiles/incognito_helpers.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/speech/extension_api/tts_engine_extension_api.h" | 13 #include "chrome/browser/speech/extension_api/tts_engine_extension_api.h" |
14 #include "chrome/browser/speech/tts_controller.h" | 14 #include "chrome/browser/speech/tts_controller.h" |
15 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 15 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
16 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" | 16 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" |
17 #include "components/keyed_service/core/keyed_service.h" | 17 #include "components/keyed_service/core/keyed_service.h" |
18 #include "extensions/browser/event_router.h" | 18 #include "extensions/browser/event_router.h" |
19 #include "extensions/browser/extension_system.h" | 19 #include "extensions/browser/extension_system.h" |
20 #include "grit/browser_resources.h" | |
21 | 20 |
22 // Factory to load one instance of TtsExtensionLoaderChromeOs per profile. | 21 // Factory to load one instance of TtsExtensionLoaderChromeOs per profile. |
23 class TtsEngineExtensionObserverFactory | 22 class TtsEngineExtensionObserverFactory |
24 : public BrowserContextKeyedServiceFactory { | 23 : public BrowserContextKeyedServiceFactory { |
25 public: | 24 public: |
26 static TtsEngineExtensionObserver* GetForProfile(Profile* profile) { | 25 static TtsEngineExtensionObserver* GetForProfile(Profile* profile) { |
27 return static_cast<TtsEngineExtensionObserver*>( | 26 return static_cast<TtsEngineExtensionObserver*>( |
28 GetInstance()->GetServiceForBrowserContext(profile, true)); | 27 GetInstance()->GetServiceForBrowserContext(profile, true)); |
29 } | 28 } |
30 | 29 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 void TtsEngineExtensionObserver::OnExtensionUnloaded( | 124 void TtsEngineExtensionObserver::OnExtensionUnloaded( |
126 content::BrowserContext* browser_context, | 125 content::BrowserContext* browser_context, |
127 const extensions::Extension* extension, | 126 const extensions::Extension* extension, |
128 extensions::UnloadedExtensionInfo::Reason reason) { | 127 extensions::UnloadedExtensionInfo::Reason reason) { |
129 if (engine_extension_ids_.find(extension->id()) != | 128 if (engine_extension_ids_.find(extension->id()) != |
130 engine_extension_ids_.end()) { | 129 engine_extension_ids_.end()) { |
131 engine_extension_ids_.erase(extension->id()); | 130 engine_extension_ids_.erase(extension->id()); |
132 TtsController::GetInstance()->VoicesChanged(); | 131 TtsController::GetInstance()->VoicesChanged(); |
133 } | 132 } |
134 } | 133 } |
OLD | NEW |