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