Remove all the ephemeral apps code.

BUG=517735

Review URL: https://codereview.chromium.org/1497193002

Cr-Commit-Position: refs/heads/master@{#363918}
diff --git a/chrome/browser/apps/app_browsertest.cc b/chrome/browser/apps/app_browsertest.cc
index c62cf7b..68adec3d 100644
--- a/chrome/browser/apps/app_browsertest.cc
+++ b/chrome/browser/apps/app_browsertest.cc
@@ -975,7 +975,6 @@
   void OnExtensionWillBeInstalled(content::BrowserContext* browser_context,
                                   const extensions::Extension* extension,
                                   bool is_update,
-                                  bool from_ephemeral,
                                   const std::string& old_name) override {
     EXPECT_FALSE(seen_);
     seen_ = true;
diff --git a/chrome/browser/apps/ephemeral_app_browsertest.cc b/chrome/browser/apps/ephemeral_app_browsertest.cc
deleted file mode 100644
index 2204ba6..0000000
--- a/chrome/browser/apps/ephemeral_app_browsertest.cc
+++ /dev/null
@@ -1,1051 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/apps/ephemeral_app_browsertest.h"
-
-#include <vector>
-
-#include "apps/app_restore_service.h"
-#include "apps/saved_files_service.h"
-#include "base/files/scoped_temp_dir.h"
-#include "base/scoped_observer.h"
-#include "base/stl_util.h"
-#include "chrome/browser/apps/app_browsertest_util.h"
-#include "chrome/browser/apps/ephemeral_app_service.h"
-#include "chrome/browser/extensions/api/file_system/file_system_api.h"
-#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/extensions/extension_sync_data.h"
-#include "chrome/browser/extensions/extension_sync_service.h"
-#include "chrome/browser/extensions/extension_util.h"
-#include "chrome/browser/notifications/notifier_state_tracker.h"
-#include "chrome/browser/notifications/notifier_state_tracker_factory.h"
-#include "content/public/browser/power_save_blocker.h"
-#include "content/public/test/browser_test.h"
-#include "content/public/test/test_utils.h"
-#include "extensions/browser/api/power/power_api.h"
-#include "extensions/browser/app_sorting.h"
-#include "extensions/browser/event_router.h"
-#include "extensions/browser/extension_prefs.h"
-#include "extensions/browser/extension_registry.h"
-#include "extensions/browser/extension_registry_observer.h"
-#include "extensions/browser/extension_system.h"
-#include "extensions/browser/extension_util.h"
-#include "extensions/browser/process_manager.h"
-#include "extensions/browser/test_extension_registry_observer.h"
-#include "extensions/browser/uninstall_reason.h"
-#include "extensions/common/api/alarms.h"
-#include "extensions/common/extension.h"
-#include "extensions/test/extension_test_message_listener.h"
-#include "extensions/test/result_catcher.h"
-#include "sync/api/fake_sync_change_processor.h"
-#include "sync/api/sync_change_processor_wrapper_for_test.h"
-#include "sync/api/sync_error_factory_mock.h"
-#include "ui/app_list/app_list_switches.h"
-#include "ui/message_center/message_center.h"
-#include "ui/message_center/notifier_settings.h"
-
-using extensions::AppSorting;
-using extensions::Event;
-using extensions::EventRouter;
-using extensions::Extension;
-using extensions::ExtensionPrefs;
-using extensions::ExtensionRegistry;
-using extensions::ExtensionRegistryObserver;
-using extensions::ExtensionSyncData;
-using extensions::ExtensionSystem;
-using extensions::Manifest;
-using extensions::ResultCatcher;
-
-namespace {
-
-namespace alarms = extensions::api::alarms;
-
-const char kPowerTestApp[] = "ephemeral_apps/power";
-
-// Enabling sync causes these tests to be flaky on Windows. Disable sync so that
-// everything else can be tested. See crbug.com/401028
-#if defined(OS_WIN)
-const bool kEnableSync = false;
-#else
-const bool kEnableSync = true;
-#endif
-
-typedef std::vector<message_center::Notifier*> NotifierList;
-
-bool IsNotifierInList(const message_center::NotifierId& notifier_id,
-                      const NotifierList& notifiers) {
-  for (NotifierList::const_iterator it = notifiers.begin();
-       it != notifiers.end(); ++it) {
-    const message_center::Notifier* notifier = *it;
-    if (notifier->notifier_id == notifier_id)
-      return true;
-  }
-
-  return false;
-}
-
-// Saves some parameters from the extension installed notification in order
-// to verify them in tests.
-class InstallObserver : public ExtensionRegistryObserver {
- public:
-  struct InstallParameters {
-    std::string id;
-    bool is_update;
-    bool from_ephemeral;
-
-    InstallParameters(
-        const std::string& id,
-        bool is_update,
-        bool from_ephemeral)
-          : id(id), is_update(is_update), from_ephemeral(from_ephemeral) {}
-  };
-
-  explicit InstallObserver(Profile* profile) : registry_observer_(this) {
-    registry_observer_.Add(ExtensionRegistry::Get(profile));
-  }
-
-  ~InstallObserver() override {}
-
-  const InstallParameters& Last() {
-    CHECK(!install_params_.empty());
-    return install_params_.back();
-  }
-
- private:
-  void OnExtensionWillBeInstalled(content::BrowserContext* browser_context,
-                                  const Extension* extension,
-                                  bool is_update,
-                                  bool from_ephemeral,
-                                  const std::string& old_name) override {
-    install_params_.push_back(
-        InstallParameters(extension->id(), is_update, from_ephemeral));
-  }
-
-  std::vector<InstallParameters> install_params_;
-  ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
-      registry_observer_;
-};
-
-// Instead of actually changing the system power settings, tests will just
-// issue requests to this mock.
-class PowerSettingsMock {
- public:
-  PowerSettingsMock() : keep_awake_count_(0) {}
-
-  void request_keep_awake() { ++keep_awake_count_; }
-
-  void release_keep_awake() {
-    --keep_awake_count_;
-    ASSERT_GE(keep_awake_count_, 0);
-  }
-
-  int keep_awake_count() const { return keep_awake_count_; }
-
- private:
-  int keep_awake_count_;
-
-  DISALLOW_COPY_AND_ASSIGN(PowerSettingsMock);
-};
-
-// Stub implementation of content::PowerSaveBlocker that updates the
-// PowerSettingsMock.
-class PowerSaveBlockerStub : public content::PowerSaveBlocker {
- public:
-  explicit PowerSaveBlockerStub(PowerSettingsMock* power_settings)
-      : power_settings_(power_settings) {
-    power_settings_->request_keep_awake();
-  }
-
-  ~PowerSaveBlockerStub() override { power_settings_->release_keep_awake(); }
-
-  static scoped_ptr<PowerSaveBlocker> Create(PowerSettingsMock* power_settings,
-                                             PowerSaveBlockerType type,
-                                             Reason reason,
-                                             const std::string& description) {
-    return scoped_ptr<PowerSaveBlocker>(
-        new PowerSaveBlockerStub(power_settings));
-  }
-
- private:
-  PowerSettingsMock* power_settings_;  // Not owned.
-
-  DISALLOW_COPY_AND_ASSIGN(PowerSaveBlockerStub);
-};
-
-}  // namespace
-
-
-// EphemeralAppTestBase:
-
-const char EphemeralAppTestBase::kMessagingReceiverApp[] =
-    "ephemeral_apps/messaging_receiver";
-const char EphemeralAppTestBase::kMessagingReceiverAppV2[] =
-    "ephemeral_apps/messaging_receiver2";
-const char EphemeralAppTestBase::kDispatchEventTestApp[] =
-    "ephemeral_apps/dispatch_event";
-const char EphemeralAppTestBase::kNotificationsTestApp[] =
-    "ephemeral_apps/notification_settings";
-const char EphemeralAppTestBase::kFileSystemTestApp[] =
-    "ephemeral_apps/filesystem_retain_entries";
-
-EphemeralAppTestBase::EphemeralAppTestBase() {}
-
-EphemeralAppTestBase::~EphemeralAppTestBase() {}
-
-void EphemeralAppTestBase::SetUpCommandLine(base::CommandLine* command_line) {
-  // Skip PlatformAppBrowserTest, which sets different values for the switches
-  // below.
-  ExtensionBrowserTest::SetUpCommandLine(command_line);
-
-  // Make event pages get suspended immediately.
-  extensions::ProcessManager::SetEventPageIdleTimeForTesting(1);
-  extensions::ProcessManager::SetEventPageSuspendingTimeForTesting(1);
-
-  // Enable ephemeral apps, which are gated by the experimental app launcher
-  // flag.
-  command_line->AppendSwitch(app_list::switches::kEnableExperimentalAppList);
-}
-
-void EphemeralAppTestBase::SetUpOnMainThread() {
-  PlatformAppBrowserTest::SetUpOnMainThread();
-
-  // Disable ephemeral apps immediately after they stop running in tests.
-  EphemeralAppService::Get(profile())->set_disable_delay_for_test(0);
-}
-
-base::FilePath EphemeralAppTestBase::GetTestPath(const char* test_path) {
-  return test_data_dir_.AppendASCII("platform_apps").AppendASCII(test_path);
-}
-
-const Extension* EphemeralAppTestBase::InstallEphemeralApp(
-    const char* test_path, Manifest::Location manifest_location) {
-  const Extension* extension = InstallEphemeralAppWithSourceAndFlags(
-      GetTestPath(test_path), 1, manifest_location, Extension::NO_FLAGS);
-  EXPECT_TRUE(extension);
-  if (extension)
-    EXPECT_TRUE(extensions::util::IsEphemeralApp(extension->id(), profile()));
-  return extension;
-}
-
-const Extension* EphemeralAppTestBase::InstallEphemeralApp(
-    const char* test_path) {
-  return InstallEphemeralApp(test_path, Manifest::INTERNAL);
-}
-
-const Extension* EphemeralAppTestBase::InstallAndLaunchEphemeralApp(
-    const char* test_path) {
-  ExtensionTestMessageListener launched_listener("launched", false);
-  const Extension* extension = InstallEphemeralApp(test_path);
-  EXPECT_TRUE(extension);
-  if (!extension)
-    return NULL;
-
-  LaunchPlatformApp(extension);
-  bool wait_result = launched_listener.WaitUntilSatisfied();
-  EXPECT_TRUE(wait_result);
-  if (!wait_result)
-    return NULL;
-
-  return extension;
-}
-
-const Extension* EphemeralAppTestBase::UpdateEphemeralApp(
-    const std::string& app_id,
-    const base::FilePath& test_dir,
-    const base::FilePath& pem_path) {
-  // Pack a new version of the app.
-  base::ScopedTempDir temp_dir;
-  EXPECT_TRUE(temp_dir.CreateUniqueTempDir());
-
-  base::FilePath crx_path = temp_dir.path().AppendASCII("temp.crx");
-  if (!base::DeleteFile(crx_path, false)) {
-    ADD_FAILURE() << "Failed to delete existing crx: " << crx_path.value();
-    return NULL;
-  }
-
-  base::FilePath app_v2_path = PackExtensionWithOptions(
-      test_dir, crx_path, pem_path, base::FilePath());
-  EXPECT_FALSE(app_v2_path.empty());
-
-  // Update the ephemeral app and wait for the update to finish.
-  extensions::CrxInstaller* crx_installer = NULL;
-  content::WindowedNotificationObserver windowed_observer(
-      extensions::NOTIFICATION_CRX_INSTALLER_DONE,
-      content::Source<extensions::CrxInstaller>(crx_installer));
-  ExtensionService* service =
-      ExtensionSystem::Get(profile())->extension_service();
-  EXPECT_TRUE(service->UpdateExtension(
-      extensions::CRXFileInfo(app_id, app_v2_path), true, &crx_installer));
-  windowed_observer.Wait();
-
-  return ExtensionRegistry::Get(profile())
-      ->GetExtensionById(app_id, ExtensionRegistry::EVERYTHING);
-}
-
-void EphemeralAppTestBase::PromoteEphemeralApp(
-    const extensions::Extension* app) {
-  ExtensionService* extension_service =
-      ExtensionSystem::Get(profile())->extension_service();
-  ASSERT_TRUE(extension_service);
-  extension_service->PromoteEphemeralApp(app, false);
-}
-
-void EphemeralAppTestBase::DisableEphemeralApp(
-    const Extension* app,
-    Extension::DisableReason disable_reason) {
-  ExtensionSystem::Get(profile())->extension_service()->DisableExtension(
-      app->id(), disable_reason);
-
-  ASSERT_TRUE(ExtensionRegistry::Get(profile())->disabled_extensions().Contains(
-      app->id()));
-}
-
-void EphemeralAppTestBase::CloseApp(const std::string& app_id) {
-  EXPECT_EQ(1U, GetAppWindowCountForApp(app_id));
-  extensions::AppWindow* app_window = GetFirstAppWindowForApp(app_id);
-  ASSERT_TRUE(app_window);
-  CloseAppWindow(app_window);
-}
-
-void EphemeralAppTestBase::CloseAppWaitForUnload(const std::string& app_id) {
-  // Ephemeral apps are unloaded from extension system after they stop running.
-  extensions::TestExtensionRegistryObserver observer(
-      ExtensionRegistry::Get(profile()), app_id);
-  CloseApp(app_id);
-  observer.WaitForExtensionUnloaded();
-}
-
-void EphemeralAppTestBase::EvictApp(const std::string& app_id) {
-  // Uninstall the app, which is what happens when ephemeral apps get evicted
-  // from the cache.
-  extensions::TestExtensionRegistryObserver observer(
-      ExtensionRegistry::Get(profile()), app_id);
-
-  ExtensionService* service =
-      ExtensionSystem::Get(profile())->extension_service();
-  ASSERT_TRUE(service);
-  service->UninstallExtension(
-      app_id,
-      extensions::UNINSTALL_REASON_ORPHANED_EPHEMERAL_EXTENSION,
-      base::Bind(&base::DoNothing),
-      NULL);
-
-  observer.WaitForExtensionUninstalled();
-}
-
-// EphemeralAppBrowserTest:
-
-class EphemeralAppBrowserTest : public EphemeralAppTestBase {
- protected:
-  bool LaunchAppAndRunTest(const Extension* app, const char* test_name) {
-    // Ephemeral apps are unloaded after they are closed. Ensure they are
-    // enabled before launch.
-    ExtensionService* service =
-        ExtensionSystem::Get(profile())->extension_service();
-    service->EnableExtension(app->id());
-
-    ExtensionTestMessageListener launched_listener("launched", true);
-    LaunchPlatformApp(app);
-    if (!launched_listener.WaitUntilSatisfied()) {
-      message_ = "Failed to receive launched message from test";
-      return false;
-    }
-
-    ResultCatcher catcher;
-    launched_listener.Reply(test_name);
-
-    bool result = catcher.GetNextResult();
-    message_ = catcher.message();
-
-    CloseAppWaitForUnload(app->id());
-    return result;
-  }
-
-  // Verify that the event page of the app has not been loaded.
-  void VerifyAppNotLoaded(const std::string& app_id) {
-    EXPECT_FALSE(extensions::ProcessManager::Get(profile())
-                     ->GetBackgroundHostForExtension(app_id));
-  }
-
-  // Verify properties of ephemeral apps.
-  void VerifyEphemeralApp(const std::string& app_id) {
-    EXPECT_TRUE(extensions::util::IsEphemeralApp(app_id, profile()));
-
-    // Ephemeral apps should not be synced.
-    scoped_ptr<ExtensionSyncData> sync_change = GetLastSyncChangeForApp(app_id);
-    EXPECT_FALSE(sync_change.get());
-
-    // Ephemeral apps should not be assigned ordinals.
-    AppSorting* app_sorting = ExtensionSystem::Get(profile())->app_sorting();
-    EXPECT_FALSE(app_sorting->GetAppLaunchOrdinal(app_id).IsValid());
-    EXPECT_FALSE(app_sorting->GetPageOrdinal(app_id).IsValid());
-  }
-
-  // Verify that after ephemeral apps stop running, they reside in extension
-  // system in a disabled and unloaded state.
-  void VerifyInactiveEphemeralApp(const std::string& app_id) {
-    EXPECT_TRUE(
-        ExtensionRegistry::Get(profile())->disabled_extensions().Contains(
-            app_id));
-
-    ExtensionPrefs* prefs = ExtensionPrefs::Get(profile());
-    EXPECT_TRUE(prefs->IsExtensionDisabled(app_id));
-    EXPECT_NE(0,
-              prefs->GetDisableReasons(app_id) &
-                  Extension::DISABLE_INACTIVE_EPHEMERAL_APP);
-  }
-
-  // Verify the state of an app that has been promoted from an ephemeral to a
-  // fully installed app.
-  void VerifyPromotedApp(const std::string& app_id,
-                         ExtensionRegistry::IncludeFlag expected_set) {
-    const Extension* app = ExtensionRegistry::Get(profile())
-                               ->GetExtensionById(app_id, expected_set);
-    ASSERT_TRUE(app) << "App not found in expected set: " << expected_set;
-
-    // The app should not be ephemeral.
-    ExtensionPrefs* prefs = ExtensionPrefs::Get(profile());
-    ASSERT_TRUE(prefs);
-    EXPECT_FALSE(prefs->IsEphemeralApp(app_id));
-    EXPECT_EQ(0,
-              prefs->GetDisableReasons(app_id) &
-                  Extension::DISABLE_INACTIVE_EPHEMERAL_APP);
-
-    // Check sort ordinals.
-    AppSorting* app_sorting = ExtensionSystem::Get(profile())->app_sorting();
-    EXPECT_TRUE(app_sorting->GetAppLaunchOrdinal(app_id).IsValid());
-    EXPECT_TRUE(app_sorting->GetPageOrdinal(app_id).IsValid());
-  }
-
-  // Dispatch a fake alarm event to the app.
-  void DispatchAlarmEvent(EventRouter* event_router,
-                          const std::string& app_id) {
-    alarms::Alarm dummy_alarm;
-    dummy_alarm.name = "test_alarm";
-
-    scoped_ptr<base::ListValue> args(new base::ListValue());
-    args->Append(dummy_alarm.ToValue().release());
-    scoped_ptr<Event> event(new Event(extensions::events::ALARMS_ON_ALARM,
-                                      alarms::OnAlarm::kEventName,
-                                      args.Pass()));
-
-    event_router->DispatchEventToExtension(app_id, event.Pass());
-  }
-
-  // Simulates the scenario where an app is installed, via the normal
-  // installation route, on top of an ephemeral app. This can occur due to race
-  // conditions.
-  const Extension* ReplaceEphemeralApp(const std::string& app_id,
-                                       const char* test_path,
-                                       int expected_enabled_change) {
-    return UpdateExtensionWaitForIdle(
-        app_id, GetTestPath(test_path), expected_enabled_change);
-  }
-
-  void PromoteEphemeralAppAndVerify(
-      const Extension* app,
-      ExtensionRegistry::IncludeFlag expected_set,
-      bool expect_sync_enabled) {
-    ASSERT_TRUE(app);
-
-    // Ephemeral apps should not be synced.
-    scoped_ptr<ExtensionSyncData> sync_change =
-        GetLastSyncChangeForApp(app->id());
-    EXPECT_FALSE(sync_change.get());
-
-    // Promote the app to a regular installed app.
-    InstallObserver installed_observer(profile());
-    PromoteEphemeralApp(app);
-    VerifyPromotedApp(app->id(), expected_set);
-
-    // Check the notification parameters.
-    const InstallObserver::InstallParameters& params =
-        installed_observer.Last();
-    EXPECT_EQ(app->id(), params.id);
-    EXPECT_TRUE(params.is_update);
-    EXPECT_TRUE(params.from_ephemeral);
-
-    // The installation should now be synced.
-    sync_change = GetLastSyncChangeForApp(app->id());
-    VerifySyncChange(sync_change.get(), expect_sync_enabled);
-  }
-
-  void PromoteEphemeralAppAndVerify(
-      const Extension* app,
-      ExtensionRegistry::IncludeFlag expected_set) {
-    PromoteEphemeralAppAndVerify(app, expected_set,
-                                 expected_set == ExtensionRegistry::ENABLED);
-  }
-
-  void PromoteEphemeralAppFromSyncAndVerify(
-      const Extension* app,
-      bool enable_from_sync,
-      ExtensionRegistry::IncludeFlag expected_set) {
-    ASSERT_TRUE(app);
-
-    // Simulate an install from sync.
-    int disable_reasons = enable_from_sync ? 0 : Extension::DISABLE_USER_ACTION;
-    const syncer::StringOrdinal kAppLaunchOrdinal("x");
-    const syncer::StringOrdinal kPageOrdinal("y");
-    ExtensionSyncData app_sync_data(
-        *app,
-        enable_from_sync,
-        disable_reasons,
-        false /* incognito enabled */,
-        false /* remote install */,
-        extensions::ExtensionSyncData::BOOLEAN_UNSET,
-        kAppLaunchOrdinal,
-        kPageOrdinal,
-        extensions::LAUNCH_TYPE_REGULAR);
-
-    std::string app_id = app->id();
-    app = NULL;
-
-    ExtensionSyncService::Get(profile())->ProcessSyncChanges(
-        FROM_HERE,
-        syncer::SyncChangeList(
-            1, app_sync_data.GetSyncChange(syncer::SyncChange::ACTION_ADD)));
-
-    // Verify the installation.
-    VerifyPromotedApp(app_id, expected_set);
-
-    // The sort ordinals from sync should not be overridden.
-    AppSorting* app_sorting = ExtensionSystem::Get(profile())->app_sorting();
-    EXPECT_TRUE(
-        app_sorting->GetAppLaunchOrdinal(app_id).Equals(kAppLaunchOrdinal));
-    EXPECT_TRUE(app_sorting->GetPageOrdinal(app_id).Equals(kPageOrdinal));
-  }
-
-  void InitSyncService() {
-    if (!kEnableSync)
-      return;
-
-    ExtensionSyncService* sync_service = ExtensionSyncService::Get(profile());
-    sync_service->MergeDataAndStartSyncing(
-        syncer::APPS,
-        syncer::SyncDataList(),
-        scoped_ptr<syncer::SyncChangeProcessor>(
-            new syncer::SyncChangeProcessorWrapperForTest(
-                &mock_sync_processor_)),
-        scoped_ptr<syncer::SyncErrorFactory>(
-            new syncer::SyncErrorFactoryMock()));
-  }
-
-  scoped_ptr<ExtensionSyncData> GetLastSyncChangeForApp(const std::string& id) {
-    scoped_ptr<ExtensionSyncData> sync_data;
-    for (syncer::SyncChangeList::iterator it =
-             mock_sync_processor_.changes().begin();
-         it != mock_sync_processor_.changes().end(); ++it) {
-      scoped_ptr<ExtensionSyncData> data(
-          ExtensionSyncData::CreateFromSyncChange(*it));
-      if (data.get() && data->id() == id)
-        sync_data.reset(data.release());
-    }
-
-    return sync_data.Pass();
-  }
-
-  void VerifySyncChange(const ExtensionSyncData* sync_change,
-                        bool expect_enabled) {
-    if (!kEnableSync)
-      return;
-
-    ASSERT_TRUE(sync_change);
-    EXPECT_TRUE(sync_change->page_ordinal().IsValid());
-    EXPECT_TRUE(sync_change->app_launch_ordinal().IsValid());
-    EXPECT_FALSE(sync_change->uninstalled());
-    EXPECT_EQ(expect_enabled, sync_change->enabled());
-  }
-
-  void TestInstallEvent(bool close_app) {
-    ExtensionTestMessageListener first_msg_listener(false);
-    const Extension* app = InstallAndLaunchEphemeralApp(kDispatchEventTestApp);
-    ASSERT_TRUE(app);
-
-    // When an ephemeral app is first added, it should not receive the
-    // onInstalled event, hence the first message received from the test should
-    // be "launched" and not "installed".
-    ASSERT_TRUE(first_msg_listener.WaitUntilSatisfied());
-    EXPECT_EQ(std::string("launched"), first_msg_listener.message());
-
-    if (close_app)
-      CloseAppWaitForUnload(app->id());
-
-    // When installed permanently, the app should receive the onInstalled event.
-    ExtensionTestMessageListener install_listener("installed", false);
-    PromoteEphemeralApp(app);
-    ASSERT_TRUE(install_listener.WaitUntilSatisfied());
-  }
-
- private:
-  syncer::FakeSyncChangeProcessor mock_sync_processor_;
-};
-
-// Verify that ephemeral apps can be launched and receive system events when
-// they are running. Once they are inactive they should not receive system
-// events.
-IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest, EventDispatchWhenLaunched) {
-  const Extension* extension =
-      InstallAndLaunchEphemeralApp(kDispatchEventTestApp);
-  ASSERT_TRUE(extension);
-
-  // Send a fake alarm event to the app and verify that a response is
-  // received.
-  EventRouter* event_router = EventRouter::Get(profile());
-  ASSERT_TRUE(event_router);
-
-  ExtensionTestMessageListener alarm_received_listener("alarm_received", false);
-  DispatchAlarmEvent(event_router, extension->id());
-  ASSERT_TRUE(alarm_received_listener.WaitUntilSatisfied());
-
-  CloseAppWaitForUnload(extension->id());
-
-  // Dispatch the alarm event again and verify that the event page did not get
-  // loaded for the app.
-  DispatchAlarmEvent(event_router, extension->id());
-  VerifyAppNotLoaded(extension->id());
-}
-
-// Verify that ephemeral apps will receive messages while they are running.
-// Flaky test: crbug.com/394426
-IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest,
-                       DISABLED_ReceiveMessagesWhenLaunched) {
-  const Extension* receiver =
-      InstallAndLaunchEphemeralApp(kMessagingReceiverApp);
-  ASSERT_TRUE(receiver);
-
-  // Verify that messages are received while the app is running.
-  ResultCatcher result_catcher;
-  LoadAndLaunchPlatformApp("ephemeral_apps/messaging_sender_success",
-                           "Launched");
-  EXPECT_TRUE(result_catcher.GetNextResult());
-
-  CloseAppWaitForUnload(receiver->id());
-
-  // Verify that messages are not received while the app is inactive.
-  LoadAndLaunchPlatformApp("ephemeral_apps/messaging_sender_fail", "Launched");
-  EXPECT_TRUE(result_catcher.GetNextResult());
-}
-
-// Verifies that the chrome.runtime.onInstalled() event is received by a running
-// ephemeral app only when it is promoted.
-IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest,
-                       InstallEventReceivedWhileRunning) {
-  TestInstallEvent(false /* close app */);
-}
-
-// Verifies that when an idle ephemeral app is promoted, it will be loaded to
-// receive the chrome.runtime.onInstalled() event.
-IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest, InstallEventReceivedWhileIdle) {
-  TestInstallEvent(true /* close app */);
-}
-
-// Verifies that the chrome.runtime.onRestarted() event is received by an
-// ephemeral app.
-IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest, RestartEventReceived) {
-  const Extension* app = InstallAndLaunchEphemeralApp(kDispatchEventTestApp);
-  ASSERT_TRUE(app);
-  CloseAppWaitForUnload(app->id());
-
-  // Fake ephemeral app running before restart.
-  ExtensionSystem::Get(profile())->extension_service()->EnableExtension(
-      app->id());
-  ASSERT_TRUE(ExtensionRegistry::Get(profile())->enabled_extensions().Contains(
-      app->id()));
-  ExtensionPrefs::Get(profile())->SetExtensionRunning(app->id(), true);
-
-  ExtensionTestMessageListener restart_listener("restarted", false);
-  apps::AppRestoreService::Get(profile())->HandleStartup(true);
-  EXPECT_TRUE(restart_listener.WaitUntilSatisfied());
-}
-
-// Verify that an updated ephemeral app will still have its ephemeral flag
-// enabled.
-IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest, UpdateEphemeralApp) {
-  InitSyncService();
-
-  const Extension* app_v1 = InstallAndLaunchEphemeralApp(kMessagingReceiverApp);
-  ASSERT_TRUE(app_v1);
-  VerifyEphemeralApp(app_v1->id());
-  CloseAppWaitForUnload(app_v1->id());
-  VerifyInactiveEphemeralApp(app_v1->id());
-
-  std::string app_id = app_v1->id();
-  base::Version app_original_version = *app_v1->version();
-
-  // Update to version 2 of the app.
-  app_v1 = NULL;  // The extension object will be destroyed during update.
-  InstallObserver installed_observer(profile());
-  const Extension* app_v2 =
-      UpdateEphemeralApp(app_id,
-                         GetTestPath(kMessagingReceiverAppV2),
-                         GetTestPath(kMessagingReceiverApp)
-                             .ReplaceExtension(FILE_PATH_LITERAL(".pem")));
-
-  // Check the notification parameters.
-  const InstallObserver::InstallParameters& params = installed_observer.Last();
-  EXPECT_EQ(app_id, params.id);
-  EXPECT_TRUE(params.is_update);
-  EXPECT_FALSE(params.from_ephemeral);
-
-  // The ephemeral flag should still be set.
-  ASSERT_TRUE(app_v2);
-  EXPECT_GT(app_v2->version()->CompareTo(app_original_version), 0);
-  VerifyEphemeralApp(app_id);
-
-  // The app should still be disabled in extension system.
-  VerifyInactiveEphemeralApp(app_id);
-}
-
-// Verify that if notifications have been disabled for an ephemeral app, it will
-// remain disabled even after being evicted from the cache.
-IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest, StickyNotificationSettings) {
-  const Extension* app = InstallAndLaunchEphemeralApp(kNotificationsTestApp);
-  ASSERT_TRUE(app);
-
-  // Disable notifications for this app.
-  NotifierStateTracker* notifier_state_tracker =
-      NotifierStateTrackerFactory::GetForProfile(profile());
-  ASSERT_TRUE(notifier_state_tracker);
-
-  message_center::NotifierId notifier_id(
-      message_center::NotifierId::APPLICATION, app->id());
-  EXPECT_TRUE(notifier_state_tracker->IsNotifierEnabled(notifier_id));
-  notifier_state_tracker->SetNotifierEnabled(notifier_id, false);
-  EXPECT_FALSE(notifier_state_tracker->IsNotifierEnabled(notifier_id));
-
-  // Remove the app.
-  CloseAppWaitForUnload(app->id());
-  EvictApp(app->id());
-
-  // Reinstall the ephemeral app and verify that notifications remain disabled.
-  app = InstallEphemeralApp(kNotificationsTestApp);
-  ASSERT_TRUE(app);
-  message_center::NotifierId reinstalled_notifier_id(
-      message_center::NotifierId::APPLICATION, app->id());
-  EXPECT_FALSE(notifier_state_tracker->IsNotifierEnabled(
-      reinstalled_notifier_id));
-}
-
-// Verify that only running ephemeral apps will appear in the Notification
-// Settings UI. Inactive, cached ephemeral apps should not appear.
-IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest,
-                       IncludeRunningEphemeralAppsInNotifiers) {
-  message_center::NotifierSettingsProvider* settings_provider =
-      message_center::MessageCenter::Get()->GetNotifierSettingsProvider();
-  DCHECK(settings_provider);
-
-  const Extension* app = InstallAndLaunchEphemeralApp(kNotificationsTestApp);
-  ASSERT_TRUE(app);
-  message_center::NotifierId notifier_id(
-      message_center::NotifierId::APPLICATION, app->id());
-
-  // Since the ephemeral app is running, it should be included in the list
-  // of notifiers to show in the UI.
-  NotifierList notifiers;
-  STLElementDeleter<NotifierList> notifier_deleter(&notifiers);
-
-  settings_provider->GetNotifierList(&notifiers);
-  EXPECT_TRUE(IsNotifierInList(notifier_id, notifiers));
-  STLDeleteElements(&notifiers);
-
-  // Close the ephemeral app.
-  CloseAppWaitForUnload(app->id());
-
-  // Inactive ephemeral apps should not be included in the list of notifiers to
-  // show in the UI.
-  settings_provider->GetNotifierList(&notifiers);
-  EXPECT_FALSE(IsNotifierInList(notifier_id, notifiers));
-}
-
-// Verify that ephemeral apps will have no ability to retain file entries after
-// close. Normal retainEntry behavior for installed apps is tested in
-// FileSystemApiTest.
-IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest,
-                       DisableRetainFileSystemEntries) {
-  // Create a dummy file that we can just return to the test.
-  base::ScopedTempDir temp_dir;
-  ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
-  base::FilePath temp_file;
-  ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir.path(), &temp_file));
-
-  using extensions::FileSystemChooseEntryFunction;
-  FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest(
-      &temp_file);
-  // The temporary file needs to be registered for the tests to pass on
-  // ChromeOS.
-  FileSystemChooseEntryFunction::RegisterTempExternalFileSystemForTest(
-      "temp", temp_dir.path());
-
-  // The first test opens the file and writes the file handle to local storage.
-  const Extension* app = InstallEphemeralApp(kFileSystemTestApp,
-                                             Manifest::UNPACKED);
-  ASSERT_TRUE(LaunchAppAndRunTest(app, "OpenAndRetainFile")) << message_;
-
-  // Verify that after the app has been closed, all retained entries are
-  // flushed.
-  std::vector<apps::SavedFileEntry> file_entries =
-      apps::SavedFilesService::Get(profile())
-          ->GetAllFileEntries(app->id());
-  EXPECT_TRUE(file_entries.empty());
-
-  // The second test verifies that the file cannot be reopened.
-  ASSERT_TRUE(LaunchAppAndRunTest(app, "RestoreRetainedFile")) << message_;
-}
-
-// Checks the process of launching an ephemeral app and then promoting the app
-// while it is running.
-IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest, PromoteAppWhileRunning) {
-  InitSyncService();
-
-  const Extension* app = InstallAndLaunchEphemeralApp(kNotificationsTestApp);
-  ASSERT_TRUE(app);
-
-  PromoteEphemeralAppAndVerify(app, ExtensionRegistry::ENABLED);
-
-  // Ensure that the app is not unloaded and disabled after it is closed.
-  CloseApp(app->id());
-  VerifyPromotedApp(app->id(), ExtensionRegistry::ENABLED);
-}
-
-// Checks the process of launching an ephemeral app and then promoting the app
-// while it is idle.
-IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest, PromoteAppWhileIdle) {
-  InitSyncService();
-
-  const Extension* app = InstallAndLaunchEphemeralApp(kNotificationsTestApp);
-  ASSERT_TRUE(app);
-  CloseAppWaitForUnload(app->id());
-  VerifyInactiveEphemeralApp(app->id());
-
-  PromoteEphemeralAppAndVerify(app, ExtensionRegistry::ENABLED);
-}
-
-// Verifies that promoting an ephemeral app that was disabled due to a
-// permissions increase will enable it.
-IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest, PromoteAppAndGrantPermissions) {
-  InitSyncService();
-
-  const Extension* app = InstallAndLaunchEphemeralApp(kNotificationsTestApp);
-  ASSERT_TRUE(app);
-  CloseAppWaitForUnload(app->id());
-  DisableEphemeralApp(app, Extension::DISABLE_PERMISSIONS_INCREASE);
-
-  PromoteEphemeralAppAndVerify(app, ExtensionRegistry::ENABLED);
-  EXPECT_FALSE(ExtensionPrefs::Get(profile())
-                   ->DidExtensionEscalatePermissions(app->id()));
-}
-
-// Verifies that promoting an ephemeral app that has unsupported requirements
-// will not enable it.
-IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest,
-                       PromoteUnsupportedEphemeralApp) {
-  InitSyncService();
-
-  const Extension* app = InstallAndLaunchEphemeralApp(kNotificationsTestApp);
-  ASSERT_TRUE(app);
-  CloseAppWaitForUnload(app->id());
-  DisableEphemeralApp(app, Extension::DISABLE_UNSUPPORTED_REQUIREMENT);
-
-  // When promoted to a regular installed app, it should remain disabled.
-  // However, DISABLE_UNSUPPORTED_REQUIREMENT is not a syncable disable reason,
-  // so sync should still say "enabled".
-  bool expect_sync_enabled = true;
-  PromoteEphemeralAppAndVerify(app, ExtensionRegistry::DISABLED,
-                               expect_sync_enabled);
-}
-
-// Verifies that promoting an ephemeral app that is blacklisted will not enable
-// it.
-IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest,
-                       PromoteBlacklistedEphemeralApp) {
-  InitSyncService();
-
-  const Extension* app = InstallAndLaunchEphemeralApp(kNotificationsTestApp);
-  ASSERT_TRUE(app);
-  CloseAppWaitForUnload(app->id());
-
-  ExtensionService* service =
-      ExtensionSystem::Get(profile())->extension_service();
-  service->BlacklistExtensionForTest(app->id());
-  ASSERT_TRUE(
-      ExtensionRegistry::Get(profile())->blacklisted_extensions().Contains(
-          app->id()));
-
-  // When promoted to a regular installed app, it should remain blacklisted.
-  PromoteEphemeralAppAndVerify(app, ExtensionRegistry::BLACKLISTED);
-
-  // The app should be synced, but disabled.
-  scoped_ptr<ExtensionSyncData> sync_change =
-      GetLastSyncChangeForApp(app->id());
-  VerifySyncChange(sync_change.get(), false);
-}
-
-// Checks the process of promoting an ephemeral app from sync while the app is
-// running.
-IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest,
-                       PromoteAppFromSyncWhileRunning) {
-  InitSyncService();
-
-  const Extension* app = InstallAndLaunchEphemeralApp(kNotificationsTestApp);
-  ASSERT_TRUE(app);
-
-  PromoteEphemeralAppFromSyncAndVerify(app, true, ExtensionRegistry::ENABLED);
-
-  // Ensure that the app is not unloaded and disabled after it is closed.
-  CloseApp(app->id());
-  VerifyPromotedApp(app->id(), ExtensionRegistry::ENABLED);
-}
-
-// Checks the process of promoting an ephemeral app from sync while the app is
-// idle.
-IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest, PromoteAppFromSyncWhileIdle) {
-  InitSyncService();
-
-  const Extension* app = InstallAndLaunchEphemeralApp(kNotificationsTestApp);
-  ASSERT_TRUE(app);
-  CloseAppWaitForUnload(app->id());
-  VerifyInactiveEphemeralApp(app->id());
-
-  PromoteEphemeralAppFromSyncAndVerify(app, true, ExtensionRegistry::ENABLED);
-}
-
-// Checks the process of promoting an ephemeral app from sync, where the app
-// from sync is disabled, and the ephemeral app is running.
-IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest,
-                       PromoteDisabledAppFromSyncWhileRunning) {
-  InitSyncService();
-
-  const Extension* app = InstallAndLaunchEphemeralApp(kNotificationsTestApp);
-  ASSERT_TRUE(app);
-
-  PromoteEphemeralAppFromSyncAndVerify(app, false, ExtensionRegistry::DISABLED);
-}
-
-// Checks the process of promoting an ephemeral app from sync, where the app
-// from sync is disabled, and the ephemeral app is idle.
-IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest,
-                       PromoteDisabledAppFromSyncWhileIdle) {
-  InitSyncService();
-
-  const Extension* app = InstallAndLaunchEphemeralApp(kNotificationsTestApp);
-  ASSERT_TRUE(app);
-  CloseAppWaitForUnload(app->id());
-  VerifyInactiveEphemeralApp(app->id());
-
-  PromoteEphemeralAppFromSyncAndVerify(app, false, ExtensionRegistry::DISABLED);
-}
-
-// In most cases, ExtensionService::PromoteEphemeralApp() will be called to
-// permanently install an ephemeral app. However, there may be cases where an
-// install occurs through the usual route of installing from the Web Store (due
-// to race conditions). Ensure that the app is still installed correctly.
-IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest,
-                       ReplaceEphemeralAppWithInstalledApp) {
-  InitSyncService();
-
-  const Extension* app = InstallAndLaunchEphemeralApp(kNotificationsTestApp);
-  ASSERT_TRUE(app);
-  CloseAppWaitForUnload(app->id());
-  std::string app_id = app->id();
-  app = NULL;
-
-  InstallObserver installed_observer(profile());
-  ReplaceEphemeralApp(app_id, kNotificationsTestApp, 1);
-  VerifyPromotedApp(app_id, ExtensionRegistry::ENABLED);
-
-  // Check the notification parameters.
-  const InstallObserver::InstallParameters& params = installed_observer.Last();
-  EXPECT_EQ(app_id, params.id);
-  EXPECT_TRUE(params.is_update);
-  EXPECT_TRUE(params.from_ephemeral);
-}
-
-// This is similar to ReplaceEphemeralAppWithInstalledApp, but installs will
-// be delayed until the app is idle.
-IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest,
-                       ReplaceEphemeralAppWithDelayedInstalledApp) {
-  InitSyncService();
-  const Extension* app = InstallAndLaunchEphemeralApp(kNotificationsTestApp);
-  ASSERT_TRUE(app);
-  std::string app_id = app->id();
-  app = NULL;
-
-  // Initiate install.
-  ReplaceEphemeralApp(app_id, kNotificationsTestApp, 0);
-
-  // The delayed installation will occur when the ephemeral app is closed.
-  extensions::TestExtensionRegistryObserver observer(
-      ExtensionRegistry::Get(profile()), app_id);
-  InstallObserver installed_observer(profile());
-  CloseAppWaitForUnload(app_id);
-  observer.WaitForExtensionWillBeInstalled();
-  VerifyPromotedApp(app_id, ExtensionRegistry::ENABLED);
-
-  // Check the notification parameters.
-  const InstallObserver::InstallParameters& params = installed_observer.Last();
-  EXPECT_EQ(app_id, params.id);
-  EXPECT_TRUE(params.is_update);
-  EXPECT_TRUE(params.from_ephemeral);
-}
-
-// Verifies that an installed app cannot turn into an ephemeral app as result of
-// race conditions, i.e. an ephemeral app can be promoted to an installed app,
-// but not vice versa.
-IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest,
-                       ReplaceInstalledAppWithEphemeralApp) {
-  const Extension* app = InstallPlatformApp(kNotificationsTestApp);
-  ASSERT_TRUE(app);
-  std::string app_id = app->id();
-  app = NULL;
-
-  EXPECT_FALSE(extensions::util::IsEphemeralApp(app_id, profile()));
-  app =
-      InstallEphemeralAppWithSourceAndFlags(GetTestPath(kNotificationsTestApp),
-                                            0,
-                                            Manifest::INTERNAL,
-                                            Extension::NO_FLAGS);
-  EXPECT_FALSE(extensions::util::IsEphemeralApp(app_id, profile()));
-}
-
-// Ephemerality was previously encoded by the Extension::IS_EPHEMERAL creation
-// flag. This was changed to an "ephemeral_app" property. Check that the prefs
-// are handled correctly.
-IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest,
-                       ExtensionPrefBackcompatibility) {
-  // Ensure that apps with the old prefs are recognized as ephemeral.
-  const Extension* app =
-      InstallExtensionWithSourceAndFlags(GetTestPath(kNotificationsTestApp),
-                                         1,
-                                         Manifest::INTERNAL,
-                                         Extension::IS_EPHEMERAL);
-  ASSERT_TRUE(app);
-  EXPECT_TRUE(extensions::util::IsEphemeralApp(app->id(), profile()));
-
-  // Ensure that when the app is promoted to an installed app, the bit in the
-  // creation flags is cleared.
-  PromoteEphemeralApp(app);
-  EXPECT_FALSE(extensions::util::IsEphemeralApp(app->id(), profile()));
-
-  int creation_flags =
-      ExtensionPrefs::Get(profile())->GetCreationFlags(app->id());
-  EXPECT_EQ(0, creation_flags & Extension::IS_EPHEMERAL);
-}
-
-// Verifies that the power keep awake will be automatically released for
-// ephemeral apps that stop running. Well behaved apps should actually call
-// chrome.power.releaseKeepAwake() themselves.
-IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest, ReleasePowerKeepAwake) {
-  PowerSettingsMock power_settings;
-  extensions::PowerAPI::Get(profile())->SetCreateBlockerFunctionForTesting(
-      base::Bind(&PowerSaveBlockerStub::Create, &power_settings));
-
-  const Extension* app = InstallAndLaunchEphemeralApp(kPowerTestApp);
-  ASSERT_TRUE(app);
-  EXPECT_EQ(1, power_settings.keep_awake_count());
-
-  CloseAppWaitForUnload(app->id());
-
-  EXPECT_EQ(0, power_settings.keep_awake_count());
-}
diff --git a/chrome/browser/apps/ephemeral_app_browsertest.h b/chrome/browser/apps/ephemeral_app_browsertest.h
deleted file mode 100644
index 1e47b9de..0000000
--- a/chrome/browser/apps/ephemeral_app_browsertest.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_APPS_EPHEMERAL_APP_BROWSERTEST_H_
-#define CHROME_BROWSER_APPS_EPHEMERAL_APP_BROWSERTEST_H_
-
-#include <string>
-
-#include "base/files/file_path.h"
-#include "chrome/browser/apps/app_browsertest_util.h"
-#include "extensions/common/manifest.h"
-
-namespace base {
-class CommandLine;
-}
-
-// Contains common code for ephemeral app browser tests.
-class EphemeralAppTestBase : public extensions::PlatformAppBrowserTest {
- public:
-  static const char kMessagingReceiverApp[];
-  static const char kMessagingReceiverAppV2[];
-  static const char kDispatchEventTestApp[];
-  static const char kNotificationsTestApp[];
-  static const char kFileSystemTestApp[];
-
-  EphemeralAppTestBase();
-  ~EphemeralAppTestBase() override;
-
-  void SetUpCommandLine(base::CommandLine* command_line) override;
-  void SetUpOnMainThread() override;
-
- protected:
-  base::FilePath GetTestPath(const char* test_path);
-
-  const extensions::Extension* InstallEphemeralApp(
-      const char* test_path, extensions::Manifest::Location manifest_location);
-  const extensions::Extension* InstallEphemeralApp(const char* test_path);
-  const extensions::Extension* InstallAndLaunchEphemeralApp(
-      const char* test_path);
-  const extensions::Extension*  UpdateEphemeralApp(
-      const std::string& app_id,
-      const base::FilePath& test_dir,
-      const base::FilePath& pem_path);
-  void PromoteEphemeralApp(const extensions::Extension* app);
-  void DisableEphemeralApp(const extensions::Extension* app,
-                           extensions::Extension::DisableReason disable_reason);
-
-  void CloseAppWaitForUnload(const std::string& app_id);
-  void CloseApp(const std::string& app_id);
-  void EvictApp(const std::string& app_id);
-};
-
-#endif  // CHROME_BROWSER_APPS_EPHEMERAL_APP_BROWSERTEST_H_
diff --git a/chrome/browser/apps/ephemeral_app_service.cc b/chrome/browser/apps/ephemeral_app_service.cc
deleted file mode 100644
index 6f17c4b..0000000
--- a/chrome/browser/apps/ephemeral_app_service.cc
+++ /dev/null
@@ -1,162 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/apps/ephemeral_app_service.h"
-
-#include "apps/app_lifetime_monitor_factory.h"
-#include "base/bind.h"
-#include "base/command_line.h"
-#include "base/thread_task_runner_handle.h"
-#include "chrome/browser/apps/ephemeral_app_service_factory.h"
-#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/extensions/extension_util.h"
-#include "chrome/browser/profiles/profile.h"
-#include "content/public/browser/browser_thread.h"
-#include "content/public/common/content_switches.h"
-#include "extensions/browser/extension_prefs.h"
-#include "extensions/browser/extension_registry.h"
-#include "extensions/browser/extension_system.h"
-#include "extensions/browser/extension_util.h"
-#include "extensions/browser/uninstall_reason.h"
-#include "extensions/common/extension.h"
-#include "extensions/common/extension_set.h"
-#include "extensions/common/one_shot_event.h"
-
-using extensions::Extension;
-using extensions::ExtensionPrefs;
-using extensions::ExtensionRegistry;
-using extensions::ExtensionSet;
-using extensions::ExtensionSystem;
-
-namespace {
-
-// The number of seconds after an app has stopped running before it will be
-// disabled.
-const int kDefaultDisableAppDelay = 1;
-
-}  // namespace
-
-// static
-EphemeralAppService* EphemeralAppService::Get(Profile* profile) {
-  return EphemeralAppServiceFactory::GetForProfile(profile);
-}
-
-EphemeralAppService::EphemeralAppService(Profile* profile)
-    : profile_(profile),
-      extension_registry_observer_(this),
-      app_lifetime_monitor_observer_(this),
-      disable_idle_app_delay_(kDefaultDisableAppDelay),
-      weak_ptr_factory_(this) {
-  ExtensionSystem::Get(profile_)->ready().Post(
-      FROM_HERE,
-      base::Bind(&EphemeralAppService::Init, weak_ptr_factory_.GetWeakPtr()));
-}
-
-EphemeralAppService::~EphemeralAppService() {
-}
-
-void EphemeralAppService::ClearCachedApps() {
-  ExtensionRegistry* registry = ExtensionRegistry::Get(profile_);
-  DCHECK(registry);
-  ExtensionPrefs* prefs = ExtensionPrefs::Get(profile_);
-  DCHECK(prefs);
-  ExtensionService* service =
-      ExtensionSystem::Get(profile_)->extension_service();
-  DCHECK(service);
-
-  scoped_ptr<ExtensionSet> extensions =
-      registry->GenerateInstalledExtensionsSet();
-
-  for (ExtensionSet::const_iterator it = extensions->begin();
-       it != extensions->end();
-       ++it) {
-    std::string extension_id = (*it)->id();
-    if (!prefs->IsEphemeralApp(extension_id))
-      continue;
-
-    DCHECK(registry->GetExtensionById(extension_id,
-                                      ExtensionRegistry::EVERYTHING));
-    service->UninstallExtension(
-        extension_id,
-        extensions::UNINSTALL_REASON_ORPHANED_EPHEMERAL_EXTENSION,
-        base::Bind(&base::DoNothing),
-        NULL);
-  }
-}
-
-void EphemeralAppService::OnExtensionWillBeInstalled(
-    content::BrowserContext* browser_context,
-    const extensions::Extension* extension,
-    bool is_update,
-    bool from_ephemeral,
-    const std::string& old_name) {
-  if (from_ephemeral)
-    HandleEphemeralAppPromoted(extension);
-}
-
-void EphemeralAppService::OnAppStop(Profile* profile,
-                                    const std::string& app_id) {
-  if (!extensions::util::IsEphemeralApp(app_id, profile_))
-    return;
-
-  base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
-      FROM_HERE, base::Bind(&EphemeralAppService::DisableEphemeralApp,
-                            weak_ptr_factory_.GetWeakPtr(), app_id),
-      base::TimeDelta::FromSeconds(disable_idle_app_delay_));
-}
-
-void EphemeralAppService::OnChromeTerminating() {
-  extension_registry_observer_.RemoveAll();
-  app_lifetime_monitor_observer_.RemoveAll();
-}
-
-void EphemeralAppService::Init() {
-  // Start observing.
-  extension_registry_observer_.Add(ExtensionRegistry::Get(profile_));
-  app_lifetime_monitor_observer_.Add(
-      apps::AppLifetimeMonitorFactory::GetForProfile(profile_));
-
-  // Execute startup clean up tasks (except during tests).
-  if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType))
-    return;
-
-  content::BrowserThread::PostAfterStartupTask(
-      FROM_HERE, content::BrowserThread::GetMessageLoopProxyForThread(
-                     content::BrowserThread::UI),
-      base::Bind(&EphemeralAppService::ClearCachedApps,
-                 weak_ptr_factory_.GetWeakPtr()));
-}
-
-void EphemeralAppService::DisableEphemeralApp(const std::string& app_id) {
-  if (!extensions::util::IsEphemeralApp(app_id, profile_) ||
-      !extensions::util::IsExtensionIdle(app_id, profile_)) {
-    return;
-  }
-
-  // After an ephemeral app has stopped running, unload it from extension
-  // system and disable it to prevent all background activity.
-  ExtensionService* service =
-      ExtensionSystem::Get(profile_)->extension_service();
-  DCHECK(service);
-  service->DisableExtension(app_id, Extension::DISABLE_INACTIVE_EPHEMERAL_APP);
-}
-
-void EphemeralAppService::HandleEphemeralAppPromoted(const Extension* app) {
-  // When ephemeral apps are promoted to regular install apps, remove the
-  // DISABLE_INACTIVE_EPHEMERAL_APP reason and enable the app if there are no
-  // other reasons.
-  ExtensionPrefs* prefs = ExtensionPrefs::Get(profile_);
-  DCHECK(prefs);
-
-  int disable_reasons = prefs->GetDisableReasons(app->id());
-  if (disable_reasons & Extension::DISABLE_INACTIVE_EPHEMERAL_APP) {
-    if (disable_reasons == Extension::DISABLE_INACTIVE_EPHEMERAL_APP) {
-      // This will also clear disable reasons.
-      prefs->SetExtensionEnabled(app->id());
-    } else {
-      prefs->RemoveDisableReason(app->id(),
-                                 Extension::DISABLE_INACTIVE_EPHEMERAL_APP);
-    }
-  }
-}
diff --git a/chrome/browser/apps/ephemeral_app_service.h b/chrome/browser/apps/ephemeral_app_service.h
deleted file mode 100644
index d8b1a89..0000000
--- a/chrome/browser/apps/ephemeral_app_service.h
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_APPS_EPHEMERAL_APP_SERVICE_H_
-#define CHROME_BROWSER_APPS_EPHEMERAL_APP_SERVICE_H_
-
-#include <set>
-
-#include "apps/app_lifetime_monitor.h"
-#include "base/memory/weak_ptr.h"
-#include "base/scoped_observer.h"
-#include "components/keyed_service/core/keyed_service.h"
-#include "extensions/browser/extension_registry_observer.h"
-
-class Profile;
-
-namespace extensions {
-class Extension;
-class ExtensionRegistry;
-}  // namespace extensions
-
-// Delete cached ephemeral apps at startup.
-// TODO(benwells): Remove this system.  https://crbug.com/517735.
-class EphemeralAppService : public KeyedService,
-                            public extensions::ExtensionRegistryObserver,
-                            public apps::AppLifetimeMonitor::Observer {
- public:
-  // Returns the instance for the given profile. This is a convenience wrapper
-  // around EphemeralAppServiceFactory::GetForProfile.
-  static EphemeralAppService* Get(Profile* profile);
-
-  explicit EphemeralAppService(Profile* profile);
-  ~EphemeralAppService() override;
-
-  // Clears the ephemeral app cache. Removes all idle ephemeral apps.
-  void ClearCachedApps();
-
-  void set_disable_delay_for_test(int delay) {
-    disable_idle_app_delay_ = delay;
-  }
-
- private:
-  // extensions::ExtensionRegistryObserver.
-  void OnExtensionWillBeInstalled(content::BrowserContext* browser_context,
-                                  const extensions::Extension* extension,
-                                  bool is_update,
-                                  bool from_ephemeral,
-                                  const std::string& old_name) override;
-
-  // apps::AppLifetimeMonitor::Observer implementation.
-  void OnAppStop(Profile* profile, const std::string& app_id) override;
-  void OnChromeTerminating() override;
-
-  void Init();
-
-  void DisableEphemeralApp(const std::string& app_id);
-
-  void HandleEphemeralAppPromoted(const extensions::Extension* app);
-
-  Profile* profile_;
-
-  ScopedObserver<extensions::ExtensionRegistry,
-                 extensions::ExtensionRegistryObserver>
-      extension_registry_observer_;
-  ScopedObserver<apps::AppLifetimeMonitor, apps::AppLifetimeMonitor::Observer>
-      app_lifetime_monitor_observer_;
-
-  // Number of seconds before disabling idle ephemeral apps.
-  // Overridden in tests.
-  int disable_idle_app_delay_;
-
-  base::WeakPtrFactory<EphemeralAppService> weak_ptr_factory_;
-
-  friend class EphemeralAppServiceBrowserTest;
-
-  DISALLOW_COPY_AND_ASSIGN(EphemeralAppService);
-};
-
-#endif  // CHROME_BROWSER_APPS_EPHEMERAL_APP_SERVICE_H_
diff --git a/chrome/browser/apps/ephemeral_app_service_browsertest.cc b/chrome/browser/apps/ephemeral_app_service_browsertest.cc
deleted file mode 100644
index cf18743..0000000
--- a/chrome/browser/apps/ephemeral_app_service_browsertest.cc
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <vector>
-
-#include "chrome/browser/apps/ephemeral_app_browsertest.h"
-#include "chrome/browser/apps/ephemeral_app_service.h"
-#include "extensions/browser/extension_registry.h"
-
-using extensions::Extension;
-using extensions::ExtensionRegistry;
-
-class EphemeralAppServiceBrowserTest : public EphemeralAppTestBase {};
-
-// Verify that the cache of ephemeral apps is correctly cleared. All ephemeral
-// apps should be removed.
-IN_PROC_BROWSER_TEST_F(EphemeralAppServiceBrowserTest, ClearCachedApps) {
-  const Extension* running_app =
-      InstallAndLaunchEphemeralApp(kMessagingReceiverApp);
-  const Extension* inactive_app =
-      InstallAndLaunchEphemeralApp(kDispatchEventTestApp);
-  std::string inactive_app_id = inactive_app->id();
-  std::string running_app_id = running_app->id();
-  CloseAppWaitForUnload(inactive_app_id);
-
-  EphemeralAppService* ephemeral_service =
-      EphemeralAppService::Get(browser()->profile());
-  ASSERT_TRUE(ephemeral_service);
-
-  ExtensionRegistry* registry = ExtensionRegistry::Get(profile());
-  ASSERT_TRUE(registry);
-
-  int extension_count = registry->GenerateInstalledExtensionsSet()->size();
-
-  ephemeral_service->ClearCachedApps();
-
-  EXPECT_FALSE(registry->GetExtensionById(inactive_app_id,
-                                          ExtensionRegistry::EVERYTHING));
-  EXPECT_FALSE(registry->GetExtensionById(running_app_id,
-                                          ExtensionRegistry::EVERYTHING));
-
-  int new_extension_count = registry->GenerateInstalledExtensionsSet()->size();
-  EXPECT_EQ(2, extension_count - new_extension_count);
-}
diff --git a/chrome/browser/apps/ephemeral_app_service_factory.cc b/chrome/browser/apps/ephemeral_app_service_factory.cc
deleted file mode 100644
index 06a7c02..0000000
--- a/chrome/browser/apps/ephemeral_app_service_factory.cc
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/apps/ephemeral_app_service_factory.h"
-
-#include "apps/app_lifetime_monitor_factory.h"
-#include "chrome/browser/apps/ephemeral_app_service.h"
-#include "chrome/browser/profiles/profile.h"
-#include "components/keyed_service/content/browser_context_dependency_manager.h"
-#include "extensions/browser/extension_system_provider.h"
-#include "extensions/browser/extensions_browser_client.h"
-
-using extensions::ExtensionsBrowserClient;
-
-// static
-EphemeralAppService*
-EphemeralAppServiceFactory::GetForProfile(Profile* profile) {
-  return static_cast<EphemeralAppService*>(
-      GetInstance()->GetServiceForBrowserContext(profile, true));
-}
-
-// static
-EphemeralAppServiceFactory* EphemeralAppServiceFactory::GetInstance() {
-  return base::Singleton<EphemeralAppServiceFactory>::get();
-}
-
-EphemeralAppServiceFactory::EphemeralAppServiceFactory()
-    : BrowserContextKeyedServiceFactory(
-          "EphemeralAppService",
-          BrowserContextDependencyManager::GetInstance()) {
-  DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
-  DependsOn(apps::AppLifetimeMonitorFactory::GetInstance());
-}
-
-EphemeralAppServiceFactory::~EphemeralAppServiceFactory() {
-}
-
-KeyedService* EphemeralAppServiceFactory::BuildServiceInstanceFor(
-    content::BrowserContext* context) const {
-  return new EphemeralAppService(Profile::FromBrowserContext(context));
-}
-
-content::BrowserContext* EphemeralAppServiceFactory::GetBrowserContextToUse(
-    content::BrowserContext* context) const {
-  return ExtensionsBrowserClient::Get()->GetOriginalContext(context);
-}
-
-bool EphemeralAppServiceFactory::ServiceIsCreatedWithBrowserContext() const {
-  return true;
-}
-
-bool EphemeralAppServiceFactory::ServiceIsNULLWhileTesting() const {
-  return true;
-}
diff --git a/chrome/browser/apps/ephemeral_app_service_factory.h b/chrome/browser/apps/ephemeral_app_service_factory.h
deleted file mode 100644
index 412027ef..0000000
--- a/chrome/browser/apps/ephemeral_app_service_factory.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_APPS_EPHEMERAL_APP_SERVICE_FACTORY_H_
-#define CHROME_BROWSER_APPS_EPHEMERAL_APP_SERVICE_FACTORY_H_
-
-#include "base/memory/singleton.h"
-#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
-
-class EphemeralAppService;
-class Profile;
-
-class EphemeralAppServiceFactory : public BrowserContextKeyedServiceFactory {
- public:
-  static EphemeralAppService* GetForProfile(Profile* profile);
-
-  static EphemeralAppServiceFactory* GetInstance();
-
- private:
-  friend struct base::DefaultSingletonTraits<EphemeralAppServiceFactory>;
-
-  EphemeralAppServiceFactory();
-  ~EphemeralAppServiceFactory() override;
-
-  // BrowserContextKeyedServiceFactory implementation:
-  KeyedService* BuildServiceInstanceFor(
-      content::BrowserContext* context) const override;
-  content::BrowserContext* GetBrowserContextToUse(
-      content::BrowserContext* context) const override;
-  bool ServiceIsCreatedWithBrowserContext() const override;
-  bool ServiceIsNULLWhileTesting() const override;
-};
-
-#endif  // CHROME_BROWSER_APPS_EPHEMERAL_APP_SERVICE_FACTORY_H_
diff --git a/chrome/browser/apps/shortcut_manager.cc b/chrome/browser/apps/shortcut_manager.cc
index 412b6c8..884a5d9 100644
--- a/chrome/browser/apps/shortcut_manager.cc
+++ b/chrome/browser/apps/shortcut_manager.cc
@@ -12,7 +12,6 @@
 #include "base/strings/utf_string_conversions.h"
 #include "chrome/browser/browser_process.h"
 #include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/extensions/extension_ui_util.h"
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/browser/profiles/profile_info_cache.h"
 #include "chrome/browser/profiles/profile_manager.h"
