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

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: 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/window_util.h" 7 #include "ash/wm/window_util.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "chrome/browser/chromeos/arc/arc_auth_service.h"
10 #include "chrome/browser/chromeos/arc/arc_support_host.h"
9 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
10 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_item_controller .h" 13 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_item_controller .h"
11 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 14 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
12 #include "components/arc/arc_bridge_service.h" 15 #include "components/arc/arc_bridge_service.h"
13 #include "components/exo/shell_surface.h" 16 #include "components/exo/shell_surface.h"
14 #include "ui/aura/env.h" 17 #include "ui/aura/env.h"
15 #include "ui/base/base_window.h" 18 #include "ui/base/base_window.h"
16 #include "ui/views/widget/widget.h" 19 #include "ui/views/widget/widget.h"
17 20
18 namespace { 21 namespace {
19 22
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 ArcAppListPrefs::GetAppId(package_name, activity_name); 240 ArcAppListPrefs::GetAppId(package_name, activity_name);
238 241
239 ArcAppWindowLauncherItemController* controller; 242 ArcAppWindowLauncherItemController* controller;
240 AppControllerMap::iterator it = app_controller_map_.find(app_id); 243 AppControllerMap::iterator it = app_controller_map_.find(app_id);
241 ash::ShelfID shelf_id = 0; 244 ash::ShelfID shelf_id = 0;
242 if (it != app_controller_map_.end()) { 245 if (it != app_controller_map_.end()) {
243 controller = it->second; 246 controller = it->second;
244 DCHECK_EQ(controller->app_id(), app_id); 247 DCHECK_EQ(controller->app_id(), app_id);
245 shelf_id = controller->shelf_id(); 248 shelf_id = controller->shelf_id();
246 } else { 249 } else {
247 controller = new ArcAppWindowLauncherItemController(app_id, owner()); 250 const std::string shelf_app_id =
248 shelf_id = owner()->GetShelfIDForAppID(app_id); 251 app_id == arc::kPlayStoreAppId ? ArcSupportHost::kHostAppId : app_id;
252 controller =
253 new ArcAppWindowLauncherItemController(shelf_app_id, app_id, owner());
254 shelf_id = owner()->GetShelfIDForAppID(shelf_app_id);
249 if (shelf_id == 0) { 255 if (shelf_id == 0) {
250 shelf_id = owner()->CreateAppLauncherItem(controller, app_id, 256 // Map Play Store shelf icon to Arc Support host, to share one entry.
257 shelf_id = owner()->CreateAppLauncherItem(controller, shelf_app_id,
251 ash::STATUS_RUNNING); 258 ash::STATUS_RUNNING);
252 } else { 259 } else {
253 owner()->SetItemController(shelf_id, controller); 260 owner()->SetItemController(shelf_id, controller);
254 } 261 }
255 app_controller_map_[app_id] = controller; 262 app_controller_map_[app_id] = controller;
256 } 263 }
257 controller->AddWindow(app_window.get()); 264 controller->AddWindow(app_window.get());
258 owner()->SetItemStatus(shelf_id, ash::STATUS_RUNNING); 265 owner()->SetItemStatus(shelf_id, ash::STATUS_RUNNING);
259 app_window->SetController(controller); 266 app_window->SetController(controller);
260 app_window->set_shelf_id(shelf_id); 267 app_window->set_shelf_id(shelf_id);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 341
335 return app_window->controller(); 342 return app_window->controller();
336 } 343 }
337 344
338 void ArcAppWindowLauncherController::OnWindowActivated( 345 void ArcAppWindowLauncherController::OnWindowActivated(
339 aura::client::ActivationChangeObserver::ActivationReason reason, 346 aura::client::ActivationChangeObserver::ActivationReason reason,
340 aura::Window* gained_active, 347 aura::Window* gained_active,
341 aura::Window* lost_active) { 348 aura::Window* lost_active) {
342 OnTaskSetActive(active_task_id_); 349 OnTaskSetActive(active_task_id_);
343 } 350 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698