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

Unified Diff: chrome/browser/ui/ash/launcher/browser_launcher_item_controller.cc

Issue 12288012: Showing launcher items for windowed v1 apps - pinned or not. Also - don't show windowed v1 apps in … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing build breakage with clang Created 7 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/ash/launcher/browser_launcher_item_controller.cc
diff --git a/chrome/browser/ui/ash/launcher/browser_launcher_item_controller.cc b/chrome/browser/ui/ash/launcher/browser_launcher_item_controller.cc
index 81f8876e2b10e8fec6cdab3de261cdded99915e6..754000a12aadacfc839302258e760a140165b406 100644
--- a/chrome/browser/ui/ash/launcher/browser_launcher_item_controller.cc
+++ b/chrome/browser/ui/ash/launcher/browser_launcher_item_controller.cc
@@ -49,6 +49,14 @@ BrowserLauncherItemController::~BrowserLauncherItemController() {
window_->RemoveObserver(this);
if (launcher_id() > 0)
launcher_controller()->CloseLauncherItem(launcher_id());
+ if (type() == TYPE_WINDOWED_APP)
+ launcher_controller()->UnlockV1AppWithID(LauncherItemController::app_id());
+}
+
+const std::string& BrowserLauncherItemController::app_id() const {
+ if (type() == TYPE_WINDOWED_APP)
+ return empty_app_id_;
+ return LauncherItemController::app_id();
}
void BrowserLauncherItemController::Init() {
@@ -56,7 +64,7 @@ void BrowserLauncherItemController::Init() {
ash::LauncherItemStatus app_status =
ash::wm::IsActiveWindow(window_) ?
ash::STATUS_ACTIVE : ash::STATUS_RUNNING;
- if (type() != TYPE_TABBED) {
+ if (type() != TYPE_TABBED && type() != TYPE_WINDOWED_APP) {
launcher_controller()->CreateAppLauncherItem(this, app_id(), app_status);
} else {
launcher_controller()->CreateTabbedLauncherItem(
@@ -64,6 +72,8 @@ void BrowserLauncherItemController::Init() {
is_incognito_ ? ChromeLauncherController::STATE_INCOGNITO :
ChromeLauncherController::STATE_NOT_INCOGNITO,
app_status);
+ if (type() == TYPE_WINDOWED_APP)
+ launcher_controller()->LockV1AppWithID(LauncherItemController::app_id());
}
// In testing scenarios we can get tab strips with no active contents.
if (tab_model_->active_index() != TabStripModel::kNoTab)
@@ -81,6 +91,17 @@ BrowserLauncherItemController* BrowserLauncherItemController::Create(
std::string app_id;
if (browser->is_type_tabbed() || browser->is_type_popup()) {
type = TYPE_TABBED;
+ if (!browser->is_type_tabbed() &&
+ browser->is_type_popup() &&
+ browser->is_app() &&
+ ChromeLauncherController::instance()->GetPerAppInterface()) {
+ app_id = web_app::GetExtensionIdFromApplicationName(
+ browser->app_name());
+ // Only allow this for known applications. Some unit tests for example
+ // do not have one.
+ if (!app_id.empty())
+ type = TYPE_WINDOWED_APP;
+ }
} else if (browser->is_app()) {
if (browser->is_type_panel()) {
if (browser->app_type() == Browser::APP_TYPE_CHILD)

Powered by Google App Engine
This is Rietveld 408576698