@@ -25,7 +24,6 @@
 #include "content/public/common/content_switches.h"
 #include "extensions/browser/extension_registry.h"
 #include "extensions/browser/extension_system.h"
-#include "extensions/browser/extension_util.h"
 #include "extensions/common/extension_set.h"
 #include "extensions/common/one_shot_event.h"
 
@@ -48,17 +46,10 @@
 void CreateShortcutsForApp(Profile* profile, const Extension* app) {
   web_app::ShortcutLocations creation_locations;
 
-  if (extensions::util::IsEphemeralApp(app->id(), profile)) {
-    // Ephemeral apps should not have visible shortcuts, but may still require
-    // platform-specific handling.
-    creation_locations.applications_menu_location =
-        web_app::APP_MENU_LOCATION_HIDDEN;
-  } else {
-    // Creates a shortcut for an app in the Chrome Apps subdir of the
-    // applications menu, if there is not already one present.
-    creation_locations.applications_menu_location =
-        web_app::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS;
-  }
+  // Creates a shortcut for an app in the Chrome Apps subdir of the
+  // applications menu, if there is not already one present.
+  creation_locations.applications_menu_location =
+      web_app::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS;
 
   web_app::CreateShortcuts(
       web_app::SHORTCUT_CREATION_AUTOMATED, creation_locations, profile, app);
@@ -119,7 +110,6 @@
     content::BrowserContext* browser_context,
     const Extension* extension,
     bool is_update,
-    bool from_ephemeral,
     const std::string& old_name) {
   if (!extension->is_app())
     return;
@@ -127,7 +117,7 @@
   // If the app is being updated, update any existing shortcuts but do not
   // create new ones. If it is being installed, automatically create a
   // shortcut in the applications menu (e.g., Start Menu).
-  if (is_update && !from_ephemeral) {
+  if (is_update) {
     web_app::UpdateAllShortcuts(
         base::UTF8ToUTF16(old_name), profile_, extension);
   } else {
diff --git a/chrome/browser/apps/shortcut_manager.h b/chrome/browser/apps/shortcut_manager.h
index fb662d3..a6dcde91 100644
--- a/chrome/browser/apps/shortcut_manager.h
+++ b/chrome/browser/apps/shortcut_manager.h
@@ -42,7 +42,6 @@
   void OnExtensionWillBeInstalled(content::BrowserContext* browser_context,
                                   const extensions::Extension* extension,
                                   bool is_update,
-                                  bool from_ephemeral,
                                   const std::string& old_name) override;
   void OnExtensionUninstalled(content::BrowserContext* browser_context,
                               const extensions::Extension* extension,
diff --git a/chrome/browser/background/background_application_list_model.cc b/chrome/browser/background/background_application_list_model.cc
index ef4aefa..91dacd6 100644
--- a/chrome/browser/background/background_application_list_model.cc
+++ b/chrome/browser/background/background_application_list_model.cc
@@ -25,7 +25,6 @@
 #include "extensions/browser/extension_prefs.h"
 #include "extensions/browser/extension_registry.h"
 #include "extensions/browser/extension_system.h"
-#include "extensions/browser/extension_util.h"
 #include "extensions/browser/image_loader.h"
 #include "extensions/browser/notification_types.h"
 #include "extensions/common/extension.h"
@@ -264,11 +263,6 @@
   // 2) It is a hosted app, and has a background contents registered or in the
   //    manifest.
 
-  // Ephemeral apps are denied any background activity after their event page
-  // has been destroyed, thus they cannot be background apps.
-  if (extensions::util::IsEphemeralApp(extension.id(), profile))
-    return false;
-
   // Not a background app if we don't have the background permission.
   if (!extension.permissions_data()->HasAPIPermission(
           APIPermission::kBackground)) {
diff --git a/chrome/browser/background/background_application_list_model_unittest.cc b/chrome/browser/background/background_application_list_model_unittest.cc
index 9b87387..35e99e90 100644
--- a/chrome/browser/background/background_application_list_model_unittest.cc
+++ b/chrome/browser/background/background_application_list_model_unittest.cc
@@ -132,20 +132,6 @@
       .RemovePermissionsUnsafe(
           extension, extension->permissions_data()->active_permissions());
 }
-
-void AddEphemeralApp(const Extension* extension, ExtensionService* service) {
-  extensions::ExtensionPrefs* prefs =
-      extensions::ExtensionPrefs::Get(service->profile());
-  ASSERT_TRUE(prefs);
-  prefs->OnExtensionInstalled(extension,
-                              extensions::Extension::ENABLED,
-                              syncer::StringOrdinal(),
-                              extensions::kInstallFlagIsEphemeral,
-                              std::string());
-
-  service->AddExtension(extension);
-}
-
 }  // namespace
 
 // Crashes on Mac tryslaves.
@@ -228,32 +214,6 @@
   ASSERT_EQ(0U, model->size());
 }
 
-// Verifies that an ephemeral app cannot trigger background mode.
-TEST_F(BackgroundApplicationListModelTest, EphemeralAppTest) {
-  InitializeAndLoadEmptyExtensionService();
-  ASSERT_TRUE(service()->is_ready());
-  ASSERT_TRUE(registry()->enabled_extensions().is_empty());
-  scoped_ptr<BackgroundApplicationListModel> model(
-      new BackgroundApplicationListModel(profile_.get()));
-  ASSERT_EQ(0U, model->size());
-
-  scoped_refptr<Extension> background = CreateExtension("background", true);
-
-  // An ephemeral app with the background permission should not trigger
-  // background mode.
-  AddEphemeralApp(background.get(), service());
-  ASSERT_FALSE(IsBackgroundApp(*background.get()));
-  ASSERT_EQ(1U, registry()->enabled_extensions().size());
-  ASSERT_EQ(0U, model->size());
-
-  // If the ephemeral app becomes promoted to an installed app, it can now
-  // trigger background mode.
-  service()->PromoteEphemeralApp(background.get(), false /*from sync*/);
-  ASSERT_TRUE(IsBackgroundApp(*background.get()));
-  ASSERT_EQ(1U, registry()->enabled_extensions().size());
-  ASSERT_EQ(1U, model->size());
-}
-
 // With minimal test logic, verifies behavior with dynamic permissions.
 TEST_F(BackgroundApplicationListModelTest, AddRemovePermissionsTest) {
   InitializeAndLoadEmptyExtensionService();
diff --git a/chrome/browser/background/background_mode_manager_unittest.cc b/chrome/browser/background/background_mode_manager_unittest.cc
index 633680b..757fc1c 100644
--- a/chrome/browser/background/background_mode_manager_unittest.cc
+++ b/chrome/browser/background/background_mode_manager_unittest.cc
@@ -310,20 +310,6 @@
     return false;
   }
 
-  void AddEphemeralApp(const extensions::Extension* extension,
-                       ExtensionService* service) {
-    extensions::ExtensionPrefs* prefs =
-        extensions::ExtensionPrefs::Get(service->profile());
-    ASSERT_TRUE(prefs);
-    prefs->OnExtensionInstalled(extension,
-                                extensions::Extension::ENABLED,
-                                syncer::StringOrdinal(),
-                                extensions::kInstallFlagIsEphemeral,
-                                std::string());
-
-    service->AddExtension(extension);
-  }
-
   scoped_ptr<TestBackgroundModeManager> manager_;
 
   scoped_ptr<base::CommandLine> command_line_;
diff --git a/chrome/browser/browsing_data/browsing_data_remover.cc b/chrome/browser/browsing_data/browsing_data_remover.cc
index 7779d42..1c2d5039 100644
--- a/chrome/browser/browsing_data/browsing_data_remover.cc
+++ b/chrome/browser/browsing_data/browsing_data_remover.cc
@@ -95,7 +95,6 @@
 #endif
 
 #if defined(ENABLE_EXTENSIONS)
-#include "chrome/browser/apps/ephemeral_app_service.h"
 #include "chrome/browser/extensions/activity_log/activity_log.h"
 #include "chrome/browser/extensions/extension_service.h"
 #include "chrome/browser/extensions/extension_special_storage_policy.h"
@@ -693,16 +692,6 @@
 
     storage_partition_remove_mask |=
         content::StoragePartition::REMOVE_DATA_MASK_WEBRTC_IDENTITY;
-
-#if defined(ENABLE_EXTENSIONS)
-    // Clear the ephemeral apps cache. This is nullptr while testing. OTR
-    // Profile has neither apps nor an ExtensionService, so ClearCachedApps
-    // fails.
-    EphemeralAppService* ephemeral_app_service =
-        EphemeralAppService::Get(profile_);
-    if (ephemeral_app_service && !profile_->IsOffTheRecord())
-      ephemeral_app_service->ClearCachedApps();
-#endif
   }
 
   if (remove_mask & REMOVE_WEBRTC_IDENTITY) {
diff --git a/chrome/browser/chromeos/file_manager/file_browser_handlers.cc b/chrome/browser/chromeos/file_manager/file_browser_handlers.cc
index 846adbd9..44adfc6 100644
--- a/chrome/browser/chromeos/file_manager/file_browser_handlers.cc
+++ b/chrome/browser/chromeos/file_manager/file_browser_handlers.cc
@@ -120,9 +120,6 @@
     if (profile->IsOffTheRecord() &&
         !extensions::util::IsIncognitoEnabled(extension->id(), profile))
       continue;
-    if (extensions::util::IsEphemeralApp(extension->id(), profile))
-      continue;
-
     FileBrowserHandler::List* handler_list =
         FileBrowserHandler::GetHandlers(extension.get());
     if (!handler_list)
diff --git a/chrome/browser/chromeos/file_manager/file_tasks.cc b/chrome/browser/chromeos/file_manager/file_tasks.cc
index 66619f60..a09ef59 100644
--- a/chrome/browser/chromeos/file_manager/file_tasks.cc
+++ b/chrome/browser/chromeos/file_manager/file_tasks.cc
@@ -405,10 +405,6 @@
     if (!CanLaunchViaEvent(extension))
       continue;
 
-    // Ephemeral apps cannot be file handlers.
-    if (extensions::util::IsEphemeralApp(extension->id(), profile))
-      continue;
-
     if (profile->IsOffTheRecord() &&
         !extensions::util::IsIncognitoEnabled(extension->id(), profile))
       continue;
diff --git a/chrome/browser/chromeos/file_manager/file_tasks_unittest.cc b/chrome/browser/chromeos/file_manager/file_tasks_unittest.cc
index b1d6846..534d3af 100644
--- a/chrome/browser/chromeos/file_manager/file_tasks_unittest.cc
+++ b/chrome/browser/chromeos/file_manager/file_tasks_unittest.cc
@@ -461,7 +461,6 @@
   // % ruby -le 'print (0...32).to_a.map{(?a + rand(16)).chr}.join'
   const char kFooId[] = "hhgbjpmdppecanaaogonaigmmifgpaph";
   const char kBarId[] = "odlhccgofgkadkkhcmhgnhgahonahoca";
-  const char kEphemeralId[] = "opoomfdlbjcbjinalcjdjfoiikdeaoel";
 
   // Foo.app can handle "text/plain" and "text/html".
   extensions::ExtensionBuilder foo_app;
@@ -512,38 +511,6 @@
   bar_app.SetID(kBarId);
   extension_service_->AddExtension(bar_app.Build().get());
 
-  // Ephemeral.app is an ephemeral app that can handle "text/plain".
-  // It should not ever be found as ephemeral apps cannot be file handlers.
-  extensions::ExtensionBuilder ephemeral_app;
-  ephemeral_app.SetManifest(
-      extensions::DictionaryBuilder()
-          .Set("name", "Ephemeral")
-          .Set("version", "1.0.0")
-          .Set("manifest_version", 2)
-          .Set("app",
-               extensions::DictionaryBuilder().Set(
-                   "background",
-                   extensions::DictionaryBuilder().Set(
-                       "scripts",
-                       extensions::ListBuilder().Append("background.js"))))
-          .Set("file_handlers",
-               extensions::DictionaryBuilder().Set(
-                   "text",
-                   extensions::DictionaryBuilder().Set("title", "Text").Set(
-                       "types",
-                       extensions::ListBuilder().Append("text/plain")))));
-  ephemeral_app.SetID(kEphemeralId);
-  scoped_refptr<extensions::Extension> built_ephemeral_app(
-      ephemeral_app.Build());
-  extension_service_->AddExtension(built_ephemeral_app.get());
-  extensions::ExtensionPrefs* extension_prefs =
-      extensions::ExtensionPrefs::Get(&test_profile_);
-  extension_prefs->OnExtensionInstalled(built_ephemeral_app.get(),
-                                        extensions::Extension::ENABLED,
-                                        syncer::StringOrdinal(),
-                                        extensions::kInstallFlagIsEphemeral,
-                                        std::string());
-
   // Find apps for a "text/plain" file. Foo.app and Bar.app should be found.
   PathAndMimeTypeSet path_mime_set;
   path_mime_set.insert(
@@ -598,7 +565,6 @@
   // Copied from FindFileHandlerTasks test above.
   const char kFooId[] = "hhgbjpmdppecanaaogonaigmmifgpaph";
   const char kBarId[] = "odlhccgofgkadkkhcmhgnhgahonahoca";
-  const char kEphemeralId[] = "opoomfdlbjcbjinalcjdjfoiikdeaoel";
 
   // Foo.app can handle ".txt" and ".html".
   // This one is an extension, and has "file_browser_handlers"
@@ -641,36 +607,6 @@
   bar_app.SetID(kBarId);
   extension_service_->AddExtension(bar_app.Build().get());
 
-  // Ephemeral.app is an ephemeral app that can handle ".txt".
-  // It should not ever be found as ephemeral apps cannot be file browser
-  // handlers.
-  extensions::ExtensionBuilder ephemeral_app;
-  ephemeral_app.SetManifest(
-      extensions::DictionaryBuilder()
-          .Set("name", "Ephemeral")
-          .Set("version", "1.0.0")
-          .Set("manifest_version", 2)
-          .Set("permissions",
-               extensions::ListBuilder().Append("fileBrowserHandler"))
-          .Set("file_browser_handlers",
-               extensions::ListBuilder().Append(
-                   extensions::DictionaryBuilder()
-                       .Set("id", "open")
-                       .Set("default_title", "open")
-                       .Set("file_filters", extensions::ListBuilder().Append(
-                                                "filesystem:*.txt")))));
-  ephemeral_app.SetID(kEphemeralId);
-  scoped_refptr<extensions::Extension> built_ephemeral_app(
-      ephemeral_app.Build());
-  extension_service_->AddExtension(built_ephemeral_app.get());
-  extensions::ExtensionPrefs* extension_prefs =
-      extensions::ExtensionPrefs::Get(&test_profile_);
-  extension_prefs->OnExtensionInstalled(built_ephemeral_app.get(),
-                                        extensions::Extension::ENABLED,
-                                        syncer::StringOrdinal(),
-                                        extensions::kInstallFlagIsEphemeral,
-                                        std::string());
-
   // Find apps for a ".txt" file. Foo.app and Bar.app should be found.
   std::vector<GURL> file_urls;
   file_urls.push_back(GURL("filesystem:chrome-extension://id/dir/foo.txt"));
diff --git a/chrome/browser/chromeos/policy/device_local_account_browsertest.cc b/chrome/browser/chromeos/policy/device_local_account_browsertest.cc
index f1d2f1c97..35d00176 100644
--- a/chrome/browser/chromeos/policy/device_local_account_browsertest.cc
+++ b/chrome/browser/chromeos/policy/device_local_account_browsertest.cc
@@ -834,7 +834,6 @@
   void OnExtensionWillBeInstalled(content::BrowserContext* browser_context,
                                   const extensions::Extension* extension,
                                   bool is_update,
-                                  bool from_ephemeral,
                                   const std::string& old_name) override {
     if (waiting_extension_id_ == extension->id()) {
       observed_ = true;
diff --git a/chrome/browser/extensions/api/commands/command_service.cc b/chrome/browser/extensions/api/commands/command_service.cc
index 5ff8711..1dd125b 100644
--- a/chrome/browser/extensions/api/commands/command_service.cc
+++ b/chrome/browser/extensions/api/commands/command_service.cc
@@ -315,7 +315,6 @@
     content::BrowserContext* browser_context,
     const Extension* extension,
     bool is_update,
-    bool from_ephemeral,
     const std::string& old_name) {
   UpdateKeybindings(extension);
 }
diff --git a/chrome/browser/extensions/api/commands/command_service.h b/chrome/browser/extensions/api/commands/command_service.h
index cda73eec..ef0ae9d9 100644
--- a/chrome/browser/extensions/api/commands/command_service.h
+++ b/chrome/browser/extensions/api/commands/command_service.h
@@ -213,7 +213,6 @@
   void OnExtensionWillBeInstalled(content::BrowserContext* browser_context,
                                   const Extension* extension,
                                   bool is_update,
-                                  bool from_ephemeral,
                                   const std::string& old_name) override;
   void OnExtensionUninstalled(content::BrowserContext* browser_context,
                               const Extension* extension,
diff --git a/chrome/browser/extensions/api/storage/managed_value_store_cache.cc b/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
index b6b1272..5517958 100644
--- a/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
+++ b/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
@@ -75,7 +75,6 @@
   void OnExtensionWillBeInstalled(content::BrowserContext* browser_context,
                                   const Extension* extension,
                                   bool is_update,
-                                  bool from_ephemeral,
                                   const std::string& old_name) override;
   void OnExtensionUninstalled(content::BrowserContext* browser_context,
                               const Extension* extension,
@@ -122,7 +121,6 @@
     content::BrowserContext* browser_context,
     const Extension* extension,
     bool is_update,
-    bool from_ephemeral,
     const std::string& old_name) {
   // Some extensions are installed on the first run before the ExtensionSystem
   // becomes ready. Wait until all of them are ready before registering the
diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
index f1276432..9fda275 100644
--- a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
+++ b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
@@ -31,7 +31,6 @@
 #include "content/public/browser/web_contents.h"
 #include "extensions/browser/extension_registry.h"
 #include "extensions/browser/extension_system.h"
-#include "extensions/browser/extension_util.h"
 #include "extensions/common/extension.h"
 #include "net/base/load_flags.h"
 #include "net/url_request/url_request.h"
@@ -207,8 +206,10 @@
 
   InstallTracker* tracker = InstallTracker::Get(browser_context());
   DCHECK(tracker);
-  if (util::IsExtensionInstalledPermanently(details().id, browser_context()) ||
-      tracker->GetActiveInstall(details().id)) {
+  bool is_installed =
+      extensions::ExtensionRegistry::Get(browser_context())->GetExtensionById(
+          details().id, extensions::ExtensionRegistry::EVERYTHING) != nullptr;
+  if (is_installed || tracker->GetActiveInstall(details().id)) {
     return RespondNow(BuildResponse(
         api::webstore_private::RESULT_ALREADY_INSTALLED,
         kAlreadyInstalledError));
@@ -426,26 +427,6 @@
         approval_->enable_launcher);
   }
 
-  // If the target extension has already been installed ephemerally and is
-  // up to date, it can be promoted to a regular installed extension and
-  // downloading from the Web Store is not necessary.
-  const Extension* extension = ExtensionRegistry::Get(browser_context())->
-      GetExtensionById(params->expected_id, ExtensionRegistry::EVERYTHING);
-  if (extension && approval_->dummy_extension.get() &&
-      util::IsEphemeralApp(extension->id(), browser_context()) &&
-      extension->version()->CompareTo(*approval_->dummy_extension->version()) >=
-          0) {
-    install_ui::ShowPostInstallUIForApproval(
-        browser_context(), *approval_, extension);
-
-    ExtensionService* extension_service =
-        ExtensionSystem::Get(browser_context())->extension_service();
-    extension_service->PromoteEphemeralApp(extension, false);
-    OnInstallSuccess(extension->id());
-    VLOG(1) << "Install success, sending response";
-    return RespondNow(NoArguments());
-  }
-
   // Balanced in OnExtensionInstallSuccess() or OnExtensionInstallFailure().
   AddRef();
 
@@ -544,7 +525,10 @@
   BundleInstaller::ItemList items;
   for (const auto& entry : params_->contents) {
     // Skip already-installed items.
-    if (util::IsExtensionInstalledPermanently(entry->id, browser_context()) ||
+    bool is_installed =
+        extensions::ExtensionRegistry::Get(browser_context())->GetExtensionById(
+            entry->id, extensions::ExtensionRegistry::EVERYTHING) != nullptr;
+    if (is_installed ||
         InstallTracker::Get(browser_context())->GetActiveInstall(entry->id)) {
       continue;
     }
diff --git a/chrome/browser/extensions/crx_installer.h b/chrome/browser/extensions/crx_installer.h
index c5e61d3..598858f8 100644
--- a/chrome/browser/extensions/crx_installer.h
+++ b/chrome/browser/extensions/crx_installer.h
@@ -198,9 +198,6 @@
   void set_install_immediately(bool val) {
     set_install_flag(kInstallFlagInstallImmediately, val);
   }
-  void set_is_ephemeral(bool val) {
-    set_install_flag(kInstallFlagIsEphemeral, val);
-  }
   void set_do_not_sync(bool val) {
     set_install_flag(kInstallFlagDoNotSync, val);
   }
diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc
index a510d742..300035fb 100644
--- a/chrome/browser/extensions/extension_browsertest.cc
+++ b/chrome/browser/extensions/extension_browsertest.cc
@@ -422,7 +422,6 @@
                                   Manifest::INTERNAL,
                                   browser(),
                                   Extension::NO_FLAGS,
-                                  false,
                                   false);
 }
 
@@ -431,7 +430,7 @@
     int expected_change) {
   return InstallOrUpdateExtension(
       std::string(), path, INSTALL_UI_TYPE_AUTO_CONFIRM, expected_change,
-      Manifest::INTERNAL, browser(), Extension::FROM_WEBSTORE, true, false);
+      Manifest::INTERNAL, browser(), Extension::FROM_WEBSTORE, true);
 }
 
 const Extension* ExtensionBrowserTest::InstallOrUpdateExtension(
@@ -446,8 +445,7 @@
                                   Manifest::INTERNAL,
                                   browser(),
                                   Extension::NO_FLAGS,
-                                  true,
-                                  false);
+                                  true);
 }
 
 const Extension* ExtensionBrowserTest::InstallOrUpdateExtension(
@@ -464,8 +462,7 @@
                                   Manifest::INTERNAL,
                                   browser,
                                   creation_flags,
-                                  true,
-                                  false);
+                                  true);
 }
 
 const Extension* ExtensionBrowserTest::InstallOrUpdateExtension(
@@ -481,8 +478,7 @@
                                   install_source,
                                   browser(),
                                   Extension::NO_FLAGS,
-                                  true,
-                                  false);
+                                  true);
 }
 
 const Extension* ExtensionBrowserTest::InstallOrUpdateExtension(
@@ -493,8 +489,7 @@
     Manifest::Location install_source,
     Browser* browser,
     Extension::InitFromValueFlags creation_flags,
-    bool install_immediately,
-    bool is_ephemeral) {
+    bool install_immediately) {
   ExtensionService* service =
       extensions::ExtensionSystem::Get(profile())->extension_service();
   ExtensionRegistry* registry = ExtensionRegistry::Get(profile());
@@ -528,7 +523,6 @@
     installer->set_creation_flags(creation_flags);
     installer->set_install_source(install_source);
     installer->set_install_immediately(install_immediately);
-    installer->set_is_ephemeral(is_ephemeral);
     if (!installer->is_gallery_install()) {
       installer->set_off_store_install_allow_reason(
           extensions::CrxInstaller::OffStoreInstallAllowedInTest);
diff --git a/chrome/browser/extensions/extension_browsertest.h b/chrome/browser/extensions/extension_browsertest.h
index 65d1d92e..328a915 100644
--- a/chrome/browser/extensions/extension_browsertest.h
+++ b/chrome/browser/extensions/extension_browsertest.h
@@ -201,26 +201,9 @@
                                     install_source,
                                     browser(),
                                     creation_flags,
-                                    false,
                                     false);
   }
 
