summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-10 06:31:22 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-10 06:31:22 +0000
commit5b092839306b23eb4c99284160690362e509a98a (patch)
treebbd7b30f2f07d628e6f78c655aa2b24d3992a96c /chrome
parent656a716504ee028c7cfd6bda4d89d791003883d7 (diff)
downloadchromium_src-5b092839306b23eb4c99284160690362e509a98a.zip
chromium_src-5b092839306b23eb4c99284160690362e509a98a.tar.gz
chromium_src-5b092839306b23eb4c99284160690362e509a98a.tar.bz2
Add first cut at gallery integration.
Review URL: http://codereview.chromium.org/1989007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46810 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser_resources.grd1
-rw-r--r--chrome/browser/dom_ui/app_launcher_handler.cc21
-rwxr-xr-xchrome/browser/resources/app_gallery_icon.pngbin0 -> 6497 bytes
-rw-r--r--chrome/browser/resources/new_new_tab.css4
-rw-r--r--chrome/browser/resources/new_new_tab.js18
-rw-r--r--chrome/common/chrome_switches.cc6
-rw-r--r--chrome/common/chrome_switches.h2
7 files changed, 47 insertions, 5 deletions
diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd
index ef553b8..93a3dbd 100644
--- a/chrome/browser/browser_resources.grd
+++ b/chrome/browser/browser_resources.grd
@@ -43,6 +43,7 @@ without changes to the corresponding grd file. paaaae -->
<include name="IDR_MEDIAPLAYER_HTML" file="resources\mediaplayer.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_MEDIAPLAYERPLAYLIST_HTML" file="resources\playlist.html" flattenhtml="true" type="BINDATA" />
</if>
+ <include name="IDR_APP_GALLERY_ICON" file="resources\app_gallery_icon.png" type="BINDATA" />
<include name="IDR_BOOKMARKS_MANIFEST" file="resources\bookmark_manager\manifest.json" type="BINDATA" />
<include name="IDR_GMAIL_APP_MANIFEST" file="resources\gmail_app\manifest.json" type="BINDATA" />
<include name="IDR_CALENDAR_APP_MANIFEST" file="resources\calendar_app\manifest.json" type="BINDATA" />
diff --git a/chrome/browser/dom_ui/app_launcher_handler.cc b/chrome/browser/dom_ui/app_launcher_handler.cc
index 3fc58fb..5fd206d 100644
--- a/chrome/browser/dom_ui/app_launcher_handler.cc
+++ b/chrome/browser/dom_ui/app_launcher_handler.cc
@@ -12,6 +12,7 @@
#include "chrome/browser/browser_list.h"
#include "chrome/browser/extensions/extensions_service.h"
#include "chrome/browser/tab_contents/tab_contents.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/notification_type.h"
#include "chrome/common/url_constants.h"
@@ -82,18 +83,32 @@ void AppLauncherHandler::CreateAppInfo(Extension* extension,
}
void AppLauncherHandler::HandleGetApps(const Value* value) {
- ListValue list;
+ std::string gallery_title;
+ std::string gallery_url;
+
+ // TODO(aa): Decide the final values for these and remove the switches.
+ gallery_title = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kAppLauncherGalleryTitle);
+ gallery_url = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kAppLauncherGalleryURL);
+
+ DictionaryValue dictionary;
+ dictionary.SetString(L"galleryTitle", gallery_title);
+ dictionary.SetString(L"galleryURL", gallery_url);
+
+ ListValue* list = new ListValue();
const ExtensionList* extensions = extensions_service_->extensions();
for (ExtensionList::const_iterator it = extensions->begin();
it != extensions->end(); ++it) {
if (TreatAsApp(*it)) {
DictionaryValue* app_info = new DictionaryValue();
CreateAppInfo(*it, app_info);
- list.Append(app_info);
+ list->Append(app_info);
}
}
- dom_ui_->CallJavascriptFunction(L"getAppsCallback", list);
+ dictionary.Set(L"apps", list);
+ dom_ui_->CallJavascriptFunction(L"getAppsCallback", dictionary);
// First time we get here we set up the observer so that we can tell update
// the apps as they change.
diff --git a/chrome/browser/resources/app_gallery_icon.png b/chrome/browser/resources/app_gallery_icon.png
new file mode 100755
index 0000000..d45242d
--- /dev/null
+++ b/chrome/browser/resources/app_gallery_icon.png
Binary files differ
diff --git a/chrome/browser/resources/new_new_tab.css b/chrome/browser/resources/new_new_tab.css
index 41a419e..3286050 100644
--- a/chrome/browser/resources/new_new_tab.css
+++ b/chrome/browser/resources/new_new_tab.css
@@ -619,3 +619,7 @@ html[dir=rtl] #option-menu > [command=hide]:before {
-webkit-animation: bounce .5s ease-in-out;
-webkit-transition: opacity .5s;
}
+
+#apps-section #gallery-entry {
+ background-image: url('app_gallery_icon.png');
+}
diff --git a/chrome/browser/resources/new_new_tab.js b/chrome/browser/resources/new_new_tab.js
index f5550f7..f5a765c 100644
--- a/chrome/browser/resources/new_new_tab.js
+++ b/chrome/browser/resources/new_new_tab.js
@@ -17,13 +17,18 @@ function getAppsCallback(data) {
var debugSection = $('debug');
appsSection.innerHTML = '';
- data.forEach(function(app) {
+ data.apps.forEach(function(app) {
appsSection.appendChild(apps.createElement(app));
});
+ if (data.galleryTitle && data.galleryURL) {
+ appsSection.appendChild(apps.createGalleryElement(
+ data.galleryTitle, data.galleryURL));
+ }
+
// TODO(aa): Figure out what to do with the debug mode when we turn apps on
// for everyone.
- if (data.length) {
+ if (appsSection.hasChildNodes()) {
appsSection.classList.remove('disabled');
debugSection.classList.remove('disabled');
} else {
@@ -65,6 +70,15 @@ var apps = {
}, 500);
}
return a;
+ },
+
+ createGalleryElement: function(title, url) {
+ var a = document.createElement('a');
+ a.title = title;
+ a.href = url;
+ a.id = 'gallery-entry';
+ a.textContent = title;
+ return a;
}
};
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 0e9e3455..b47fdef 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -43,6 +43,12 @@ const char kAppLaunchAsPanel[] = "app-launch-as-panel";
// Makes the app launcher popup when a new tab is created.
const char kAppLauncherForNewTab[] = "app-launcher-new-tab";
+// The title to use for the gallery link in the app launcher.
+const char kAppLauncherGalleryTitle[] = "app-launcher-gallery-title";
+
+// The URL to use for the gallery link in the app launcher.
+const char kAppLauncherGalleryURL[] = "app-launcher-gallery-url";
+
// Authentication white list for servers
const char kAuthServerWhitelist[] = "auth-server-whitelist";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 936467f..f0c4244 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -27,6 +27,8 @@ extern const char kApp[];
extern const char kAppId[];
extern const char kAppLaunchAsPanel[];
extern const char kAppLauncherForNewTab[];
+extern const char kAppLauncherGalleryTitle[];
+extern const char kAppLauncherGalleryURL[];
extern const char kAuthServerWhitelist[];
extern const char kAutomationClientChannelID[];
extern const char kBookmarkMenu[];