| 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 "base/memory/ptr_util.h" |
| 8 #include "chrome/browser/extensions/launch_util.h" | 8 #include "chrome/browser/extensions/launch_util.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "extensions/browser/extension_prefs.h" | 10 #include "extensions/browser/extension_prefs.h" |
| 11 #include "extensions/common/constants.h" | 11 #include "extensions/common/constants.h" |
| 12 #include "extensions/common/extension.h" | 12 #include "extensions/common/extension.h" |
| 13 #include "ui/base/window_open_disposition.h" | 13 #include "ui/base/window_open_disposition.h" |
| 14 | 14 |
| 15 #if defined(OS_CHROMEOS) | 15 #if defined(OS_CHROMEOS) |
| 16 #include "chrome/browser/chromeos/arc/arc_session_manager.h" | 16 #include "chrome/browser/chromeos/arc/arc_util.h" |
| 17 #include "components/arc/arc_util.h" | 17 #include "components/arc/arc_util.h" |
| 18 #endif | 18 #endif |
| 19 | 19 |
| 20 using extensions::ExtensionPrefs; | 20 using extensions::ExtensionPrefs; |
| 21 using extensions::api::app_runtime::PlayStoreStatus; | 21 using extensions::api::app_runtime::PlayStoreStatus; |
| 22 | 22 |
| 23 AppLaunchParams::AppLaunchParams(Profile* profile, | 23 AppLaunchParams::AppLaunchParams(Profile* profile, |
| 24 const extensions::Extension* extension, | 24 const extensions::Extension* extension, |
| 25 extensions::LaunchContainer container, | 25 extensions::LaunchContainer container, |
| 26 WindowOpenDisposition disposition, | 26 WindowOpenDisposition disposition, |
| 27 extensions::AppLaunchSource source, | 27 extensions::AppLaunchSource source, |
| 28 bool set_playstore_status) | 28 bool set_playstore_status) |
| 29 : profile(profile), | 29 : profile(profile), |
| 30 extension_id(extension ? extension->id() : std::string()), | 30 extension_id(extension ? extension->id() : std::string()), |
| 31 container(container), | 31 container(container), |
| 32 disposition(disposition), | 32 disposition(disposition), |
| 33 command_line(base::CommandLine::NO_PROGRAM), | 33 command_line(base::CommandLine::NO_PROGRAM), |
| 34 source(source), | 34 source(source), |
| 35 play_store_status(PlayStoreStatus::PLAY_STORE_STATUS_UNKNOWN) { | 35 play_store_status(PlayStoreStatus::PLAY_STORE_STATUS_UNKNOWN) { |
| 36 #if defined(OS_CHROMEOS) | 36 #if defined(OS_CHROMEOS) |
| 37 // TODO(b/34478891): Remove this from app launch. | 37 // TODO(b/34478891): Remove this from app launch. |
| 38 if (set_playstore_status) { | 38 if (set_playstore_status) { |
| 39 if (arc::ArcSessionManager::IsAllowedForProfile(profile)) | 39 if (arc::IsArcAllowedForProfile(profile)) |
| 40 play_store_status = PlayStoreStatus::PLAY_STORE_STATUS_ENABLED; | 40 play_store_status = PlayStoreStatus::PLAY_STORE_STATUS_ENABLED; |
| 41 else if (arc::IsArcAvailable()) | 41 else if (arc::IsArcAvailable()) |
| 42 play_store_status = PlayStoreStatus::PLAY_STORE_STATUS_AVAILABLE; | 42 play_store_status = PlayStoreStatus::PLAY_STORE_STATUS_AVAILABLE; |
| 43 // else, default to PLAY_STORE_STATUS_UNKNOWN. | 43 // else, default to PLAY_STORE_STATUS_UNKNOWN. |
| 44 } | 44 } |
| 45 #endif | 45 #endif |
| 46 } | 46 } |
| 47 | 47 |
| 48 AppLaunchParams::AppLaunchParams(const AppLaunchParams& other) = default; | 48 AppLaunchParams::AppLaunchParams(const AppLaunchParams& other) = default; |
| 49 | 49 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 80 disposition = raw_disposition; | 80 disposition = raw_disposition; |
| 81 } else { | 81 } else { |
| 82 // 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 |
| 83 // is set, launch as a regular tab. | 83 // is set, launch as a regular tab. |
| 84 container = | 84 container = |
| 85 extensions::GetLaunchContainer(ExtensionPrefs::Get(profile), extension); | 85 extensions::GetLaunchContainer(ExtensionPrefs::Get(profile), extension); |
| 86 disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB; | 86 disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB; |
| 87 } | 87 } |
| 88 return AppLaunchParams(profile, extension, container, disposition, source); | 88 return AppLaunchParams(profile, extension, container, disposition, source); |
| 89 } | 89 } |
| OLD | NEW |