Commit 535980d4 authored by amistry@chromium.org's avatar amistry@chromium.org

Add new hotword extension for built-in hotword triggering.

This is just a skeleton of the extension and doesn't have any functionality.

Can't use the existing hotword_helper since this has a hard dependency
on a shared module (which doesn't yet exist).

BUG=397019

Review URL: https://codereview.chromium.org/423083002

Cr-Commit-Position: refs/heads/master@{#288956}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288956 0039d316-1c4b-4281-b951-d872f2087c98
parent e40547e8
...@@ -358,6 +358,7 @@ ...@@ -358,6 +358,7 @@
'hotword': { 'hotword': {
'filepath': 'chrome/browser/extensions/api/hotword_private/'\ 'filepath': 'chrome/browser/extensions/api/hotword_private/'\
'|chrome/browser/resources/hotword_helper/'\ '|chrome/browser/resources/hotword_helper/'\
'|chrome/browser/resources/hotword/'\
'|chrome/browser/search/hotword*'\ '|chrome/browser/search/hotword*'\
'|chrome/test/data/extensions/api_test/hotword_private/', '|chrome/test/data/extensions/api_test/hotword_private/',
}, },
......
...@@ -155,6 +155,7 @@ ...@@ -155,6 +155,7 @@
<include name="IDR_HANGOUT_SERVICES_MANIFEST" file="resources\hangout_services\manifest.json" type="BINDATA" /> <include name="IDR_HANGOUT_SERVICES_MANIFEST" file="resources\hangout_services\manifest.json" type="BINDATA" />
</if> </if>
<include name="IDR_HOTWORD_HELPER_MANIFEST" file="resources\hotword_helper\manifest.json" type="BINDATA" /> <include name="IDR_HOTWORD_HELPER_MANIFEST" file="resources\hotword_helper\manifest.json" type="BINDATA" />
<include name="IDR_HOTWORD_MANIFEST" file="resources\hotword\manifest.json" type="BINDATA" />
<if expr="not is_android"> <if expr="not is_android">
<include name="IDR_HELP_JS" file="resources\help\help.js" flattenhtml="true" type="BINDATA" /> <include name="IDR_HELP_JS" file="resources\help\help.js" flattenhtml="true" type="BINDATA" />
<include name="IDR_HELP_PAGE_JS" file="resources\help\help_page.js" flattenhtml="true" type="BINDATA" /> <include name="IDR_HELP_PAGE_JS" file="resources\help\help_page.js" flattenhtml="true" type="BINDATA" />
......
...@@ -304,8 +304,14 @@ void ComponentLoader::AddHangoutServicesExtension() { ...@@ -304,8 +304,14 @@ void ComponentLoader::AddHangoutServicesExtension() {
void ComponentLoader::AddHotwordHelperExtension() { void ComponentLoader::AddHotwordHelperExtension() {
if (HotwordServiceFactory::IsHotwordAllowed(browser_context_)) { if (HotwordServiceFactory::IsHotwordAllowed(browser_context_)) {
Add(IDR_HOTWORD_HELPER_MANIFEST, CommandLine* command_line = CommandLine::ForCurrentProcess();
base::FilePath(FILE_PATH_LITERAL("hotword_helper"))); if (command_line->HasSwitch(switches::kEnableExperimentalHotwording)) {
Add(IDR_HOTWORD_MANIFEST,
base::FilePath(FILE_PATH_LITERAL("hotword")));
} else {
Add(IDR_HOTWORD_HELPER_MANIFEST,
base::FilePath(FILE_PATH_LITERAL("hotword_helper")));
}
} }
} }
......
...@@ -4,13 +4,19 @@ ...@@ -4,13 +4,19 @@
#include "chrome/browser/extensions/external_component_loader.h" #include "chrome/browser/extensions/external_component_loader.h"
#include "base/command_line.h"
#include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/search/hotword_service_factory.h"
#include "chrome/browser/signin/signin_manager_factory.h" #include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/extension_constants.h"
#include "components/signin/core/browser/signin_manager.h" #include "components/signin/core/browser/signin_manager.h"
// TODO(thestig): Remove after extensions are disabled on mobile.
#if defined(ENABLE_EXTENSIONS)
#include "chrome/browser/search/hotword_service_factory.h"
#endif
namespace { namespace {
bool IsUserSignedin(Profile* profile) { bool IsUserSignedin(Profile* profile) {
...@@ -34,11 +40,18 @@ void ExternalComponentLoader::StartLoading() { ...@@ -34,11 +40,18 @@ void ExternalComponentLoader::StartLoading() {
prefs_->SetString(appId + ".external_update_url", prefs_->SetString(appId + ".external_update_url",
extension_urls::GetWebstoreUpdateUrl().spec()); extension_urls::GetWebstoreUpdateUrl().spec());
#if defined(ENABLE_EXTENSIONS)
if (HotwordServiceFactory::IsHotwordAllowed(profile_)) { if (HotwordServiceFactory::IsHotwordAllowed(profile_)) {
std::string hotwordId = extension_misc::kHotwordExtensionId; std::string hotwordId = extension_misc::kHotwordExtensionId;
prefs_->SetString(hotwordId + ".external_update_url", CommandLine* command_line = CommandLine::ForCurrentProcess();
extension_urls::GetWebstoreUpdateUrl().spec()); // TODO(amistry): Load the hotword shared module when enabling built-in
// hotword detection.
if (!command_line->HasSwitch(switches::kEnableExperimentalHotwording)) {
prefs_->SetString(hotwordId + ".external_update_url",
extension_urls::GetWebstoreUpdateUrl().spec());
}
} }
#endif
UpdateBookmarksExperimentState( UpdateBookmarksExperimentState(
profile_->GetPrefs(), profile_->GetPrefs(),
......
...@@ -58,10 +58,13 @@ ...@@ -58,10 +58,13 @@
<include name="IDR_HANGOUT_SERVICES_BACKGROUND_HTML" file="hangout_services/background.html" type="BINDATA" /> <include name="IDR_HANGOUT_SERVICES_BACKGROUND_HTML" file="hangout_services/background.html" type="BINDATA" />
<include name="IDR_HANGOUT_SERVICES_THUNK_JS" file="hangout_services/thunk.js" type="BINDATA" /> <include name="IDR_HANGOUT_SERVICES_THUNK_JS" file="hangout_services/thunk.js" type="BINDATA" />
</if> </if>
<!-- Hotword Helper extension -->
<if expr="enable_extensions"> <if expr="enable_extensions">
<!-- Hotword Helper extension -->
<include name="IDR_HOTWORD_HELPER_AUDIO_CLIENT_JS" file="hotword_helper/audio_client.js" type="BINDATA" /> <include name="IDR_HOTWORD_HELPER_AUDIO_CLIENT_JS" file="hotword_helper/audio_client.js" type="BINDATA" />
<include name="IDR_HOTWORD_HELPER_MANAGER_JS" file="hotword_helper/manager.js" type="BINDATA" /> <include name="IDR_HOTWORD_HELPER_MANAGER_JS" file="hotword_helper/manager.js" type="BINDATA" />
<!-- (Experimental) hotword triggering extension -->
<include name="IDR_HOTWORD_MANAGER_JS" file="hotword/manager.js" type="BINDATA" />
</if> </if>
<if expr="not is_android"> <if expr="not is_android">
<include name="IDR_FEEDBACK_DEFAULT_HTML" file="feedback/html/default.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" /> <include name="IDR_FEEDBACK_DEFAULT_HTML" file="feedback/html/default.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
......
// Copyright 2014 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.
'use strict';
/**
* @fileoverview This extension provides hotword triggering capabilites to
* Chrome.
*
* This extension contains all the JavaScript for loading and managing the
* hotword detector. The hotword detector and language model data will be
* provided by a shared module loaded from the web store.
*/
{
// Extension ID: nbpagnldghgfoolbancepceaanlmhfmd
"key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDbHXRPiq2De9EJ+4pvNN6uE/D2avxrqyLSpA/Hq3II+btkPl1gboY3oUPTfevpVOFa90Y1c1b3/W682dXqybT0klIvFLKhdQx0LiVqSUQyIaDrwOCSo/ZcukbEwDRojegWymCjHvX6WZk4kKZzTJYzY1vrp0TWKLhttEMN9KFmowIDAQAB",
"name": "Hotword triggering",
"version": "0.0.1.0",
"manifest_version": 2,
"background": {
"scripts": ["manager.js"],
"persistent": false
},
"permissions": [
"*://*.google.com/*",
"chrome://newtab/",
"hotwordPrivate",
"tabs"
],
"externally_connectable": {
"matches": [
"*://*.google.com/*",
"chrome://newtab/"
]
},
"import": [
{
// TODO(amistry): For now, use a locally modified version of the external
// hotword extension. Replace with the ID of the new shared module
// containing the hotword detector.
"id": "bepbmhgboaologfdajaanbcjmnhjmhfn"
}
],
"minimum_chrome_version": "38"
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment