OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/extensions/app_launch_params.h" | 5 #include "chrome/browser/ui/extensions/app_launch_params.h" |
6 | 6 |
| 7 #include "base/memory/ptr_util.h" |
7 #include "chrome/browser/extensions/launch_util.h" | 8 #include "chrome/browser/extensions/launch_util.h" |
8 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
9 #include "extensions/browser/extension_prefs.h" | 10 #include "extensions/browser/extension_prefs.h" |
10 #include "extensions/common/constants.h" | 11 #include "extensions/common/constants.h" |
11 #include "extensions/common/extension.h" | 12 #include "extensions/common/extension.h" |
12 #include "ui/base/window_open_disposition.h" | 13 #include "ui/base/window_open_disposition.h" |
13 | 14 |
| 15 #if defined(OS_CHROMEOS) |
| 16 #include "chrome/browser/chromeos/arc/arc_auth_service.h" |
| 17 #include "components/arc/arc_bridge_service.h" |
| 18 #endif |
| 19 |
14 using extensions::ExtensionPrefs; | 20 using extensions::ExtensionPrefs; |
15 | 21 |
16 AppLaunchParams::AppLaunchParams(Profile* profile, | 22 AppLaunchParams::AppLaunchParams(Profile* profile, |
17 const extensions::Extension* extension, | 23 const extensions::Extension* extension, |
18 extensions::LaunchContainer container, | 24 extensions::LaunchContainer container, |
19 WindowOpenDisposition disposition, | 25 WindowOpenDisposition disposition, |
20 extensions::AppLaunchSource source) | 26 extensions::AppLaunchSource source, |
| 27 bool set_playstore_status) |
21 : profile(profile), | 28 : profile(profile), |
22 extension_id(extension ? extension->id() : std::string()), | 29 extension_id(extension ? extension->id() : std::string()), |
23 container(container), | 30 container(container), |
24 disposition(disposition), | 31 disposition(disposition), |
25 command_line(base::CommandLine::NO_PROGRAM), | 32 command_line(base::CommandLine::NO_PROGRAM), |
26 source(source) {} | 33 source(source), |
| 34 play_store_status(PlayStoreStatus::PLAY_STORE_STATUS_UNKNOWN) { |
| 35 #if defined(OS_CHROMEOS) |
| 36 if (set_playstore_status) { |
| 37 if (arc::ArcAuthService::IsAllowedForProfile(profile)) { |
| 38 play_store_status = PlayStoreStatus::PLAY_STORE_STATUS_ENABLED; |
| 39 } else if (arc::ArcBridgeService::GetAvailable( |
| 40 base::CommandLine::ForCurrentProcess())) { |
| 41 play_store_status = PlayStoreStatus::PLAY_STORE_STATUS_AVAILABLE; |
| 42 } // else, default to PLAY_STORE_STATUS_UNKNOWN. |
| 43 } |
| 44 #endif |
| 45 } |
27 | 46 |
28 AppLaunchParams::AppLaunchParams(const AppLaunchParams& other) = default; | 47 AppLaunchParams::AppLaunchParams(const AppLaunchParams& other) = default; |
29 | 48 |
30 AppLaunchParams::~AppLaunchParams() {} | 49 AppLaunchParams::~AppLaunchParams() {} |
31 | 50 |
32 AppLaunchParams CreateAppLaunchParamsUserContainer( | 51 AppLaunchParams CreateAppLaunchParamsUserContainer( |
33 Profile* profile, | 52 Profile* profile, |
34 const extensions::Extension* extension, | 53 const extensions::Extension* extension, |
35 WindowOpenDisposition disposition, | 54 WindowOpenDisposition disposition, |
36 extensions::AppLaunchSource source) { | 55 extensions::AppLaunchSource source) { |
(...skipping 23 matching lines...) Expand all Loading... |
60 disposition = raw_disposition; | 79 disposition = raw_disposition; |
61 } else { | 80 } else { |
62 // Look at preference to find the right launch container. If no preference | 81 // Look at preference to find the right launch container. If no preference |
63 // is set, launch as a regular tab. | 82 // is set, launch as a regular tab. |
64 container = | 83 container = |
65 extensions::GetLaunchContainer(ExtensionPrefs::Get(profile), extension); | 84 extensions::GetLaunchContainer(ExtensionPrefs::Get(profile), extension); |
66 disposition = NEW_FOREGROUND_TAB; | 85 disposition = NEW_FOREGROUND_TAB; |
67 } | 86 } |
68 return AppLaunchParams(profile, extension, container, disposition, source); | 87 return AppLaunchParams(profile, extension, container, disposition, source); |
69 } | 88 } |
OLD | NEW |