Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3439)

Unified Diff: chrome/browser/ui/views/ash/launcher/launcher_updater.cc

Issue 9590001: Launch panels as popup windows in Aura, and add separate launcher icon logic for panels. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: . Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/ash/launcher/launcher_updater.cc
diff --git a/chrome/browser/ui/views/ash/launcher/launcher_updater.cc b/chrome/browser/ui/views/ash/launcher/launcher_updater.cc
index ec581765f5e1e843cf74a37b04addfcb59d9ce59..5b1fe229a781af3f542e8e29d4c40209c49f9ef2 100644
--- a/chrome/browser/ui/views/ash/launcher/launcher_updater.cc
+++ b/chrome/browser/ui/views/ash/launcher/launcher_updater.cc
@@ -51,10 +51,13 @@ LauncherUpdater::~LauncherUpdater() {
void LauncherUpdater::Init() {
tab_model_->AddObserver(this);
- if (type_ == TYPE_APP) {
+ if (type_ == TYPE_APP || type_ == TYPE_PANEL) {
// App type never changes, create the launcher item immediately.
+ ChromeLauncherDelegate::AppType app_type =
+ type_ == TYPE_PANEL ? ChromeLauncherDelegate::APP_TYPE_PANEL
+ : ChromeLauncherDelegate::APP_TYPE_WINDOW;
item_id_ = launcher_delegate_->CreateAppLauncherItem(
- this, app_id_, ChromeLauncherDelegate::APP_TYPE_WINDOW);
+ this, app_id_, app_type);
} else {
// Determine if we have any tabs that should get launcher items.
std::vector<TabContentsWrapper*> app_tabs;
@@ -81,7 +84,7 @@ LauncherUpdater* LauncherUpdater::Create(Browser* browser) {
if (browser->type() == Browser::TYPE_TABBED) {
type = TYPE_TABBED;
} else if (browser->is_app()) {
- type = TYPE_APP;
+ type = browser->is_type_panel() ? TYPE_PANEL : TYPE_APP;
app_id = web_app::GetExtensionIdFromApplicationName(browser->app_name());
} else {
return NULL;
@@ -142,7 +145,7 @@ void LauncherUpdater::TabChangedAt(
void LauncherUpdater::TabInsertedAt(TabContentsWrapper* contents,
int index,
bool foreground) {
- if (type_ == TYPE_APP)
+ if (type_ != TYPE_TABBED)
return;
UpdateAppTabState(contents, UPDATE_TAB_INSERTED);
@@ -163,7 +166,7 @@ void LauncherUpdater::TabReplacedAt(TabStripModel* tab_strip_model,
}
void LauncherUpdater::TabDetachedAt(TabContentsWrapper* contents, int index) {
- if (type_ == TYPE_APP)
+ if (type_ != TYPE_TABBED)
return;
UpdateAppTabState(contents, UPDATE_TAB_REMOVED);
@@ -193,8 +196,17 @@ void LauncherUpdater::UpdateLauncher(TabContentsWrapper* tab) {
if (item_index == -1)
return;
- ash::LauncherItem item;
- if (launcher_model()->items()[item_index].type == ash::TYPE_APP) {
+ ash::LauncherItem item = launcher_model()->items()[item_index];
+ if (type_ == TYPE_PANEL) {
+ // Update the icon for app panels.
+ // TODO(stevenjb): Get a large favicon for the launcher.
+ if (!tab->favicon_tab_helper()->GetFavicon().empty())
+ item.image = tab->favicon_tab_helper()->GetFavicon();
+ else if (tab->extension_tab_helper()->GetExtensionAppIcon())
+ item.image = *tab->extension_tab_helper()->GetExtensionAppIcon();
+ else
+ item.image = Extension::GetDefaultIcon(true);
+ } else if (launcher_model()->items()[item_index].type == ash::TYPE_APP) {
// Use the app icon if we can.
if (tab->extension_tab_helper()->GetExtensionAppIcon())
item.image = *tab->extension_tab_helper()->GetExtensionAppIcon();
« no previous file with comments | « chrome/browser/ui/views/ash/launcher/launcher_updater.h ('k') | chrome/browser/ui/views/frame/browser_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698