-  const extensions::Extension* InstallEphemeralAppWithSourceAndFlags(
-      const base::FilePath& path,
-      int expected_change,
-      extensions::Manifest::Location install_source,
-      extensions::Extension::InitFromValueFlags creation_flags) {
-    return InstallOrUpdateExtension(std::string(),
-                                    path,
-                                    INSTALL_UI_TYPE_NONE,
-                                    expected_change,
-                                    install_source,
-                                    browser(),
-                                    creation_flags,
-                                    false,
-                                    true);
-  }
-
   // Begins install process but simulates a user cancel.
   const extensions::Extension* StartInstallButCancel(
       const base::FilePath& path) {
@@ -375,8 +358,7 @@
       extensions::Manifest::Location install_source,
       Browser* browser,
       extensions::Extension::InitFromValueFlags creation_flags,
-      bool wait_for_idle,
-      bool is_ephemeral);
+      bool wait_for_idle);
 
   // Make the current channel "dev" for the duration of the test.
   extensions::ScopedCurrentChannel current_channel_;
diff --git a/chrome/browser/extensions/extension_disabled_ui.cc b/chrome/browser/extensions/extension_disabled_ui.cc
index 640af2ff..69970c77 100644
--- a/chrome/browser/extensions/extension_disabled_ui.cc
+++ b/chrome/browser/extensions/extension_disabled_ui.cc
@@ -486,11 +486,6 @@
 void AddExtensionDisabledError(ExtensionService* service,
                                const Extension* extension,
                                bool is_remote_install) {
-  // Do not display notifications for ephemeral apps that have been disabled.
-  // Instead, a prompt will be shown the next time the app is launched.
-  if (util::IsEphemeralApp(extension->id(), service->profile()))
-    return;
-
   extensions::ExtensionResource image = extensions::IconsInfo::GetIconResource(
       extension, kIconSize, ExtensionIconSet::MATCH_BIGGER);
   gfx::Size size(kIconSize, kIconSize);
diff --git a/chrome/browser/extensions/extension_install_prompt.cc b/chrome/browser/extensions/extension_install_prompt.cc
index 9a90a37..fc02105 100644
--- a/chrome/browser/extensions/extension_install_prompt.cc
+++ b/chrome/browser/extensions/extension_install_prompt.cc
@@ -206,8 +206,6 @@
       return "EXTERNAL_INSTALL_PROMPT";
     case ExtensionInstallPrompt::POST_INSTALL_PERMISSIONS_PROMPT:
       return "POST_INSTALL_PERMISSIONS_PROMPT";
-    case ExtensionInstallPrompt::LAUNCH_PROMPT:
-      return "LAUNCH_PROMPT";
     case ExtensionInstallPrompt::REMOTE_INSTALL_PROMPT:
       return "REMOTE_INSTALL_PROMPT";
     case ExtensionInstallPrompt::REPAIR_PROMPT:
@@ -216,6 +214,9 @@
       return "DELEGATED_PERMISSIONS_PROMPT";
     case ExtensionInstallPrompt::DELEGATED_BUNDLE_PERMISSIONS_PROMPT:
       return "DELEGATED_BUNDLE_PERMISSIONS_PROMPT";
+    case ExtensionInstallPrompt::LAUNCH_PROMPT_DEPRECATED:
+      NOTREACHED();
+      // fall through:
     case ExtensionInstallPrompt::UNSET_PROMPT_TYPE:
     case ExtensionInstallPrompt::NUM_PROMPT_TYPES:
       break;
@@ -727,13 +728,8 @@
       profile_ &&
       extensions::ExtensionPrefs::Get(profile_)->HasDisableReason(
           extension->id(), extensions::Extension::DISABLE_REMOTE_INSTALL);
-  bool is_ephemeral =
-      extensions::util::IsEphemeralApp(extension->id(), profile_);
-
   PromptType type = UNSET_PROMPT_TYPE;
-  if (is_ephemeral)
-    type = LAUNCH_PROMPT;
-  else if (is_remote_install)
+  if (is_remote_install)
     type = REMOTE_INSTALL_PROMPT;
   else
     type = RE_ENABLE_PROMPT;
@@ -900,7 +896,6 @@
     case INLINE_INSTALL_PROMPT:
     case EXTERNAL_INSTALL_PROMPT:
     case INSTALL_PROMPT:
-    case LAUNCH_PROMPT:
     case POST_INSTALL_PERMISSIONS_PROMPT:
     case REMOTE_INSTALL_PROMPT:
     case REPAIR_PROMPT:
@@ -913,6 +908,7 @@
       prompt_->set_bundle(bundle_);
       break;
     }
