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 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
......@@ -49,7 +48,6 @@ namespace app_runtime = extensions::api::app_runtime;
using content::BrowserThread;
using extensions::AppRuntimeEventRouter;
using extensions::api::app_runtime::PlayStoreStatus;
using extensions::app_file_handler_util::CreateFileEntry;
using extensions::app_file_handler_util::FileHandlerCanHandleEntry;
using extensions::app_file_handler_util::FileHandlerForId;
......@@ -205,12 +203,8 @@ class PlatformAppPathLauncher
if (!app)
return;
std::unique_ptr<app_runtime::LaunchData> launch_data =
base::MakeUnique<app_runtime::LaunchData>();
launch_data->action_data = std::move(action_data_);
AppRuntimeEventRouter::DispatchOnLaunchedEvent(
profile_, app, launch_source_, std::move(launch_data));
profile_, app, launch_source_, std::move(action_data_));
}
void OnAreDirectoriesCollected(
......@@ -358,11 +352,10 @@ class PlatformAppPathLauncher
} // namespace
void LaunchPlatformAppWithCommandLine(Profile* profile,
const extensions::Extension* app,
const Extension* app,
const base::CommandLine& command_line,
const base::FilePath& current_directory,
extensions::AppLaunchSource source,
PlayStoreStatus play_store_status) {
extensions::AppLaunchSource source) {
// An app with "kiosk_only" should not be installed and launched
// outside of ChromeOS kiosk mode in the first place. This is a defensive
// check in case this scenario does occur.
......@@ -393,12 +386,8 @@ void LaunchPlatformAppWithCommandLine(Profile* profile,
// causes problems on the bots.
if (args.empty() || (command_line.HasSwitch(switches::kTestType) &&
args[0] == about_blank_url)) {
std::unique_ptr<app_runtime::LaunchData> launch_data =
base::MakeUnique<app_runtime::LaunchData>();
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));
AppRuntimeEventRouter::DispatchOnLaunchedEvent(
profile, app, source, std::unique_ptr<app_runtime::ActionData>());
return;
}
......@@ -465,7 +454,8 @@ void RestartPlatformApp(Profile* profile, const Extension* app) {
if (listening_to_launch && had_windows) {
AppRuntimeEventRouter::DispatchOnLaunchedEvent(
profile, app, extensions::SOURCE_RESTART, nullptr);
profile, app, extensions::SOURCE_RESTART,
std::unique_ptr<app_runtime::ActionData>());
}
}
......
......@@ -9,7 +9,6 @@
#include <string>
#include <vector>
#include "extensions/common/api/app_runtime.h"
#include "extensions/common/constants.h"
class GURL;
......@@ -36,15 +35,11 @@ namespace apps {
// |command_line| means there is no launch data. If non-empty,
// |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.
void LaunchPlatformAppWithCommandLine(
Profile* profile,
const extensions::Extension* app,
const base::CommandLine& command_line,
const base::FilePath& current_directory,
extensions::AppLaunchSource source,
extensions::api::app_runtime::PlayStoreStatus play_store_status =
extensions::api::app_runtime::PlayStoreStatus::
PLAY_STORE_STATUS_UNKNOWN);
void LaunchPlatformAppWithCommandLine(Profile* profile,
const extensions::Extension* app,
const base::CommandLine& command_line,
const base::FilePath& current_directory,
extensions::AppLaunchSource source);
// Launches the platform app |app| by issuing an onLaunched event with the
// contents of |file_path| available through the launch data.
......
......@@ -44,7 +44,8 @@ void LaunchAppWithId(Profile* profile,
return;
AppRuntimeEventRouter::DispatchOnLaunchedEvent(
profile, extension, extensions::SOURCE_RESTART, nullptr);
profile, extension, extensions::SOURCE_RESTART,
std::unique_ptr<extensions::api::app_runtime::ActionData>());
}
} // namespace
......
......@@ -96,7 +96,7 @@ void DemoAppLauncher::OnProfileLoaded(Profile* profile) {
OpenApplication(
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);
user_manager::UserManager::Get()->SessionStarted();
......
......@@ -12,7 +12,6 @@
#include "base/strings/stringprintf.h"
#include "build/build_config.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_manager.h"
#include "chrome/browser/ui/browser.h"
......@@ -33,7 +32,6 @@
#include "components/signin/core/common/profile_management_switches.h"
#include "content/public/browser/user_metrics.h"
#include "content/public/browser/web_contents.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/common/constants.h"
#include "google_apis/gaia/gaia_urls.h"
#include "net/base/url_util.h"
......@@ -104,11 +102,8 @@ void ShowHelpImpl(Browser* browser, Profile* profile, HelpSource source) {
default:
NOTREACHED() << "Unhandled help source" << source;
}
OpenApplication(
AppLaunchParams(profile, extension,
extensions::GetLaunchContainer(
extensions::ExtensionPrefs::Get(profile), extension),
NEW_FOREGROUND_TAB, source, true));
OpenApplication(CreateAppLaunchParamsUserContainer(
profile, extension, NEW_FOREGROUND_TAB, app_launch_source));
#else
GURL url;
switch (source) {
......
......@@ -4,7 +4,6 @@
#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/profiles/profile.h"
#include "extensions/browser/extension_prefs.h"
......@@ -12,38 +11,19 @@
#include "extensions/common/extension.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::api::app_runtime::PlayStoreStatus;
AppLaunchParams::AppLaunchParams(Profile* profile,
const extensions::Extension* extension,
extensions::LaunchContainer container,
WindowOpenDisposition disposition,
extensions::AppLaunchSource source,
bool set_playstore_status)
extensions::AppLaunchSource source)
: profile(profile),
extension_id(extension ? extension->id() : std::string()),
container(container),
disposition(disposition),
command_line(base::CommandLine::NO_PROGRAM),
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
}
source(source) {}
AppLaunchParams::AppLaunchParams(const AppLaunchParams& other) = default;
......
......@@ -10,7 +10,6 @@
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "chrome/common/extensions/extension_constants.h"
#include "extensions/common/api/app_runtime.h"
#include "extensions/common/constants.h"
#include "ui/base/window_open_disposition.h"
#include "ui/gfx/geometry/rect.h"
......@@ -27,8 +26,7 @@ struct AppLaunchParams {
const extensions::Extension* extension,
extensions::LaunchContainer container,
WindowOpenDisposition disposition,
extensions::AppLaunchSource source,
bool set_playstore_status = false);
extensions::AppLaunchSource source);
AppLaunchParams(const AppLaunchParams& other);
......@@ -64,9 +62,6 @@ struct AppLaunchParams {
// Record where the app is launched from for tracking purpose.
// Different app may have their own enumeration of sources.
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
......
......@@ -299,15 +299,18 @@ WebContents* OpenEnabledApplication(const AppLaunchParams& params) {
const Extension* extension = GetExtension(params);
if (!extension)
return NULL;
Profile* profile = params.profile;
WebContents* tab = NULL;
ExtensionPrefs* prefs = ExtensionPrefs::Get(params.profile);
ExtensionPrefs* prefs = ExtensionPrefs::Get(profile);
prefs->SetActiveBit(extension->id(), true);
if (CanLaunchViaEvent(extension)) {
apps::LaunchPlatformAppWithCommandLine(
params.profile, extension, params.command_line,
params.current_directory, params.source, params.play_store_status);
apps::LaunchPlatformAppWithCommandLine(profile,
extension,
params.command_line,
params.current_directory,
params.source);
return NULL;
}
......@@ -323,7 +326,7 @@ WebContents* OpenEnabledApplication(const AppLaunchParams& params) {
// Record the launch time in the site engagement service. A recent bookmark
// app launch will provide an engagement boost to the origin.
SiteEngagementService* service = SiteEngagementService::Get(params.profile);
SiteEngagementService* service = SiteEngagementService::Get(profile);
if (service)
service->SetLastShortcutLaunchTime(url);
}
......
......@@ -53,11 +53,6 @@ bool ArcBridgeService::GetEnabled(const base::CommandLine* command_line) {
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) {
DCHECK(CalledOnValidThread());
observer_list_.AddObserver(observer);
......
......@@ -67,9 +67,6 @@ class ArcBridgeService {
// switch.
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
// launch an instance if the instance is enabled.
// This can only be called on the thread that this class was created on.
......
......@@ -8,7 +8,6 @@
#include <utility>
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram.h"
#include "base/time/time.h"
#include "base/values.h"
......@@ -139,16 +138,18 @@ void AppRuntimeEventRouter::DispatchOnLaunchedEvent(
BrowserContext* context,
const Extension* extension,
extensions::AppLaunchSource source,
std::unique_ptr<app_runtime::LaunchData> launch_data) {
if (!launch_data)
launch_data = base::MakeUnique<app_runtime::LaunchData>();
std::unique_ptr<app_runtime::ActionData> action_data) {
app_runtime::LaunchData launch_data;
app_runtime::LaunchSource source_enum = GetLaunchSourceEnum(source);
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,
launch_data->ToValue(), context);
launch_data.ToValue(), context);
}
// static
......
......@@ -27,7 +27,6 @@ namespace extensions {
namespace api {
namespace app_runtime {
struct ActionData;
struct LaunchData;
}
}
......@@ -48,7 +47,7 @@ class AppRuntimeEventRouter {
content::BrowserContext* context,
const Extension* extension,
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
// restored file entries from the previous run.
......
......@@ -47,16 +47,6 @@ namespace app.runtime {
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.
dictionary ActionData {
ActionType actionType;
......@@ -100,9 +90,6 @@ namespace app.runtime {
// launched with. This is null if the app was not launched with a specific
// action intent.
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
......
......@@ -96,8 +96,9 @@ void ShellExtensionSystem::LaunchApp(const ExtensionId& extension_id) {
const Extension* extension = ExtensionRegistry::Get(browser_context_)
->enabled_extensions()
.GetByID(extension_id);
AppRuntimeEventRouter::DispatchOnLaunchedEvent(browser_context_, extension,
SOURCE_UNTRACKED, nullptr);
AppRuntimeEventRouter::DispatchOnLaunchedEvent(
browser_context_, extension, SOURCE_UNTRACKED,
std::unique_ptr<api::app_runtime::ActionData>());
}
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