Commit 2d638734 authored by dgozman@chromium.org's avatar dgozman@chromium.org

Support for component extensions as apps on the new tab page. Added filebrowser.

BUG=chromium-os:14543
TEST=File Manager should be on NTP.
Review URL: http://codereview.chromium.org/6912024

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86621 0039d316-1c4b-4281-b951-d872f2087c98
parent c64591b4
......@@ -15,6 +15,11 @@
"chrome://extension-icon/",
"chrome://resources/"
],
"app": {
"launch": {
"local_path": "main.html"
}
},
"file_browser_handlers": [
{
"id": "preview",
......
......@@ -705,11 +705,13 @@ var apps = (function() {
img.onload = function() { this.loadedImages++; }.bind(this);
img.src = app['icon_big'];
// User cannot change launch options or uninstall component extension.
if (!app['is_component']) {
var settingsButton = div.appendChild(new cr.ui.ContextMenuButton);
settingsButton.className = 'app-settings';
settingsButton.title = localStrings.getString('appsettings');
addContextMenu(div, app);
}
return div;
},
......@@ -728,7 +730,10 @@ var apps = (function() {
a.className = 'item';
span.appendChild(a);
// User cannot change launch options or uninstall component extension.
if (!app['is_component']) {
addContextMenu(span, app);
}
return span;
},
......@@ -744,7 +749,10 @@ var apps = (function() {
a.style.backgroundImage = url(app['icon_small']);
a.className = 'item';
// User cannot change launch options or uninstall component extension.
if (!app['is_component']) {
addContextMenu(a, app);
}
return a;
},
......
......@@ -47,6 +47,8 @@ const char* kPingLaunchAppByID = "record-app-launch-by-id";
const char* kPingLaunchWebStore = "record-webstore-launch";
const char* kPingLaunchAppByURL = "record-app-launch-by-url";
const char* kChromeWebStoreUrl = "https://chrome.google.com/webstore";
const UnescapeRule::Type kUnescapeRules =
UnescapeRule::NORMAL | UnescapeRule::URL_SPECIAL_CHARS;
......@@ -103,6 +105,8 @@ void AppLauncherHandler::CreateAppInfo(const Extension* extension,
value->SetInteger("launch_type",
prefs->GetLaunchType(extension->id(),
ExtensionPrefs::LAUNCH_DEFAULT));
value->SetBoolean("is_component",
extension->location() == Extension::COMPONENT);
int app_launch_index = prefs->GetAppLaunchIndex(extension->id());
if (app_launch_index == -1) {
......@@ -221,9 +225,10 @@ void AppLauncherHandler::FillAppDictionary(DictionaryValue* dictionary) {
const ExtensionList* extensions = extensions_service_->extensions();
ExtensionList::const_iterator it;
for (it = extensions->begin(); it != extensions->end(); ++it) {
// Don't include the WebStore and other component apps.
// Don't include the WebStore.
// The WebStore launcher gets special treatment in ntp/apps.js.
if ((*it)->is_app() && (*it)->location() != Extension::COMPONENT) {
if ((*it)->is_app() &&
(*it)->GetFullLaunchURL().spec() != kChromeWebStoreUrl) {
DictionaryValue* app_info = new DictionaryValue();
CreateAppInfo(*it, extensions_service_->extension_prefs(), app_info);
list->Append(app_info);
......@@ -232,7 +237,8 @@ void AppLauncherHandler::FillAppDictionary(DictionaryValue* dictionary) {
extensions = extensions_service_->disabled_extensions();
for (it = extensions->begin(); it != extensions->end(); ++it) {
if ((*it)->is_app() && (*it)->location() != Extension::COMPONENT) {
if ((*it)->is_app() &&
(*it)->GetFullLaunchURL().spec() != kChromeWebStoreUrl) {
DictionaryValue* app_info = new DictionaryValue();
CreateAppInfo(*it, extensions_service_->extension_prefs(), app_info);
list->Append(app_info);
......
......@@ -19,6 +19,7 @@ class NTPTest(pyauto.PyUITest):
]
if pyauto.PyUITest.IsChromeOS():
_EXPECTED_DEFAULT_APPS.append({u'name': u'Get Started'})
_EXPECTED_DEFAULT_APPS.append({u'name': u'File Manager'})
# Default menu and thumbnail mode preferences are set in
# ShownSectionsHandler::RegisterUserPrefs.
......
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