+    case LAUNCH_PROMPT_DEPRECATED:
     default:
       NOTREACHED() << "Unknown message";
       return;
diff --git a/chrome/browser/extensions/extension_install_prompt.h b/chrome/browser/extensions/extension_install_prompt.h
index f558877..7548db8 100644
--- a/chrome/browser/extensions/extension_install_prompt.h
+++ b/chrome/browser/extensions/extension_install_prompt.h
@@ -63,7 +63,7 @@
     PERMISSIONS_PROMPT,
     EXTERNAL_INSTALL_PROMPT,
     POST_INSTALL_PERMISSIONS_PROMPT,
-    LAUNCH_PROMPT,
+    LAUNCH_PROMPT_DEPRECATED,
     REMOTE_INSTALL_PROMPT,
     REPAIR_PROMPT,
     DELEGATED_PERMISSIONS_PROMPT,
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index e8023b3b..f29af63ca 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -566,10 +566,8 @@
   if (extension && extension->was_installed_by_custodian())
     creation_flags |= Extension::WAS_INSTALLED_BY_CUSTODIAN;
 
-  if (extension) {
-    installer->set_is_ephemeral(extension_prefs_->IsEphemeralApp(id));
+  if (extension)
     installer->set_do_not_sync(extension_prefs_->DoNotSync(id));
-  }
 
   installer->set_creation_flags(creation_flags);
 
