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" | |
8 #include "chrome/browser/extensions/launch_util.h" | 7 #include "chrome/browser/extensions/launch_util.h" |
9 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
10 #include "extensions/browser/extension_prefs.h" | 9 #include "extensions/browser/extension_prefs.h" |
11 #include "extensions/common/constants.h" | 10 #include "extensions/common/constants.h" |
12 #include "extensions/common/extension.h" | 11 #include "extensions/common/extension.h" |
13 #include "ui/base/window_open_disposition.h" | 12 #include "ui/base/window_open_disposition.h" |
14 | 13 |
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 | |
20 using extensions::ExtensionPrefs; | 14 using extensions::ExtensionPrefs; |
21 using extensions::api::app_runtime::PlayStoreStatus; | |
22 | 15 |
23 AppLaunchParams::AppLaunchParams(Profile* profile, | 16 AppLaunchParams::AppLaunchParams(Profile* profile, |
24 const extensions::Extension* extension, | 17 const extensions::Extension* extension, |
25 extensions::LaunchContainer container, | 18 extensions::LaunchContainer container, |
26 WindowOpenDisposition disposition, | 19 WindowOpenDisposition disposition, |
27 extensions::AppLaunchSource source, | 20 extensions::AppLaunchSource source) |
28 bool set_playstore_status) | |
29 : profile(profile), | 21 : profile(profile), |
30 extension_id(extension ? extension->id() : std::string()), | 22 extension_id(extension ? extension->id() : std::string()), |
31 container(container), | 23 container(container), |
32 disposition(disposition), | 24 disposition(disposition), |
33 command_line(base::CommandLine::NO_PROGRAM), | 25 command_line(base::CommandLine::NO_PROGRAM), |
34 source(source), | 26 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 } | |
47 | 27 |
48 AppLaunchParams::AppLaunchParams(const AppLaunchParams& other) = default; | 28 AppLaunchParams::AppLaunchParams(const AppLaunchParams& other) = default; |
49 | 29 |
50 AppLaunchParams::~AppLaunchParams() {} | 30 AppLaunchParams::~AppLaunchParams() {} |
51 | 31 |
52 AppLaunchParams CreateAppLaunchParamsUserContainer( | 32 AppLaunchParams CreateAppLaunchParamsUserContainer( |
53 Profile* profile, | 33 Profile* profile, |
54 const extensions::Extension* extension, | 34 const extensions::Extension* extension, |
55 WindowOpenDisposition disposition, | 35 WindowOpenDisposition disposition, |
56 extensions::AppLaunchSource source) { | 36 extensions::AppLaunchSource source) { |
(...skipping 23 matching lines...) Expand all Loading... |
80 disposition = raw_disposition; | 60 disposition = raw_disposition; |
81 } else { | 61 } else { |
82 // Look at preference to find the right launch container. If no preference | 62 // Look at preference to find the right launch container. If no preference |
83 // is set, launch as a regular tab. | 63 // is set, launch as a regular tab. |
84 container = | 64 container = |
85 extensions::GetLaunchContainer(ExtensionPrefs::Get(profile), extension); | 65 extensions::GetLaunchContainer(ExtensionPrefs::Get(profile), extension); |
86 disposition = NEW_FOREGROUND_TAB; | 66 disposition = NEW_FOREGROUND_TAB; |
87 } | 67 } |
88 return AppLaunchParams(profile, extension, container, disposition, source); | 68 return AppLaunchParams(profile, extension, container, disposition, source); |
89 } | 69 } |
OLD | NEW |