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; |
| 21 using extensions::api::app_runtime::PlayStoreStatus; |
15 | 22 |
16 AppLaunchParams::AppLaunchParams(Profile* profile, | 23 AppLaunchParams::AppLaunchParams(Profile* profile, |
17 const extensions::Extension* extension, | 24 const extensions::Extension* extension, |
18 extensions::LaunchContainer container, | 25 extensions::LaunchContainer container, |
19 WindowOpenDisposition disposition, | 26 WindowOpenDisposition disposition, |
20 extensions::AppLaunchSource source) | 27 extensions::AppLaunchSource source, |
| 28 bool set_playstore_status) |
21 : profile(profile), | 29 : profile(profile), |
22 extension_id(extension ? extension->id() : std::string()), | 30 extension_id(extension ? extension->id() : std::string()), |
23 container(container), | 31 container(container), |
24 disposition(disposition), | 32 disposition(disposition), |
25 command_line(base::CommandLine::NO_PROGRAM), | 33 command_line(base::CommandLine::NO_PROGRAM), |
26 source(source) {} | 34 source(source), |
| 35 play_store_status(PlayStoreStatus::PLAY_STORE_STATUS_UNKNOWN) { |
| 36 #if defined(OS_CHROMEOS) |
| 37 if (set_playstore_status) { |
| 38 if (arc::ArcAuthService::IsAllowedForProfile(profile)) { |
| 39 play_store_status = PlayStoreStatus::PLAY_STORE_STATUS_ENABLED; |
| 40 } else if (arc::ArcBridgeService::GetAvailable( |
| 41 base::CommandLine::ForCurrentProcess())) { |
| 42 play_store_status = PlayStoreStatus::PLAY_STORE_STATUS_AVAILABLE; |
| 43 } // else, default to PLAY_STORE_STATUS_UNKNOWN. |
| 44 } |
| 45 #endif |
| 46 } |
27 | 47 |
28 AppLaunchParams::AppLaunchParams(const AppLaunchParams& other) = default; | 48 AppLaunchParams::AppLaunchParams(const AppLaunchParams& other) = default; |
29 | 49 |
30 AppLaunchParams::~AppLaunchParams() {} | 50 AppLaunchParams::~AppLaunchParams() {} |
31 | 51 |
32 AppLaunchParams CreateAppLaunchParamsUserContainer( | 52 AppLaunchParams CreateAppLaunchParamsUserContainer( |
33 Profile* profile, | 53 Profile* profile, |
34 const extensions::Extension* extension, | 54 const extensions::Extension* extension, |
35 WindowOpenDisposition disposition, | 55 WindowOpenDisposition disposition, |
36 extensions::AppLaunchSource source) { | 56 extensions::AppLaunchSource source) { |
(...skipping 23 matching lines...) Expand all Loading... |
60 disposition = raw_disposition; | 80 disposition = raw_disposition; |
61 } else { | 81 } else { |
62 // Look at preference to find the right launch container. If no preference | 82 // Look at preference to find the right launch container. If no preference |
63 // is set, launch as a regular tab. | 83 // is set, launch as a regular tab. |
64 container = | 84 container = |
65 extensions::GetLaunchContainer(ExtensionPrefs::Get(profile), extension); | 85 extensions::GetLaunchContainer(ExtensionPrefs::Get(profile), extension); |
66 disposition = NEW_FOREGROUND_TAB; | 86 disposition = NEW_FOREGROUND_TAB; |
67 } | 87 } |
68 return AppLaunchParams(profile, extension, container, disposition, source); | 88 return AppLaunchParams(profile, extension, container, disposition, source); |
69 } | 89 } |
OLD | NEW |