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

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

Issue 2867673004: Use OnceCallback on Mojo interfaces in //ash (Closed)
Patch Set: count -> container_count Created 3 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 4
5 #include "chrome/browser/ui/ash/launcher/arc_playstore_shortcut_launcher_item_co ntroller.h" 5 #include "chrome/browser/ui/ash/launcher/arc_playstore_shortcut_launcher_item_co ntroller.h"
6 6
7 #include <utility>
8
7 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
8 #include "chrome/browser/chromeos/arc/arc_support_host.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"
10 #include "chrome/browser/ui/app_list/arc/arc_app_launcher.h" 12 #include "chrome/browser/ui/app_list/arc/arc_app_launcher.h"
11 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" 13 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
12 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 14 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
13 #include "ui/events/event_constants.h" 15 #include "ui/events/event_constants.h"
14 16
15 ArcPlaystoreShortcutLauncherItemController:: 17 ArcPlaystoreShortcutLauncherItemController::
16 ArcPlaystoreShortcutLauncherItemController() 18 ArcPlaystoreShortcutLauncherItemController()
17 : AppShortcutLauncherItemController( 19 : AppShortcutLauncherItemController(
18 ash::ShelfID(ArcSupportHost::kHostAppId)) {} 20 ash::ShelfID(ArcSupportHost::kHostAppId)) {}
19 21
20 ArcPlaystoreShortcutLauncherItemController:: 22 ArcPlaystoreShortcutLauncherItemController::
21 ~ArcPlaystoreShortcutLauncherItemController() {} 23 ~ArcPlaystoreShortcutLauncherItemController() {}
22 24
23 void ArcPlaystoreShortcutLauncherItemController::ItemSelected( 25 void ArcPlaystoreShortcutLauncherItemController::ItemSelected(
24 std::unique_ptr<ui::Event> event, 26 std::unique_ptr<ui::Event> event,
25 int64_t display_id, 27 int64_t display_id,
26 ash::ShelfLaunchSource source, 28 ash::ShelfLaunchSource source,
27 const ItemSelectedCallback& callback) { 29 ItemSelectedCallback callback) {
28 if (!playstore_launcher_) { 30 if (!playstore_launcher_) {
29 // Play Store launch request has never been scheduled. 31 // Play Store launch request has never been scheduled.
30 std::unique_ptr<ArcAppLauncher> playstore_launcher = 32 std::unique_ptr<ArcAppLauncher> playstore_launcher =
31 base::MakeUnique<ArcAppLauncher>( 33 base::MakeUnique<ArcAppLauncher>(
32 ChromeLauncherController::instance()->profile(), 34 ChromeLauncherController::instance()->profile(),
33 arc::kPlayStoreAppId, true /* landscape_layout */, 35 arc::kPlayStoreAppId, true /* landscape_layout */,
34 true /* deferred_launch_allowed */); 36 true /* deferred_launch_allowed */);
35 // ArcAppLauncher may launch Play Store in case it exists already. In this 37 // ArcAppLauncher may launch Play Store in case it exists already. In this
36 // case this instance of ArcPlaystoreShortcutLauncherItemController may be 38 // case this instance of ArcPlaystoreShortcutLauncherItemController may be
37 // deleted. If Play Store does not exist at this moment, then let 39 // deleted. If Play Store does not exist at this moment, then let
38 // |playstore_launcher_| wait until it appears. 40 // |playstore_launcher_| wait until it appears.
39 if (!playstore_launcher->app_launched()) 41 if (!playstore_launcher->app_launched())
40 playstore_launcher_ = std::move(playstore_launcher); 42 playstore_launcher_ = std::move(playstore_launcher);
41 } 43 }
42 callback.Run(ash::SHELF_ACTION_NONE, base::nullopt); 44 std::move(callback).Run(ash::SHELF_ACTION_NONE, base::nullopt);
43 } 45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698