@@ -1512,12 +1510,9 @@
           extensions::ExtensionSystem::Get(GetBrowserContext())->app_sorting();
       app_sorting->SetExtensionVisible(
           extension->id(),
-          extension->ShouldDisplayInNewTabPage() &&
-              !extension_prefs_->IsEphemeralApp(extension->id()));
-      if (!extension_prefs_->IsEphemeralApp(extension->id())) {
-        app_sorting->EnsureValidOrdinals(extension->id(),
-                                         syncer::StringOrdinal());
-      }
+          extension->ShouldDisplayInNewTabPage());
+      app_sorting->EnsureValidOrdinals(extension->id(),
+                                       syncer::StringOrdinal());
     }
 
     registry_->AddEnabled(extension);
@@ -1762,12 +1757,6 @@
                               extension->GetType(), 100);
     UMA_HISTOGRAM_ENUMERATION("Extensions.UpdateSource",
                               extension->location(), Manifest::NUM_LOCATIONS);
-
-    // A fully installed app cannot be demoted to an ephemeral app.
-    if ((install_flags & extensions::kInstallFlagIsEphemeral) &&
-        !extension_prefs_->IsEphemeralApp(id)) {
-      install_flags &= ~static_cast<int>(extensions::kInstallFlagIsEphemeral);
-    }
   }
 
   const Extension::State initial_state =
