Commit ffd6f574 authored by haraken's avatar haraken Committed by Commit bot

Revert of Add ARC++ specific fields to launch data for specific apps....

Revert of Add ARC++ specific fields to launch data for specific apps. (patchset #7 id:120001 of https://codereview.chromium.org/2272813003/ )

Reason for revert:
This broke compilation of ChromeOS:

https://build.chromium.org/p/chromium.chrome/builders/Google%20Chrome%20ChromeOS/builds/22483

Original issue's description:
> Add ARC++ specific fields to launch data for specific apps.
>
> On devices that have ARC++ available or enabled, certain internal apps need
> to be able to get this information. Currently these are limited to the
> GetHelp and the demo app.
>
> These are fields we'd like to eventually just expose to all apps but currently
> security is not comfortable with that yet, so for now, we'll set these flags
> only for the apps that currently need it.
>
> Reviews requested,
> xiyuan@ - General review.
> asargent@ - //apps and extension parts
> lhchavez@ - ARC++ parts
> sky@ - //chrome/browser/ui
>
> R=asargent@chromium.org, lhchavez@chromium.org, sky@chromium.org, xiyuan@chromium.org
> BUG=640330
>
> Committed: https://crrev.com/3d97de469a486debcb8956de8f7ed679fa862cbf
> Cr-Commit-Position: refs/heads/master@{#414348}

TBR=asargent@chromium.org,lhchavez@chromium.org,sky@chromium.org,xiyuan@chromium.org,rkc@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=640330

Review-Url: https://codereview.chromium.org/2276293002
Cr-Commit-Position: refs/heads/master@{#414351}
parent 55c657b6
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/files/file_util.h" #include "base/files/file_util.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
...@@ -49,7 +48,6 @@ namespace app_runtime = extensions::api::app_runtime; ...@@ -49,7 +48,6 @@ namespace app_runtime = extensions::api::app_runtime;
using content::BrowserThread; using content::BrowserThread;
using extensions::AppRuntimeEventRouter; using extensions::AppRuntimeEventRouter;
using extensions::api::app_runtime::PlayStoreStatus;
using extensions::app_file_handler_util::CreateFileEntry; using extensions::app_file_handler_util::CreateFileEntry;
using extensions::app_file_handler_util::FileHandlerCanHandleEntry; using extensions::app_file_handler_util::FileHandlerCanHandleEntry;
using extensions::app_file_handler_util::FileHandlerForId; using extensions::app_file_handler_util::FileHandlerForId;
...@@ -205,12 +203,8 @@ class PlatformAppPathLauncher ...@@ -205,12 +203,8 @@ class PlatformAppPathLauncher
if (!app) if (!app)
return; return;
std::unique_ptr<app_runtime::LaunchData> launch_data =
base::MakeUnique<app_runtime::LaunchData>();
launch_data->action_data = std::move(action_data_);
AppRuntimeEventRouter::DispatchOnLaunchedEvent( AppRuntimeEventRouter::DispatchOnLaunchedEvent(
profile_, app, launch_source_, std::move(launch_data)); profile_, app, launch_source_, std::move(action_data_));
} }
void OnAreDirectoriesCollected( void OnAreDirectoriesCollected(
...@@ -358,11 +352,10 @@ class PlatformAppPathLauncher ...@@ -358,11 +352,10 @@ class PlatformAppPathLauncher
} // namespace } // namespace
void LaunchPlatformAppWithCommandLine(Profile* profile, void LaunchPlatformAppWithCommandLine(Profile* profile,
const extensions::Extension* app, const Extension* app,
const base::CommandLine& command_line, const base::CommandLine& command_line,
const base::FilePath& current_directory, const base::FilePath& current_directory,
extensions::AppLaunchSource source, extensions::AppLaunchSource source) {
PlayStoreStatus play_store_status) {
// An app with "kiosk_only" should not be installed and launched // An app with "kiosk_only" should not be installed and launched
// outside of ChromeOS kiosk mode in the first place. This is a defensive // outside of ChromeOS kiosk mode in the first place. This is a defensive
// check in case this scenario does occur. // check in case this scenario does occur.
...@@ -393,12 +386,8 @@ void LaunchPlatformAppWithCommandLine(Profile* profile, ...@@ -393,12 +386,8 @@ void LaunchPlatformAppWithCommandLine(Profile* profile,
// causes problems on the bots. // causes problems on the bots.
if (args.empty() || (command_line.HasSwitch(switches::kTestType) && if (args.empty() || (command_line.HasSwitch(switches::kTestType) &&
args[0] == about_blank_url)) { args[0] == about_blank_url)) {
std::unique_ptr<app_runtime::LaunchData> launch_data = AppRuntimeEventRouter::DispatchOnLaunchedEvent(
base::MakeUnique<app_runtime::LaunchData>(); profile, app, source, std::unique_ptr<app_runtime::ActionData>());
if (play_store_status != PlayStoreStatus::PLAY_STORE_STATUS_UNKNOWN)
launch_data->play_store_status = play_store_status;
AppRuntimeEventRouter::DispatchOnLaunchedEvent(profile, app, source,
std::move(launch_data));
return; return;
} }
...@@ -465,7 +454,8 @@ void RestartPlatformApp(Profile* profile, const Extension* app) { ...@@ -465,7 +454,8 @@ void RestartPlatformApp(Profile* profile, const Extension* app) {
if (listening_to_launch && had_windows) { if (listening_to_launch && had_windows) {
AppRuntimeEventRouter::DispatchOnLaunchedEvent( AppRuntimeEventRouter::DispatchOnLaunchedEvent(
profile, app, extensions::SOURCE_RESTART, nullptr); profile, app, extensions::SOURCE_RESTART,
std::unique_ptr<app_runtime::ActionData>());
} }
} }
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "extensions/common/api/app_runtime.h"
#include "extensions/common/constants.h" #include "extensions/common/constants.h"
class GURL; class GURL;
...@@ -36,15 +35,11 @@ namespace apps { ...@@ -36,15 +35,11 @@ namespace apps {
// |command_line| means there is no launch data. If non-empty, // |command_line| means there is no launch data. If non-empty,
// |current_directory| is used to expand any relative paths on the command line. // |current_directory| is used to expand any relative paths on the command line.
// |source| is one of the enumerated values which trace how the app is launched. // |source| is one of the enumerated values which trace how the app is launched.
void LaunchPlatformAppWithCommandLine( void LaunchPlatformAppWithCommandLine(Profile* profile,
Profile* profile,
const extensions::Extension* app, const extensions::Extension* app,
const base::CommandLine& command_line, const base::CommandLine& command_line,
const base::FilePath& current_directory, const base::FilePath& current_directory,
extensions::AppLaunchSource source, extensions::AppLaunchSource source);
extensions::api::app_runtime::PlayStoreStatus play_store_status =
extensions::api::app_runtime::PlayStoreStatus::
PLAY_STORE_STATUS_UNKNOWN);
// Launches the platform app |app| by issuing an onLaunched event with the // Launches the platform app |app| by issuing an onLaunched event with the
// contents of |file_path| available through the launch data. // contents of |file_path| available through the launch data.
......
...@@ -44,7 +44,8 @@ void LaunchAppWithId(Profile* profile, ...@@ -44,7 +44,8 @@ void LaunchAppWithId(Profile* profile,
return; return;
AppRuntimeEventRouter::DispatchOnLaunchedEvent( AppRuntimeEventRouter::DispatchOnLaunchedEvent(
profile, extension, extensions::SOURCE_RESTART, nullptr); profile, extension, extensions::SOURCE_RESTART,
std::unique_ptr<extensions::api::app_runtime::ActionData>());
} }
} // namespace } // namespace
......
...@@ -96,7 +96,7 @@ void DemoAppLauncher::OnProfileLoaded(Profile* profile) { ...@@ -96,7 +96,7 @@ void DemoAppLauncher::OnProfileLoaded(Profile* profile) {
OpenApplication( OpenApplication(
AppLaunchParams(profile, extension, extensions::LAUNCH_CONTAINER_WINDOW, AppLaunchParams(profile, extension, extensions::LAUNCH_CONTAINER_WINDOW,
NEW_WINDOW, extensions::SOURCE_CHROME_INTERNAL, true)); NEW_WINDOW, extensions::SOURCE_CHROME_INTERNAL));
KioskAppManager::Get()->InitSession(profile, extension_id); KioskAppManager::Get()->InitSession(profile, extension_id);
user_manager::UserManager::Get()->SessionStarted(); user_manager::UserManager::Get()->SessionStarted();
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/download/download_shelf.h" #include "chrome/browser/download/download_shelf.h"
#include "chrome/browser/extensions/launch_util.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
...@@ -33,7 +32,6 @@ ...@@ -33,7 +32,6 @@
#include "components/signin/core/common/profile_management_switches.h" #include "components/signin/core/common/profile_management_switches.h"
#include "content/public/browser/user_metrics.h" #include "content/public/browser/user_metrics.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/common/constants.h" #include "extensions/common/constants.h"
#include "google_apis/gaia/gaia_urls.h" #include "google_apis/gaia/gaia_urls.h"
#include "net/base/url_util.h" #include "net/base/url_util.h"
...@@ -104,11 +102,8 @@ void ShowHelpImpl(Browser* browser, Profile* profile, HelpSource source) { ...@@ -104,11 +102,8 @@ void ShowHelpImpl(Browser* browser, Profile* profile, HelpSource source) {
default: default:
NOTREACHED() << "Unhandled help source" << source; NOTREACHED() << "Unhandled help source" << source;
} }
OpenApplication( OpenApplication(CreateAppLaunchParamsUserContainer(
AppLaunchParams(profile, extension, profile, extension, NEW_FOREGROUND_TAB, app_launch_source));
extensions::GetLaunchContainer(
extensions::ExtensionPrefs::Get(profile), extension),
NEW_FOREGROUND_TAB, source, true));
#else #else
GURL url; GURL url;
switch (source) { switch (source) {
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "chrome/browser/ui/extensions/app_launch_params.h" #include "chrome/browser/ui/extensions/app_launch_params.h"
#include "base/memory/ptr_util.h"
#include "chrome/browser/extensions/launch_util.h" #include "chrome/browser/extensions/launch_util.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "extensions/browser/extension_prefs.h" #include "extensions/browser/extension_prefs.h"
...@@ -12,38 +11,19 @@ ...@@ -12,38 +11,19 @@
#include "extensions/common/extension.h" #include "extensions/common/extension.h"
#include "ui/base/window_open_disposition.h" #include "ui/base/window_open_disposition.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/arc/arc_auth_service.h"
#include "components/arc/arc_bridge_service.h"
#endif
using extensions::ExtensionPrefs; using extensions::ExtensionPrefs;
using extensions::api::app_runtime::PlayStoreStatus;
AppLaunchParams::AppLaunchParams(Profile* profile, AppLaunchParams::AppLaunchParams(Profile* profile,
const extensions::Extension* extension, const extensions::Extension* extension,
extensions::LaunchContainer container, extensions::LaunchContainer container,
WindowOpenDisposition disposition, WindowOpenDisposition disposition,
extensions::AppLaunchSource source, extensions::AppLaunchSource source)
bool set_playstore_status)
: profile(profile), : profile(profile),
extension_id(extension ? extension->id() : std::string()), extension_id(extension ? extension->id() : std::string()),
container(container), container(container),
disposition(disposition), disposition(disposition),
command_line(base::CommandLine::NO_PROGRAM), command_line(base::CommandLine::NO_PROGRAM),
source(source), source(source) {}
play_store_status(PlayStoreStatus::PLAY_STORE_STATUS_UNKNOWN) {
#if defined(OS_CHROMEOS)
if (set_playstore_status) {
if (arc::ArcAuthService::IsAllowedForProfile(profile)) {
play_store_status = PlayStoreStatus::PLAY_STORE_STATUS_ENABLED;
} else if (arc::ArcBridgeService::GetAvailable(
base::CommandLine::ForCurrentProcess())) {
play_store_status = PlayStoreStatus::PLAY_STORE_STATUS_AVAILABLE;
} // else, default to PLAY_STORE_STATUS_UNKNOWN.
}
#endif
}
AppLaunchParams::AppLaunchParams(const AppLaunchParams& other) = default; AppLaunchParams::AppLaunchParams(const AppLaunchParams& other) = default;
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/extension_constants.h"
#include "extensions/common/api/app_runtime.h"
#include "extensions/common/constants.h" #include "extensions/common/constants.h"
#include "ui/base/window_open_disposition.h" #include "ui/base/window_open_disposition.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
...@@ -27,8 +26,7 @@ struct AppLaunchParams { ...@@ -27,8 +26,7 @@ struct AppLaunchParams {
const extensions::Extension* extension, const extensions::Extension* extension,
extensions::LaunchContainer container, extensions::LaunchContainer container,
WindowOpenDisposition disposition, WindowOpenDisposition disposition,
extensions::AppLaunchSource source, extensions::AppLaunchSource source);
bool set_playstore_status = false);
AppLaunchParams(const AppLaunchParams& other); AppLaunchParams(const AppLaunchParams& other);
...@@ -64,9 +62,6 @@ struct AppLaunchParams { ...@@ -64,9 +62,6 @@ struct AppLaunchParams {
// Record where the app is launched from for tracking purpose. // Record where the app is launched from for tracking purpose.
// Different app may have their own enumeration of sources. // Different app may have their own enumeration of sources.
extensions::AppLaunchSource source; extensions::AppLaunchSource source;
// Status of ARC++ on this device.
extensions::api::app_runtime::PlayStoreStatus play_store_status;
}; };
// Helper to create AppLaunchParams using extensions::GetLaunchContainer with // Helper to create AppLaunchParams using extensions::GetLaunchContainer with
......
...@@ -299,15 +299,18 @@ WebContents* OpenEnabledApplication(const AppLaunchParams& params) { ...@@ -299,15 +299,18 @@ WebContents* OpenEnabledApplication(const AppLaunchParams& params) {
const Extension* extension = GetExtension(params); const Extension* extension = GetExtension(params);
if (!extension) if (!extension)
return NULL; return NULL;
Profile* profile = params.profile;
WebContents* tab = NULL; WebContents* tab = NULL;
ExtensionPrefs* prefs = ExtensionPrefs::Get(params.profile); ExtensionPrefs* prefs = ExtensionPrefs::Get(profile);
prefs->SetActiveBit(extension->id(), true); prefs->SetActiveBit(extension->id(), true);
if (CanLaunchViaEvent(extension)) { if (CanLaunchViaEvent(extension)) {
apps::LaunchPlatformAppWithCommandLine( apps::LaunchPlatformAppWithCommandLine(profile,
params.profile, extension, params.command_line, extension,
params.current_directory, params.source, params.play_store_status); params.command_line,
params.current_directory,
params.source);
return NULL; return NULL;
} }
...@@ -323,7 +326,7 @@ WebContents* OpenEnabledApplication(const AppLaunchParams& params) { ...@@ -323,7 +326,7 @@ WebContents* OpenEnabledApplication(const AppLaunchParams& params) {
// Record the launch time in the site engagement service. A recent bookmark // Record the launch time in the site engagement service. A recent bookmark
// app launch will provide an engagement boost to the origin. // app launch will provide an engagement boost to the origin.
SiteEngagementService* service = SiteEngagementService::Get(params.profile); SiteEngagementService* service = SiteEngagementService::Get(profile);
if (service) if (service)
service->SetLastShortcutLaunchTime(url); service->SetLastShortcutLaunchTime(url);
} }
......
...@@ -53,11 +53,6 @@ bool ArcBridgeService::GetEnabled(const base::CommandLine* command_line) { ...@@ -53,11 +53,6 @@ bool ArcBridgeService::GetEnabled(const base::CommandLine* command_line) {
base::FeatureList::IsEnabled(kArcEnabledFeature)); base::FeatureList::IsEnabled(kArcEnabledFeature));
} }
// static
bool ArcBridgeService::GetAvailable(const base::CommandLine* command_line) {
return command_line->HasSwitch(chromeos::switches::kArcAvailable);
}
void ArcBridgeService::AddObserver(Observer* observer) { void ArcBridgeService::AddObserver(Observer* observer) {
DCHECK(CalledOnValidThread()); DCHECK(CalledOnValidThread());
observer_list_.AddObserver(observer); observer_list_.AddObserver(observer);
......
...@@ -67,9 +67,6 @@ class ArcBridgeService { ...@@ -67,9 +67,6 @@ class ArcBridgeService {
// switch. // switch.
static bool GetEnabled(const base::CommandLine* command_line); static bool GetEnabled(const base::CommandLine* command_line);
// Return true if ARC is available on the current board.
static bool GetAvailable(const base::CommandLine* command_line);
// HandleStartup() should be called upon profile startup. This will only // HandleStartup() should be called upon profile startup. This will only
// launch an instance if the instance is enabled. // launch an instance if the instance is enabled.
// This can only be called on the thread that this class was created on. // This can only be called on the thread that this class was created on.
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include <utility> #include <utility>
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram.h" #include "base/metrics/histogram.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "base/values.h" #include "base/values.h"
...@@ -139,16 +138,18 @@ void AppRuntimeEventRouter::DispatchOnLaunchedEvent( ...@@ -139,16 +138,18 @@ void AppRuntimeEventRouter::DispatchOnLaunchedEvent(
BrowserContext* context, BrowserContext* context,
const Extension* extension, const Extension* extension,
extensions::AppLaunchSource source, extensions::AppLaunchSource source,
std::unique_ptr<app_runtime::LaunchData> launch_data) { std::unique_ptr<app_runtime::ActionData> action_data) {
if (!launch_data) app_runtime::LaunchData launch_data;
launch_data = base::MakeUnique<app_runtime::LaunchData>();
app_runtime::LaunchSource source_enum = GetLaunchSourceEnum(source); app_runtime::LaunchSource source_enum = GetLaunchSourceEnum(source);
if (extensions::FeatureSwitch::trace_app_source()->IsEnabled()) { if (extensions::FeatureSwitch::trace_app_source()->IsEnabled()) {
launch_data->source = source_enum; launch_data.source = source_enum;
} }
launch_data.action_data = std::move(action_data);
DispatchOnLaunchedEventImpl(extension->id(), source_enum, DispatchOnLaunchedEventImpl(extension->id(), source_enum,
launch_data->ToValue(), context); launch_data.ToValue(), context);
} }
// static // static
......
...@@ -27,7 +27,6 @@ namespace extensions { ...@@ -27,7 +27,6 @@ namespace extensions {
namespace api { namespace api {
namespace app_runtime { namespace app_runtime {
struct ActionData; struct ActionData;
struct LaunchData;
} }
} }
...@@ -48,7 +47,7 @@ class AppRuntimeEventRouter { ...@@ -48,7 +47,7 @@ class AppRuntimeEventRouter {
content::BrowserContext* context, content::BrowserContext* context,
const Extension* extension, const Extension* extension,
AppLaunchSource source, AppLaunchSource source,
std::unique_ptr<api::app_runtime::LaunchData> launch_data); std::unique_ptr<api::app_runtime::ActionData> action_data);
// Dispatches the onRestarted event to the given app, providing a list of // Dispatches the onRestarted event to the given app, providing a list of
// restored file entries from the previous run. // restored file entries from the previous run.
......
...@@ -47,16 +47,6 @@ namespace app.runtime { ...@@ -47,16 +47,6 @@ namespace app.runtime {
new_note new_note
}; };
// Status of the play store.
[nodoc] enum PlayStoreStatus {
// Indicates that the play store is enabled. It also implies available.
enabled,
// Indicates that the play store is available but not enabled.
available,
// Indicates that the play store status is unknown.
unknown
};
// Optional data that includes action-specific launch information. // Optional data that includes action-specific launch information.
dictionary ActionData { dictionary ActionData {
ActionType actionType; ActionType actionType;
...@@ -100,9 +90,6 @@ namespace app.runtime { ...@@ -100,9 +90,6 @@ namespace app.runtime {
// launched with. This is null if the app was not launched with a specific // launched with. This is null if the app was not launched with a specific
// action intent. // action intent.
ActionData? actionData; ActionData? actionData;
// Internal fields used to indicate ARC++ status on the device.
[nodoc] PlayStoreStatus? playStoreStatus;
}; };
// This object specifies details and operations to perform on the embedding // This object specifies details and operations to perform on the embedding
......
...@@ -96,8 +96,9 @@ void ShellExtensionSystem::LaunchApp(const ExtensionId& extension_id) { ...@@ -96,8 +96,9 @@ void ShellExtensionSystem::LaunchApp(const ExtensionId& extension_id) {
const Extension* extension = ExtensionRegistry::Get(browser_context_) const Extension* extension = ExtensionRegistry::Get(browser_context_)
->enabled_extensions() ->enabled_extensions()
.GetByID(extension_id); .GetByID(extension_id);
AppRuntimeEventRouter::DispatchOnLaunchedEvent(browser_context_, extension, AppRuntimeEventRouter::DispatchOnLaunchedEvent(
SOURCE_UNTRACKED, nullptr); browser_context_, extension, SOURCE_UNTRACKED,
std::unique_ptr<api::app_runtime::ActionData>());
} }
void ShellExtensionSystem::Shutdown() { void ShellExtensionSystem::Shutdown() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment