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/extensions/extension_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 #include "chrome/browser/chromeos/extensions/bluetooth_event_router.h" | 116 #include "chrome/browser/chromeos/extensions/bluetooth_event_router.h" |
117 #include "chrome/browser/chromeos/extensions/file_browser_event_router.h" | 117 #include "chrome/browser/chromeos/extensions/file_browser_event_router.h" |
118 #include "chrome/browser/chromeos/extensions/input_method_event_router.h" | 118 #include "chrome/browser/chromeos/extensions/input_method_event_router.h" |
119 #include "chrome/browser/chromeos/extensions/media_player_event_router.h" | 119 #include "chrome/browser/chromeos/extensions/media_player_event_router.h" |
120 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 120 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
121 #include "chrome/browser/extensions/extension_input_ime_api.h" | 121 #include "chrome/browser/extensions/extension_input_ime_api.h" |
122 #include "webkit/fileapi/file_system_context.h" | 122 #include "webkit/fileapi/file_system_context.h" |
123 #include "webkit/fileapi/file_system_mount_point_provider.h" | 123 #include "webkit/fileapi/file_system_mount_point_provider.h" |
124 #endif | 124 #endif |
125 | 125 |
126 #if defined(OS_CHROMEOS) && defined(USE_VIRTUAL_KEYBOARD) | |
127 #include "chrome/browser/extensions/extension_input_ui_api.h" | |
128 #endif | |
129 | |
130 using base::Time; | 126 using base::Time; |
131 using content::BrowserContext; | 127 using content::BrowserContext; |
132 using content::BrowserThread; | 128 using content::BrowserThread; |
133 using content::DevToolsAgentHost; | 129 using content::DevToolsAgentHost; |
134 using content::DevToolsAgentHostRegistry; | 130 using content::DevToolsAgentHostRegistry; |
135 using content::PluginService; | 131 using content::PluginService; |
136 using extensions::Extension; | 132 using extensions::Extension; |
137 using extensions::ExtensionIdSet; | 133 using extensions::ExtensionIdSet; |
138 using extensions::ExtensionInfo; | 134 using extensions::ExtensionInfo; |
139 using extensions::UnloadedExtensionInfo; | 135 using extensions::UnloadedExtensionInfo; |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 | 508 |
513 bluetooth_event_router_.reset( | 509 bluetooth_event_router_.reset( |
514 new chromeos::ExtensionBluetoothEventRouter(profile_)); | 510 new chromeos::ExtensionBluetoothEventRouter(profile_)); |
515 | 511 |
516 input_method_event_router_.reset( | 512 input_method_event_router_.reset( |
517 new chromeos::ExtensionInputMethodEventRouter); | 513 new chromeos::ExtensionInputMethodEventRouter); |
518 | 514 |
519 ExtensionMediaPlayerEventRouter::GetInstance()->Init(profile_); | 515 ExtensionMediaPlayerEventRouter::GetInstance()->Init(profile_); |
520 ExtensionInputImeEventRouter::GetInstance()->Init(); | 516 ExtensionInputImeEventRouter::GetInstance()->Init(); |
521 #endif | 517 #endif |
522 | |
523 #if defined(OS_CHROMEOS) && defined(USE_VIRTUAL_KEYBOARD) | |
524 ExtensionInputUiEventRouter::GetInstance()->Init(); | |
525 #endif | |
526 | |
527 #endif // defined(ENABLE_EXTENSIONS) | 518 #endif // defined(ENABLE_EXTENSIONS) |
528 event_routers_initialized_ = true; | 519 event_routers_initialized_ = true; |
529 } | 520 } |
530 | 521 |
531 const Extension* ExtensionService::GetExtensionById( | 522 const Extension* ExtensionService::GetExtensionById( |
532 const std::string& id, bool include_disabled) const { | 523 const std::string& id, bool include_disabled) const { |
533 return GetExtensionByIdInternal(id, true, include_disabled, false); | 524 return GetExtensionByIdInternal(id, true, include_disabled, false); |
534 } | 525 } |
535 | 526 |
536 void ExtensionService::Init() { | 527 void ExtensionService::Init() { |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 | 1029 |
1039 #if defined(OS_CHROMEOS) | 1030 #if defined(OS_CHROMEOS) |
1040 for (std::vector<Extension::InputComponentInfo>::const_iterator component = | 1031 for (std::vector<Extension::InputComponentInfo>::const_iterator component = |
1041 extension->input_components().begin(); | 1032 extension->input_components().begin(); |
1042 component != extension->input_components().end(); | 1033 component != extension->input_components().end(); |
1043 ++component) { | 1034 ++component) { |
1044 if (component->type == Extension::INPUT_COMPONENT_TYPE_IME) { | 1035 if (component->type == Extension::INPUT_COMPONENT_TYPE_IME) { |
1045 ExtensionInputImeEventRouter::GetInstance()->RegisterIme( | 1036 ExtensionInputImeEventRouter::GetInstance()->RegisterIme( |
1046 profile_, extension->id(), *component); | 1037 profile_, extension->id(), *component); |
1047 } | 1038 } |
1048 #if defined(USE_VIRTUAL_KEYBOARD) | |
1049 if (component->type == Extension::INPUT_COMPONENT_TYPE_VIRTUAL_KEYBOARD && | |
1050 !component->layouts.empty()) { | |
1051 chromeos::input_method::InputMethodManager* input_method_manager = | |
1052 chromeos::input_method::InputMethodManager::GetInstance(); | |
1053 const bool is_system_keyboard = | |
1054 extension->location() == Extension::COMPONENT; | |
1055 input_method_manager->RegisterVirtualKeyboard( | |
1056 extension->url(), | |
1057 component->name, // human-readable name of the keyboard extension. | |
1058 component->layouts, | |
1059 is_system_keyboard); | |
1060 } | |
1061 #endif | |
1062 } | 1039 } |
1063 #endif | 1040 #endif |
1064 } | 1041 } |
1065 | 1042 |
1066 void ExtensionService::NotifyExtensionUnloaded( | 1043 void ExtensionService::NotifyExtensionUnloaded( |
1067 const Extension* extension, | 1044 const Extension* extension, |
1068 extension_misc::UnloadedExtensionReason reason) { | 1045 extension_misc::UnloadedExtensionReason reason) { |
1069 UnloadedExtensionInfo details(extension, reason); | 1046 UnloadedExtensionInfo details(extension, reason); |
1070 content::NotificationService::current()->Notify( | 1047 content::NotificationService::current()->Notify( |
1071 chrome::NOTIFICATION_EXTENSION_UNLOADED, | 1048 chrome::NOTIFICATION_EXTENSION_UNLOADED, |
(...skipping 1508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2580 // To coexist with certain unit tests that don't have an IO thread message | 2557 // To coexist with certain unit tests that don't have an IO thread message |
2581 // loop available at ExtensionService shutdown, we lazy-initialize this | 2558 // loop available at ExtensionService shutdown, we lazy-initialize this |
2582 // object so that those cases neither create nor destroy an | 2559 // object so that those cases neither create nor destroy an |
2583 // APIResourceController. | 2560 // APIResourceController. |
2584 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 2561 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
2585 if (!api_resource_controller_) { | 2562 if (!api_resource_controller_) { |
2586 api_resource_controller_ = new extensions::APIResourceController(); | 2563 api_resource_controller_ = new extensions::APIResourceController(); |
2587 } | 2564 } |
2588 return api_resource_controller_; | 2565 return api_resource_controller_; |
2589 } | 2566 } |
OLD | NEW |