Chromium Code Reviews| 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_bridge_service.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 if (set_playstore_status) { | 37 if (set_playstore_status) { |
| 38 if (arc::ArcSessionManager::IsAllowedForProfile(profile)) { | 38 if (arc::util::IsArcAllowedForProfile(profile)) { |
|
Luis Héctor Chávez
2017/01/19 18:09:15
nit: maybe elide braces? Not sure how that plays w
hidehiko
2017/01/24 17:46:12
I couldn't find any guideline, and I think I've ra
| |
| 39 play_store_status = PlayStoreStatus::PLAY_STORE_STATUS_ENABLED; | 39 play_store_status = PlayStoreStatus::PLAY_STORE_STATUS_ENABLED; |
| 40 } else if (arc::ArcBridgeService::GetAvailable( | 40 } else if (arc::util::IsArcAvailable()) { |
| 41 base::CommandLine::ForCurrentProcess())) { | |
| 42 play_store_status = PlayStoreStatus::PLAY_STORE_STATUS_AVAILABLE; | 41 play_store_status = PlayStoreStatus::PLAY_STORE_STATUS_AVAILABLE; |
| 43 } // else, default to PLAY_STORE_STATUS_UNKNOWN. | 42 } // else, default to PLAY_STORE_STATUS_UNKNOWN. |
| 44 } | 43 } |
| 45 #endif | 44 #endif |
| 46 } | 45 } |
| 47 | 46 |
| 48 AppLaunchParams::AppLaunchParams(const AppLaunchParams& other) = default; | 47 AppLaunchParams::AppLaunchParams(const AppLaunchParams& other) = default; |
| 49 | 48 |
| 50 AppLaunchParams::~AppLaunchParams() {} | 49 AppLaunchParams::~AppLaunchParams() {} |
| 51 | 50 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 80 disposition = raw_disposition; | 79 disposition = raw_disposition; |
| 81 } else { | 80 } else { |
| 82 // 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 |
| 83 // is set, launch as a regular tab. | 82 // is set, launch as a regular tab. |
| 84 container = | 83 container = |
| 85 extensions::GetLaunchContainer(ExtensionPrefs::Get(profile), extension); | 84 extensions::GetLaunchContainer(ExtensionPrefs::Get(profile), extension); |
| 86 disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB; | 85 disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB; |
| 87 } | 86 } |
| 88 return AppLaunchParams(profile, extension, container, disposition, source); | 87 return AppLaunchParams(profile, extension, container, disposition, source); |
| 89 } | 88 } |
| OLD | NEW |