OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/ui/ash/ash_virtual_keyboard_controller_proxy.h" | |
6 | |
7 #include "chrome/browser/extensions/extension_prefs.h" | |
8 #include "chrome/browser/extensions/extension_service.h" | |
9 #include "chrome/browser/extensions/extension_system.h" | |
10 #include "chrome/browser/profiles/profile.h" | |
11 #include "chrome/browser/profiles/profile_manager.h" | |
12 #include "chrome/browser/ui/extensions/application_launch.h" | |
13 #include "content/public/browser/web_contents.h" | |
14 #include "content/public/browser/web_contents.h" | |
15 #include "content/public/browser/web_contents_view.h" | |
16 #include "ui/base/window_open_disposition.h" | |
17 #include "ui/virtual_keyboard/virtual_keyboard_controller.h" | |
18 | |
19 namespace { | |
20 const char kVirtualKeyboardExtensionId[] = "mppnpdlheglhdfmldimlhpnegondlapf"; | |
21 const char kVirtualKeyboardUrl[] = "chrome-extension://mppnpdlheglhdfmldimlhpneg ondlapf/index.html"; | |
sadrul
2013/03/28 19:17:00
break after =
bryeung
2013/04/02 15:56:53
Done.
| |
22 } // namespace | |
23 | |
24 AshVirtualKeyboardControllerProxy::AshVirtualKeyboardControllerProxy() {} | |
25 | |
26 AshVirtualKeyboardControllerProxy::~AshVirtualKeyboardControllerProxy() {} | |
27 | |
28 aura::Window* AshVirtualKeyboardControllerProxy::GetVirtualKeyboard() { | |
29 if (!keyboard_) { | |
30 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); | |
31 | |
32 ExtensionService* service = | |
33 extensions::ExtensionSystem::Get(profile)->extension_service(); | |
34 if (!service) | |
35 return NULL; | |
36 | |
37 const extensions::Extension* extension = | |
38 service->GetExtensionById(kVirtualKeyboardExtensionId, false); | |
39 if (!extension) | |
40 return NULL; | |
41 | |
42 chrome::AppLaunchParams params( | |
43 profile, | |
44 extension, | |
45 extension_misc::LAUNCH_WINDOW, | |
46 NEW_FOREGROUND_TAB); | |
47 params.override_url = GURL(kVirtualKeyboardUrl); | |
48 keyboard_.reset(chrome::OpenApplication(params)); | |
49 } | |
50 | |
51 return keyboard_->GetView()->GetNativeView(); | |
52 } | |
OLD | NEW |