@@ -1857,7 +1846,6 @@
     const syncer::StringOrdinal& page_ordinal,
     const std::string& install_parameter) {
   CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-  bool was_ephemeral = extension_prefs_->IsEphemeralApp(extension->id());
   extension_prefs_->OnExtensionInstalled(
       extension, initial_state, page_ordinal, install_flags, install_parameter);
   delayed_installs_.Remove(extension->id());
@@ -1869,11 +1857,11 @@
     app_data_migrator_->DoMigrationAndReply(
         old, extension,
         base::Bind(&ExtensionService::FinishInstallation, AsWeakPtr(),
-                   make_scoped_refptr(extension), was_ephemeral));
+                   make_scoped_refptr(extension)));
     return;
   }
 
-  FinishInstallation(extension, was_ephemeral);
+  FinishInstallation(extension);
 }
 
 void ExtensionService::MaybeFinishDelayedInstallation(
@@ -1918,15 +1906,14 @@
   CHECK(extension.get());
   delayed_installs_.Remove(extension_id);
 
-  bool was_ephemeral = extension_prefs_->IsEphemeralApp(extension->id());
   if (!extension_prefs_->FinishDelayedInstallInfo(extension_id))
     NOTREACHED();
 
-  FinishInstallation(extension.get(), was_ephemeral);
+  FinishInstallation(extension.get());
 }
 
 void ExtensionService::FinishInstallation(
-    const Extension* extension, bool was_ephemeral) {
+    const Extension* extension) {
   const extensions::Extension* existing_extension =
       GetInstalledExtension(extension->id());
   bool is_update = false;
@@ -1935,11 +1922,8 @@
     is_update = true;
     old_name = existing_extension->name();
   }
