| Index: chrome/browser/ui/ash/ash_keyboard_controller_proxy.cc
|
| diff --git a/chrome/browser/ui/ash/ash_keyboard_controller_proxy.cc b/chrome/browser/ui/ash/ash_keyboard_controller_proxy.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6629b0319531a45ffcd49c7fd513698be4bf9dfa
|
| --- /dev/null
|
| +++ b/chrome/browser/ui/ash/ash_keyboard_controller_proxy.cc
|
| @@ -0,0 +1,54 @@
|
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "chrome/browser/ui/ash/ash_keyboard_controller_proxy.h"
|
| +
|
| +#include "chrome/browser/extensions/extension_prefs.h"
|
| +#include "chrome/browser/extensions/extension_service.h"
|
| +#include "chrome/browser/extensions/extension_system.h"
|
| +#include "chrome/browser/profiles/profile.h"
|
| +#include "chrome/browser/profiles/profile_manager.h"
|
| +#include "chrome/browser/ui/extensions/application_launch.h"
|
| +#include "content/public/browser/web_contents.h"
|
| +#include "content/public/browser/web_contents.h"
|
| +#include "content/public/browser/web_contents_view.h"
|
| +#include "ui/base/window_open_disposition.h"
|
| +#include "ui/keyboard/keyboard_controller.h"
|
| +
|
| +namespace {
|
| +const char kKeyboardExtensionId[] = "mppnpdlheglhdfmldimlhpnegondlapf";
|
| +const char kKeyboardUrl[] =
|
| + "chrome-extension://mppnpdlheglhdfmldimlhpnegondlapf/index.html";
|
| +} // namespace
|
| +
|
| +AshKeyboardControllerProxy::AshKeyboardControllerProxy() {}
|
| +
|
| +AshKeyboardControllerProxy::~AshKeyboardControllerProxy() {}
|
| +
|
| +aura::Window* AshKeyboardControllerProxy::GetKeyboardWindow() {
|
| + if (!keyboard_) {
|
| + Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord();
|
| +
|
| + ExtensionService* service =
|
| + extensions::ExtensionSystem::Get(profile)->extension_service();
|
| + if (!service)
|
| + return NULL;
|
| +
|
| + const extensions::Extension* extension =
|
| + service->GetExtensionById(kKeyboardExtensionId, false);
|
| + if (!extension)
|
| + return NULL;
|
| +
|
| + // TODO(bryeung): this isn't the right way to launch the application.
|
| + chrome::AppLaunchParams params(
|
| + profile,
|
| + extension,
|
| + extension_misc::LAUNCH_WINDOW,
|
| + NEW_FOREGROUND_TAB);
|
| + params.override_url = GURL(kKeyboardUrl);
|
| + keyboard_.reset(chrome::OpenApplication(params));
|
| + }
|
| +
|
| + return keyboard_->GetView()->GetNativeView();
|
| +}
|
|
|