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

Side by Side Diff: chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.cc

Issue 1973603002: arc: Make Play Store item persistance in shelf. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase + policy_browsertest.cc Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h" 4 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h"
5 5
6 #include "ash/shelf/shelf_util.h" 6 #include "ash/shelf/shelf_util.h"
7 #include "ash/wm/common/window_state.h" 7 #include "ash/wm/common/window_state.h"
8 #include "ash/wm/window_state_aura.h" 8 #include "ash/wm/window_state_aura.h"
9 #include "ash/wm/window_util.h" 9 #include "ash/wm/window_util.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "chrome/browser/chromeos/arc/arc_auth_service.h"
12 #include "chrome/browser/chromeos/arc/arc_support_host.h"
11 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
12 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_item_controller .h" 15 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_item_controller .h"
13 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 16 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
14 #include "components/arc/arc_bridge_service.h" 17 #include "components/arc/arc_bridge_service.h"
15 #include "components/exo/shell_surface.h" 18 #include "components/exo/shell_surface.h"
16 #include "ui/aura/client/aura_constants.h" 19 #include "ui/aura/client/aura_constants.h"
17 #include "ui/aura/env.h" 20 #include "ui/aura/env.h"
18 #include "ui/base/base_window.h" 21 #include "ui/base/base_window.h"
19 #include "ui/views/widget/widget.h" 22 #include "ui/views/widget/widget.h"
20 23
21 namespace { 24 namespace {
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 ArcAppListPrefs::GetAppId(package_name, activity_name); 266 ArcAppListPrefs::GetAppId(package_name, activity_name);
264 267
265 ArcAppWindowLauncherItemController* controller; 268 ArcAppWindowLauncherItemController* controller;
266 AppControllerMap::iterator it = app_controller_map_.find(app_id); 269 AppControllerMap::iterator it = app_controller_map_.find(app_id);
267 ash::ShelfID shelf_id = 0; 270 ash::ShelfID shelf_id = 0;
268 if (it != app_controller_map_.end()) { 271 if (it != app_controller_map_.end()) {
269 controller = it->second; 272 controller = it->second;
270 DCHECK_EQ(controller->app_id(), app_id); 273 DCHECK_EQ(controller->app_id(), app_id);
271 shelf_id = controller->shelf_id(); 274 shelf_id = controller->shelf_id();
272 } else { 275 } else {
273 controller = new ArcAppWindowLauncherItemController(app_id, owner()); 276 const std::string shelf_app_id =
274 shelf_id = owner()->GetShelfIDForAppID(app_id); 277 app_id == arc::kPlayStoreAppId ? ArcSupportHost::kHostAppId : app_id;
278 controller =
279 new ArcAppWindowLauncherItemController(shelf_app_id, app_id, owner());
280 shelf_id = owner()->GetShelfIDForAppID(shelf_app_id);
275 if (shelf_id == 0) { 281 if (shelf_id == 0) {
276 shelf_id = owner()->CreateAppLauncherItem(controller, app_id, 282 // Map Play Store shelf icon to Arc Support host, to share one entry.
283 shelf_id = owner()->CreateAppLauncherItem(controller, shelf_app_id,
277 ash::STATUS_RUNNING); 284 ash::STATUS_RUNNING);
278 } else { 285 } else {
279 owner()->SetItemController(shelf_id, controller); 286 owner()->SetItemController(shelf_id, controller);
280 } 287 }
281 app_controller_map_[app_id] = controller; 288 app_controller_map_[app_id] = controller;
282 } 289 }
283 controller->AddWindow(app_window.get()); 290 controller->AddWindow(app_window.get());
284 owner()->SetItemStatus(shelf_id, ash::STATUS_RUNNING); 291 owner()->SetItemStatus(shelf_id, ash::STATUS_RUNNING);
285 app_window->SetController(controller); 292 app_window->SetController(controller);
286 app_window->set_shelf_id(shelf_id); 293 app_window->set_shelf_id(shelf_id);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 369
363 return nullptr; 370 return nullptr;
364 } 371 }
365 372
366 void ArcAppWindowLauncherController::OnWindowActivated( 373 void ArcAppWindowLauncherController::OnWindowActivated(
367 aura::client::ActivationChangeObserver::ActivationReason reason, 374 aura::client::ActivationChangeObserver::ActivationReason reason,
368 aura::Window* gained_active, 375 aura::Window* gained_active,
369 aura::Window* lost_active) { 376 aura::Window* lost_active) {
370 OnTaskSetActive(active_task_id_); 377 OnTaskSetActive(active_task_id_);
371 } 378 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698