-  bool from_ephemeral =
-      was_ephemeral && !extension_prefs_->IsEphemeralApp(extension->id());
-
   registry_->TriggerOnWillBeInstalled(
-      extension, is_update, from_ephemeral, old_name);
+      extension, is_update, old_name);
 
   // Unpacked extensions default to allowing file access, but if that has been
   // overridden, don't reset the value.
@@ -1959,72 +1943,6 @@
     MaybeFinishDelayedInstallations();
 }
 
-void ExtensionService::PromoteEphemeralApp(
-    const extensions::Extension* extension, bool is_from_sync) {
-  DCHECK(GetInstalledExtension(extension->id()) &&
-         extension_prefs_->IsEphemeralApp(extension->id()));
-
-  if (extension->RequiresSortOrdinal()) {
-    AppSorting* app_sorting =
-        extensions::ExtensionSystem::Get(GetBrowserContext())->app_sorting();
-    app_sorting->SetExtensionVisible(extension->id(),
-                                     extension->ShouldDisplayInNewTabPage());
-
-    if (!is_from_sync) {
-      // Reset the sort ordinals of the app to ensure it is added to the default
-      // position, like newly installed apps would.
-      app_sorting->ClearOrdinals(extension->id());
-    }
-
-    app_sorting->EnsureValidOrdinals(extension->id(), syncer::StringOrdinal());
-  }
-
-  // Remove the ephemeral flags from the preferences.
-  extension_prefs_->OnEphemeralAppPromoted(extension->id());
-
-  // Fire install-related events to allow observers to handle the promotion
-  // of the ephemeral app.
-  registry_->TriggerOnWillBeInstalled(
-      extension,
-      true /* is update */,
-      true /* from ephemeral */,
-      extension->name() /* old name */);
-
-  if (registry_->enabled_extensions().Contains(extension->id())) {
-    // If the app is already enabled and loaded, fire the load events to allow
-    // observers to handle the promotion of the ephemeral app.
-    content::NotificationService::current()->Notify(
-        extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED,
-        content::Source<Profile>(profile_),
-        content::Details<const Extension>(extension));
-
-    registry_->TriggerOnLoaded(extension);
-  } else {
-    // Cached ephemeral apps may be updated and disabled due to permissions
-    // increase. The app can be enabled (as long as no other disable reasons
-    // exist) as the install was user-acknowledged.
-    int disable_mask = Extension::DISABLE_NONE;
-    if (!is_from_sync)
-      disable_mask |= Extension::DISABLE_PERMISSIONS_INCREASE;
-
-    int other_disable_reasons =
-        extension_prefs_->GetDisableReasons(extension->id()) & ~disable_mask;
-    if (!other_disable_reasons) {
-      if (extension_prefs_->DidExtensionEscalatePermissions(extension->id()))
-        GrantPermissionsAndEnableExtension(extension);
-      else
-        EnableExtension(extension->id());
-    }
-  }
-
-  registry_->TriggerOnInstalled(extension, true);
-
-  if (!is_from_sync) {
-    ExtensionSyncService::Get(profile_)->SyncExtensionChangeIfNeeded(
-        *extension);
-  }
-}
-
 const Extension* ExtensionService::GetPendingExtensionUpdate(
     const std::string& id) const {
   return delayed_installs_.GetByID(id);
diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h
index c7536efec..4cd10fe5 100644
--- a/chrome/browser/extensions/extension_service.h
+++ b/chrome/browser/extensions/extension_service.h
@@ -336,13 +336,6 @@
   // Checks for delayed installation for all pending installs.
   void MaybeFinishDelayedInstallations();
 
-  // Promotes an ephemeral app to a regular installed app. Ephemeral apps
-  // are already installed in extension system (albiet transiently) and only
-  // need to be exposed in the UI. Set |is_from_sync| to true if the
-  // install was initiated via sync.
-  void PromoteEphemeralApp(
-      const extensions::Extension* extension, bool is_from_sync);
-
   // ExtensionHost of background page calls this method right after its render
   // view has been created.
   void DidCreateRenderViewForBackgroundPage(extensions::ExtensionHost* host);
@@ -447,7 +440,7 @@
   }
 
   void FinishInstallationForTest(const extensions::Extension* extension) {
-    FinishInstallation(extension, false /* not ephemeral */);
+    FinishInstallation(extension);
   }
 #endif
 
@@ -549,10 +542,8 @@
       const extensions::Extension* extension,
       extensions::UnloadedExtensionInfo::Reason reason);
 
-  // Common helper to finish installing the given extension. |was_ephemeral|
-  // should be true if the extension was previously installed and ephemeral.
-  void FinishInstallation(const extensions::Extension* extension,
-                          bool was_ephemeral);
+  // Common helper to finish installing the given extension.
+  void FinishInstallation(const extensions::Extension* extension);
 
   // Disables the extension if the privilege level has increased
   // (e.g., due to an upgrade).
diff --git a/chrome/browser/extensions/extension_service_test_with_install.cc b/chrome/browser/extensions/extension_service_test_with_install.cc
index 7f6e37f8..f2cedef 100644
--- a/chrome/browser/extensions/extension_service_test_with_install.cc
+++ b/chrome/browser/extensions/extension_service_test_with_install.cc
@@ -399,7 +399,6 @@
     content::BrowserContext* browser_context,
     const Extension* extension,
     bool is_update,
-    bool from_ephemeral,
     const std::string& old_name) {
   installed_ = extension;
   was_update_ = is_update;
diff --git a/chrome/browser/extensions/extension_service_test_with_install.h b/chrome/browser/extensions/extension_service_test_with_install.h
index b9bb169..0ad20eb 100644
--- a/chrome/browser/extensions/extension_service_test_with_install.h
+++ b/chrome/browser/extensions/extension_service_test_with_install.h
@@ -122,7 +122,6 @@
   void OnExtensionWillBeInstalled(content::BrowserContext* browser_context,
                                   const Extension* extension,
                                   bool is_update,
-                                  bool from_ephemeral,
                                   const std::string& old_name) override;
 
   // TODO(treib,devlin): Make these private and add accessors as needed.
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc
index 355da39..72c553b3 100644
--- a/chrome/browser/extensions/extension_service_unittest.cc
+++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -949,7 +949,6 @@
   void OnExtensionWillBeInstalled(content::BrowserContext* browser_context,
                                   const Extension* extension,
                                   bool is_update,
-                                  bool from_ephemeral,
                                   const std::string& old_name) override {
     last_extension_installed = extension->id();
   }
diff --git a/chrome/browser/extensions/extension_storage_monitor.cc b/chrome/browser/extensions/extension_storage_monitor.cc
index 7da8fef7..25581ed 100644
--- a/chrome/browser/extensions/extension_storage_monitor.cc
+++ b/chrome/browser/extensions/extension_storage_monitor.cc
@@ -46,11 +46,9 @@
 // The rate at which we would like to observe storage events.
 const int kStorageEventRateSec = 30;
 
-// Set the thresholds for the first notification. Ephemeral apps have a lower
-// threshold than installed extensions and apps. Once a threshold is exceeded,
+// Set the thresholds for the first notification. Once a threshold is exceeded,
 // it will be doubled to throttle notifications.
 const int64 kMBytes = 1024 * 1024;
-const int64 kEphemeralAppInitialThreshold = 250 * kMBytes;
 const int64 kExtensionInitialThreshold = 1000 * kMBytes;
 
 // Notifications have an ID so that we can update them.
@@ -277,7 +275,6 @@
     content::BrowserContext* context)
     : enable_for_all_extensions_(false),
       initial_extension_threshold_(kExtensionInitialThreshold),
-      initial_ephemeral_threshold_(kEphemeralAppInitialThreshold),
       observer_rate_(base::TimeDelta::FromSeconds(kStorageEventRateSec)),
       context_(context),
       extension_prefs_(ExtensionPrefs::Get(context)),
@@ -324,11 +321,8 @@
     content::BrowserContext* browser_context,
     const Extension* extension,
     bool is_update,
-    bool from_ephemeral,
     const std::string& old_name) {
-  // If an ephemeral app was promoted to a regular installed app, we may need to
-  // increase its next threshold.
-  if (!from_ephemeral || !ShouldMonitorStorageFor(extension))
+  if (!ShouldMonitorStorageFor(extension))
     return;
 
   if (!enable_for_all_extensions_) {
@@ -494,12 +488,8 @@
   if (!ShouldMonitorStorageFor(extension))
     return;
 
-  // First apply this feature only to experimental ephemeral apps. If it works
-  // well, roll it out to all extensions and apps.
-  bool should_enforce =
-      (enable_for_all_extensions_ ||
-       extension_prefs_->IsEphemeralApp(extension->id())) &&
-      IsStorageNotificationEnabled(extension->id());
+  bool should_enforce = (enable_for_all_extensions_) &&
+                        IsStorageNotificationEnabled(extension->id());
 
   bool for_metrics = ShouldGatherMetricsFor(extension);
 
@@ -616,9 +606,7 @@
   if (next_threshold == 0) {
     // The next threshold is written to the prefs after the initial threshold is
     // exceeded.
-    next_threshold = extension_prefs_->IsEphemeralApp(extension_id)
-                         ? initial_ephemeral_threshold_
-                         : initial_extension_threshold_;
+    next_threshold = initial_extension_threshold_;
   }
   return next_threshold;
 }
diff --git a/chrome/browser/extensions/extension_storage_monitor.h b/chrome/browser/extensions/extension_storage_monitor.h
index d739851..df3b8ef 100644
--- a/chrome/browser/extensions/extension_storage_monitor.h
+++ b/chrome/browser/extensions/extension_storage_monitor.h
@@ -65,7 +65,6 @@
   void OnExtensionWillBeInstalled(content::BrowserContext* browser_context,
                                   const Extension* extension,
                                   bool is_update,
-                                  bool from_ephemeral,
                                   const std::string& old_name) override;
   void OnExtensionUninstalled(content::BrowserContext* browser_context,
                               const Extension* extension,
@@ -118,10 +117,8 @@
   bool enable_for_all_extensions_;
 
   // The first notification is shown after the initial threshold is exceeded.
-  // Ephemeral apps have a lower threshold than fully installed extensions.
   // A lower threshold is set by tests.
   int64 initial_extension_threshold_;
-  int64 initial_ephemeral_threshold_;
 
   // The rate at which we would like to receive storage updates
   // from QuotaManager. Overridden in tests.
diff --git a/chrome/browser/extensions/extension_storage_monitor_browsertest.cc b/chrome/browser/extensions/extension_storage_monitor_browsertest.cc
index 1865a13..10b7c25 100644
--- a/chrome/browser/extensions/extension_storage_monitor_browsertest.cc
+++ b/chrome/browser/extensions/extension_storage_monitor_browsertest.cc
@@ -97,11 +97,6 @@
     return storage_monitor_->initial_extension_threshold_;
   }
 
-  int64 GetInitialEphemeralThreshold() {
-    CHECK(storage_monitor_);
-    return storage_monitor_->initial_ephemeral_threshold_;
-  }
-
   void DisableForInstalledExtensions() {
     CHECK(storage_monitor_);
     storage_monitor_->enable_for_all_extensions_ = false;
@@ -114,19 +109,6 @@
     return extension;
   }
 
-  const Extension* InitWriteDataEphemeralApp() {
-    // The threshold for installed extensions should be higher than ephemeral
-    // apps.
-    storage_monitor_->initial_extension_threshold_ =
-        storage_monitor_->initial_ephemeral_threshold_ * 4;
-
-    base::FilePath path = test_data_dir_.AppendASCII(kWriteDataApp);
-    const Extension* extension = InstallEphemeralAppWithSourceAndFlags(
-        path, 1, Manifest::INTERNAL, Extension::NO_FLAGS);
-    EXPECT_TRUE(extension);
-    return extension;
-  }
-
   std::string GetNotificationId(const std::string& extension_id) {
     return monitor()->GetNotificationId(extension_id);
   }
@@ -160,7 +142,6 @@
     // to trigger notifications in these tests.
     storage_monitor_->enable_for_all_extensions_ = true;
     storage_monitor_->initial_extension_threshold_ = kInitialUsageThreshold;
-    storage_monitor_->initial_ephemeral_threshold_ = kInitialUsageThreshold;
 
     // To ensure storage events are dispatched from QuotaManager immediately.
     storage_monitor_->observer_rate_ = base::TimeDelta();
@@ -257,52 +238,6 @@
   WriteBytesNotExpectingNotification(extension, next_data_size);
 }
 
-// Verify that thresholds for ephemeral apps are reset when they are
-// promoted to regular installed apps.
-IN_PROC_BROWSER_TEST_F(ExtensionStorageMonitorTest, EphemeralAppLowUsage) {
-  const Extension* extension = InitWriteDataEphemeralApp();
-  ASSERT_TRUE(extension);
-  WriteBytesExpectingNotification(extension, GetInitialEphemeralThreshold());
-
-  // Store the number of bytes until the next threshold is reached.
-  int64 next_threshold = GetNextStorageThreshold(extension->id());
-  int64 next_data_size = next_threshold - GetInitialEphemeralThreshold();
-  ASSERT_GT(next_data_size, 0);
-  EXPECT_GE(GetInitialExtensionThreshold(), next_threshold);
-
-  // Promote the ephemeral app.
-  ExtensionService* service =
-      ExtensionSystem::Get(profile())->extension_service();
-  service->PromoteEphemeralApp(extension, false);
-
-  // The next threshold should now be equal to the initial threshold for
-  // extensions (which is higher than the initial threshold for ephemeral apps).
-  EXPECT_EQ(GetInitialExtensionThreshold(),
-            GetNextStorageThreshold(extension->id()));
-
-  // Since the threshold was increased, a notification should not be
-  // triggered.
-  WriteBytesNotExpectingNotification(extension, next_data_size);
-}
-
-// Verify that thresholds for ephemeral apps are not reset when they are
-// promoted to regular installed apps if their usage is higher than the initial
-// threshold for installed extensions.
-IN_PROC_BROWSER_TEST_F(ExtensionStorageMonitorTest, EphemeralAppWithHighUsage) {
-  const Extension* extension = InitWriteDataEphemeralApp();
-  ASSERT_TRUE(extension);
-  WriteBytesExpectingNotification(extension, GetInitialExtensionThreshold());
-  int64 saved_next_threshold = GetNextStorageThreshold(extension->id());
-
-  // Promote the ephemeral app.
-  ExtensionService* service =
-      ExtensionSystem::Get(profile())->extension_service();
-  service->PromoteEphemeralApp(extension, false);
-
-  // The next threshold should not have changed.
-  EXPECT_EQ(saved_next_threshold, GetNextStorageThreshold(extension->id()));
-}
-
 // Ensure that monitoring is disabled for installed extensions if
 // |enable_for_all_extensions_| is false. This test can be removed if monitoring
 // is eventually enabled for all extensions.
diff --git a/chrome/browser/extensions/extension_sync_service.cc b/chrome/browser/extensions/extension_sync_service.cc
index 29c6f90..42ac918 100644
--- a/chrome/browser/extensions/extension_sync_service.cc
+++ b/chrome/browser/extensions/extension_sync_service.cc
@@ -438,12 +438,6 @@
       extension_prefs->ReplaceDisableReasons(id, disable_reasons);
   }
 
-  // If the target extension has already been installed ephemerally, it can
-  // be promoted to a regular installed extension and downloading from the Web
-  // Store is not necessary.
-  if (extension && extensions::util::IsEphemeralApp(id, profile_))
-    extension_service()->PromoteEphemeralApp(extension, true);
-
   // Update the incognito flag.
   extensions::util::SetIsIncognitoEnabled(
       id, profile_, extension_sync_data.incognito_enabled());
