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

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: Fix unit test 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..f1bbdce4a762637ae284bc4390965e617be6b6d9 100644
--- a/chrome/browser/ui/ash/launcher/browser_launcher_item_controller.cc
+++ b/chrome/browser/ui/ash/launcher/browser_launcher_item_controller.cc
@@ -33,9 +33,11 @@ BrowserLauncherItemController::BrowserLauncherItemController(
aura::Window* window,
TabStripModel* tab_model,
ChromeLauncherController* launcher_controller,
- const std::string& app_id)
+ const std::string& app_id,
+ const std::string& v1_app_id)
: LauncherItemController(type, app_id, launcher_controller),
window_(window),
+ v1_app_id_(v1_app_id),
tab_model_(tab_model),
is_incognito_(tab_model->profile()->GetOriginalProfile() !=
tab_model->profile() &&
@@ -49,6 +51,8 @@ BrowserLauncherItemController::~BrowserLauncherItemController() {
window_->RemoveObserver(this);
if (launcher_id() > 0)
launcher_controller()->CloseLauncherItem(launcher_id());
+ if (type() == TYPE_WINDOWED_APP)
+ launcher_controller()->UnlockAppWithID(v1_app_id_);
sky 2013/02/19 17:55:56 Why do you need the lock/unlock? Shouldn't that be
Mr4D (OOO till 08-26) 2013/02/19 19:22:13 As discussed.
}
void BrowserLauncherItemController::Init() {
@@ -56,7 +60,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 +68,8 @@ void BrowserLauncherItemController::Init() {
is_incognito_ ? ChromeLauncherController::STATE_INCOGNITO :
ChromeLauncherController::STATE_NOT_INCOGNITO,
app_status);
+ if (type() == TYPE_WINDOWED_APP)
+ launcher_controller()->LockAppWithID(v1_app_id_);
}
// In testing scenarios we can get tab strips with no active contents.
if (tab_model_->active_index() != TabStripModel::kNoTab)
@@ -79,8 +85,20 @@ BrowserLauncherItemController* BrowserLauncherItemController::Create(
Type type;
std::string app_id;
+ std::string v1_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()) {
+ v1_app_id = web_app::GetExtensionIdFromApplicationName(
+ browser->app_name());
+ // Only allow this for known applications. Some unit tests for example
+ // do not have one.
+ if (!v1_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)
@@ -99,7 +117,8 @@ BrowserLauncherItemController* BrowserLauncherItemController::Create(
browser->window()->GetNativeWindow(),
browser->tab_strip_model(),
ChromeLauncherController::instance(),
- app_id);
+ app_id,
+ v1_app_id);
controller->Init();
return controller;
}

Powered by Google App Engine
This is Rietveld 408576698