diff --git a/chrome/browser/extensions/extension_ui_util.cc b/chrome/browser/extensions/extension_ui_util.cc
index 4cf4fa8..55c72fcb 100644
--- a/chrome/browser/extensions/extension_ui_util.cc
+++ b/chrome/browser/extensions/extension_ui_util.cc
@@ -31,8 +31,7 @@
 
 bool ShouldDisplayInAppLauncher(const Extension* extension,
                                 content::BrowserContext* context) {
-  return CanDisplayInAppLauncher(extension, context) &&
-         !util::IsEphemeralApp(extension->id(), context);
+  return CanDisplayInAppLauncher(extension, context);
 }
 
 bool CanDisplayInAppLauncher(const Extension* extension,
@@ -44,20 +43,17 @@
 bool ShouldDisplayInNewTabPage(const Extension* extension,
                                content::BrowserContext* context) {
   return extension->ShouldDisplayInNewTabPage() &&
-      !IsBlockedByPolicy(extension, context) &&
-      !util::IsEphemeralApp(extension->id(), context);
+      !IsBlockedByPolicy(extension, context);
 }
 
 bool ShouldDisplayInExtensionSettings(const Extension* extension,
                                       content::BrowserContext* context) {
-  return extension->ShouldDisplayInExtensionSettings() &&
-      !util::IsEphemeralApp(extension->id(), context);
+  return extension->ShouldDisplayInExtensionSettings();
 }
 
 bool ShouldNotBeVisible(const Extension* extension,
                         content::BrowserContext* context) {
-  return extension->ShouldNotBeVisible() ||
-      util::IsEphemeralApp(extension->id(), context);
+  return extension->ShouldNotBeVisible();
 }
 
 }  // namespace ui_util
diff --git a/chrome/browser/extensions/extension_util.cc b/chrome/browser/extensions/extension_util.cc
index d2d3065..7fe28854e 100644
--- a/chrome/browser/extensions/extension_util.cc
+++ b/chrome/browser/extensions/extension_util.cc
@@ -276,7 +276,6 @@
 bool ShouldSync(const Extension* extension,
                 content::BrowserContext* context) {
   return sync_helper::IsSyncable(extension) &&
-         !util::IsEphemeralApp(extension->id(), context) &&
          !ExtensionPrefs::Get(context)->DoNotSync(extension->id());
 }
 
diff --git a/chrome/browser/extensions/updater/extension_updater.cc b/chrome/browser/extensions/updater/extension_updater.cc
index 569cea8b7..da7611d 100644
--- a/chrome/browser/extensions/updater/extension_updater.cc
+++ b/chrome/browser/extensions/updater/extension_updater.cc
@@ -655,7 +655,6 @@
     content::BrowserContext* browser_context,
     const Extension* extension,
     bool is_update,
-    bool from_ephemeral,
     const std::string& old_name) {
   throttle_info_.erase(extension->id());
 }
diff --git a/chrome/browser/extensions/updater/extension_updater.h b/chrome/browser/extensions/updater/extension_updater.h
index 5d95d05..e5cebd4 100644
--- a/chrome/browser/extensions/updater/extension_updater.h
+++ b/chrome/browser/extensions/updater/extension_updater.h
@@ -221,7 +221,6 @@
   void OnExtensionWillBeInstalled(content::BrowserContext* browser_context,
                                   const Extension* extension,
                                   bool is_update,
-                                  bool from_ephemeral,
                                   const std::string& old_name) override;
 
   // Send a notification that update checks are starting.
diff --git a/chrome/browser/extensions/webstore_standalone_installer.cc b/chrome/browser/extensions/webstore_standalone_installer.cc
index 760cb00e..84565c9 100644
--- a/chrome/browser/extensions/webstore_standalone_installer.cc
+++ b/chrome/browser/extensions/webstore_standalone_installer.cc
@@ -18,7 +18,6 @@
 #include "extensions/browser/extension_prefs.h"
 #include "extensions/browser/extension_registry.h"
 #include "extensions/browser/extension_system.h"
-#include "extensions/browser/extension_util.h"
 #include "extensions/common/extension.h"
 #include "extensions/common/extension_urls.h"
 #include "url/gurl.h"
@@ -209,28 +208,6 @@
       // Don't install a blacklisted extension.
       install_result = webstore_install::BLACKLISTED;
       install_message = kExtensionIsBlacklisted;
-    } else if (util::IsEphemeralApp(installed_extension->id(), profile_)) {
-      // If the target extension has already been installed ephemerally and is
-      // up to date, it can be promoted to a regular installed extension and
-      // downloading from the Web Store is not necessary.
-      scoped_refptr<const Extension> extension_to_install =
-          GetLocalizedExtensionForDisplay();
-      if (!extension_to_install.get()) {
-        CompleteInstall(webstore_install::INVALID_MANIFEST,
-                        kInvalidManifestError);
-        return;
-      }
-
-      if (installed_extension->version()->CompareTo(
-              *extension_to_install->version()) < 0) {
-        // If the existing extension is out of date, proceed with the install
-        // to update the extension.
-        done = false;
-      } else {
-        install_ui::ShowPostInstallUIForApproval(
-            profile_, *approval, installed_extension);
-        extension_service->PromoteEphemeralApp(installed_extension, false);
-      }
     } else if (!extension_service->IsExtensionEnabled(id_)) {
       // If the extension is installed but disabled, and not blacklisted,
       // enable it.
diff --git a/chrome/browser/extensions/zipfile_installer_unittest.cc b/chrome/browser/extensions/zipfile_installer_unittest.cc
index a42b9c5..d4421e64 100644
--- a/chrome/browser/extensions/zipfile_installer_unittest.cc
+++ b/chrome/browser/extensions/zipfile_installer_unittest.cc
@@ -46,7 +46,6 @@
   void OnExtensionWillBeInstalled(content::BrowserContext* browser_context,
                                   const Extension* extension,
                                   bool is_update,
-                                  bool from_ephemeral,
                                   const std::string& old_name) override {
     last_extension_installed = extension->id();
     quit_closure_.Run();
diff --git a/chrome/browser/notifications/notifier_state_tracker.cc b/chrome/browser/notifications/notifier_state_tracker.cc
index 86405a8..9f55f227 100644
--- a/chrome/browser/notifications/notifier_state_tracker.cc
+++ b/chrome/browser/notifications/notifier_state_tracker.cc
@@ -162,10 +162,6 @@
   if (IsNotifierEnabled(notifier_id))
     return;
 
-  // The settings for ephemeral apps will be persisted across cache evictions.
-  if (extensions::util::IsEphemeralApp(extension->id(), profile_))
-    return;
-
   SetNotifierEnabled(notifier_id, true);
 }
 
diff --git a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
index 2e73738..8b4ece1 100644
--- a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
+++ b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
@@ -63,7 +63,6 @@
 
 #if defined(ENABLE_EXTENSIONS)
 #include "apps/browser_context_keyed_service_factories.h"
-#include "chrome/browser/apps/ephemeral_app_service_factory.h"
 #include "chrome/browser/apps/shortcut_manager_factory.h"
 #include "chrome/browser/extensions/api/networking_private/networking_private_ui_delegate_factory_impl.h"
 #include "chrome/browser/extensions/api/networking_private/networking_private_verify_delegate_factory_impl.h"
@@ -175,7 +174,6 @@
   extensions::ExtensionManagementFactory::GetInstance();
   chrome_extensions::EnsureBrowserContextKeyedServiceFactoriesBuilt();
   AppShortcutManagerFactory::GetInstance();
-  EphemeralAppServiceFactory::GetInstance();
 #endif
 
 #if defined(ENABLE_APP_LIST)
diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc
index 229ee242..483adde 100644
--- a/chrome/browser/themes/theme_service.cc
+++ b/chrome/browser/themes/theme_service.cc
@@ -125,7 +125,6 @@
   void OnExtensionWillBeInstalled(content::BrowserContext* browser_context,
                                   const extensions::Extension* extension,
                                   bool is_update,
-                                  bool from_ephemeral,
                                   const std::string& old_name) override {
     if (extension->is_theme()) {
       // The theme may be initially disabled. Wait till it is loaded (if ever).
diff --git a/chrome/browser/ui/app_list/app_list_test_util.cc b/chrome/browser/ui/app_list/app_list_test_util.cc
index e67800b..ba33a98 100644
--- a/chrome/browser/ui/app_list/app_list_test_util.cc
+++ b/chrome/browser/ui/app_list/app_list_test_util.cc
@@ -29,7 +29,6 @@
   // - 1 dummy extension (which should not be visible in the launcher)
   // - 2 packaged extension apps
   // - 1 hosted extension app
-  // - 1 ephemeral app (which should not be visible in the launcher)
   base::FilePath source_install_dir =
       data_dir().AppendASCII("app_list").AppendASCII("Extensions");
   base::FilePath pref_path = source_install_dir
@@ -38,6 +37,6 @@
   InitializeInstalledExtensionService(pref_path, source_install_dir);
   service_->Init();
 
-  // There should be 5 extensions in the test profile.
-  ASSERT_EQ(5U, registry()->enabled_extensions().size());
+  // There should be 4 extensions in the test profile.
+  ASSERT_EQ(4U, registry()->enabled_extensions().size());
 }
diff --git a/chrome/browser/ui/app_list/search/webstore/webstore_result.cc b/chrome/browser/ui/app_list/search/webstore/webstore_result.cc
index d160709..f97a5f0 100644
--- a/chrome/browser/ui/app_list/search/webstore/webstore_result.cc
+++ b/chrome/browser/ui/app_list/search/webstore/webstore_result.cc
@@ -22,7 +22,6 @@
 #include "chrome/grit/generated_resources.h"
 #include "extensions/browser/extension_registry.h"
 #include "extensions/browser/extension_system.h"
-#include "extensions/browser/extension_util.h"
 #include "extensions/common/extension.h"
 #include "extensions/common/extension_urls.h"
 #include "grit/theme_resources.h"
@@ -127,7 +126,8 @@
 
   const bool is_otr = profile_->IsOffTheRecord();
   const bool is_installed =
-      extensions::util::IsExtensionInstalledPermanently(app_id_, profile_);
+      extension_registry_->GetExtensionById(
+          app_id_, extensions::ExtensionRegistry::EVERYTHING) != nullptr;
 
   if (!is_otr && !is_installed && !is_installing()) {
     actions.push_back(Action(
@@ -228,8 +228,8 @@
   SetIsInstalling(false);
   UpdateActions();
 
-  if (extensions::util::IsExtensionInstalledPermanently(extension->id(),
-                                                        profile_)) {
+  if (extension_registry_->GetExtensionById(
+          app_id_, extensions::ExtensionRegistry::EVERYTHING)) {
     NotifyItemInstalled();
   }
 }
diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi
index 2e8333b..dc117a6 100644
--- a/chrome/chrome_browser_extensions.gypi
+++ b/chrome/chrome_browser_extensions.gypi
@@ -93,10 +93,6 @@
       'browser/apps/app_url_redirector.h',
       'browser/apps/app_window_registry_util.cc',
       'browser/apps/app_window_registry_util.h',
-      'browser/apps/ephemeral_app_service.cc',
-      'browser/apps/ephemeral_app_service.h',
-      'browser/apps/ephemeral_app_service_factory.cc',
-      'browser/apps/ephemeral_app_service_factory.h',
       'browser/apps/install_chrome_app.cc',
       'browser/apps/install_chrome_app.h',
       'browser/apps/per_app_settings_service.cc',
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 20c6f40..b6be22a 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -54,9 +54,6 @@
       'browser/apps/app_speech_recognition_browsertest.cc',
       'browser/apps/app_url_redirector_browsertest.cc',
       'browser/apps/app_window_browsertest.cc',
-      'browser/apps/ephemeral_app_browsertest.cc',
-      'browser/apps/ephemeral_app_browsertest.h',
-      'browser/apps/ephemeral_app_service_browsertest.cc',
       'browser/apps/event_page_browsertest.cc',
       'browser/apps/guest_view/app_view_browsertest.cc',
       'browser/apps/guest_view/extension_view/extension_view_browsertest.cc',
diff --git a/chrome/test/data/extensions/app_list/Extensions/ebgmjfhpkngekpdlgfdbolkhfmofdfdf/1.0/main.js b/chrome/test/data/extensions/app_list/Extensions/ebgmjfhpkngekpdlgfdbolkhfmofdfdf/1.0/main.js
deleted file mode 100644
index af31f657..0000000
--- a/chrome/test/data/extensions/app_list/Extensions/ebgmjfhpkngekpdlgfdbolkhfmofdfdf/1.0/main.js
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Deliberately empty.
diff --git a/chrome/test/data/extensions/app_list/Extensions/ebgmjfhpkngekpdlgfdbolkhfmofdfdf/1.0/manifest.json b/chrome/test/data/extensions/app_list/Extensions/ebgmjfhpkngekpdlgfdbolkhfmofdfdf/1.0/manifest.json
deleted file mode 100644
index f4cfb3e8..0000000
--- a/chrome/test/data/extensions/app_list/Extensions/ebgmjfhpkngekpdlgfdbolkhfmofdfdf/1.0/manifest.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
-  "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtd5jeTaSP38on5y28W8f5MV+F4mvYMx0kOJXp8M+EteL9x5TS3et5a7W1jnduIdGtH0Xc5WKhvUnN2nUmEqjzzdRYvzjpWrTr73oFreebqNhJP47D75HdbWZqf8iCQwVJDKxbQ6OzHG8xoWd1ksNtQGUBUhMQXOt7d4/36TbansJ5neRS2akXY8GRWkGHtRJENNy85IoeV8erZc6WTeTM/M2wK/V3j9do1RmueKBU4Dz3H8Ix5/t2mJSantOPedf2We08+7CadB32+wE90OjPcuO9itaU1lhTXiUZeISLdzZv2ybyiOglkzP+wY4dWlDsF+5/3FN7mjQuWg4vg+pgwIDAQAB",
-  "version": "1.0",
-  "name": "Ephemeral App",
-  "manifest_version": 2,
-  "app": {
-    "background": {
-      "scripts": [ "main.js" ]
-    }
-  }
-}
diff --git a/chrome/test/data/extensions/app_list/Preferences b/chrome/test/data/extensions/app_list/Preferences
index 5137d81..bb1de10 100644
--- a/chrome/test/data/extensions/app_list/Preferences
+++ b/chrome/test/data/extensions/app_list/Preferences
@@ -66,25 +66,6 @@
                 }
               }
             }
-         },
-         "ebgmjfhpkngekpdlgfdbolkhfmofdfdf": {
-            "location": 1,
-            "path": "ebgmjfhpkngekpdlgfdbolkhfmofdfdf/1.0",
-            "app_launcher_ordinal": "t",
-            "page_ordinal": "n",
-            "state": 1,
-            "install_time": "12968795380420751",
-            "ephemeral_app": true,
-            "manifest": {
-              "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtd5jeTaSP38on5y28W8f5MV+F4mvYMx0kOJXp8M+EteL9x5TS3et5a7W1jnduIdGtH0Xc5WKhvUnN2nUmEqjzzdRYvzjpWrTr73oFreebqNhJP47D75HdbWZqf8iCQwVJDKxbQ6OzHG8xoWd1ksNtQGUBUhMQXOt7d4/36TbansJ5neRS2akXY8GRWkGHtRJENNy85IoeV8erZc6WTeTM/M2wK/V3j9do1RmueKBU4Dz3H8Ix5/t2mJSantOPedf2We08+7CadB32+wE90OjPcuO9itaU1lhTXiUZeISLdzZv2ybyiOglkzP+wY4dWlDsF+5/3FN7mjQuWg4vg+pgwIDAQAB",
-              "version": "1.0",
-              "name": "Ephemeral App",
-              "app": {
-                "background": {
-                  "scripts": [ "main.js" ]
-                }
-              }
-            }
          }
       }
    }