Commit e338d291 authored by nancy's avatar nancy Committed by Commit Bot

Remove apps_launch.

BUG=1061843

Change-Id: I25a5dc2f46bab171ea48b38c5b2a6824e84a2ee8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2123576Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Nancy Wang <nancylingwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#755342}
parent 0a88f283
# Copyright 2018 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.
import("//extensions/buildflags/buildflags.gni")
# TODO(loyso): Remove this assertion. apps/ will be based off-extensions.
assert(enable_extensions)
source_set("apps") {
sources = [
"apps_launch.cc",
"apps_launch.h",
]
deps = [ "//chrome/browser/apps/platform_apps" ]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
}
...@@ -29,13 +29,10 @@ BrowserAppLauncher::~BrowserAppLauncher() = default; ...@@ -29,13 +29,10 @@ BrowserAppLauncher::~BrowserAppLauncher() = default;
void BrowserAppLauncher::LaunchAppWithCallback( void BrowserAppLauncher::LaunchAppWithCallback(
const std::string& app_id, const std::string& app_id,
const base::CommandLine& command_line,
const base::FilePath& current_directory, const base::FilePath& current_directory,
base::OnceCallback<void(Browser* browser, base::OnceCallback<void(Browser* browser,
apps::mojom::LaunchContainer container)> callback) { apps::mojom::LaunchContainer container)> callback) {
// TODO(crbug.com/1061843): Remove command_line from AppLaunchParams, and get
// command line from the current process in GetLaunchFilesFromCommandLine
auto& command_line = *base::CommandLine::ForCurrentProcess();
// old-style app shortcuts // old-style app shortcuts
if (app_id.empty()) { if (app_id.empty()) {
::LaunchAppWithCallback(profile_, app_id, command_line, current_directory, ::LaunchAppWithCallback(profile_, app_id, command_line, current_directory,
......
...@@ -15,6 +15,7 @@ class Browser; ...@@ -15,6 +15,7 @@ class Browser;
class Profile; class Profile;
namespace base { namespace base {
class CommandLine;
class FilePath; class FilePath;
} // namespace base } // namespace base
...@@ -45,6 +46,7 @@ class BrowserAppLauncher { ...@@ -45,6 +46,7 @@ class BrowserAppLauncher {
// browser window was opened. // browser window was opened.
void LaunchAppWithCallback( void LaunchAppWithCallback(
const std::string& app_id, const std::string& app_id,
const base::CommandLine& command_line,
const base::FilePath& current_directory, const base::FilePath& current_directory,
base::OnceCallback<void(Browser* browser, base::OnceCallback<void(Browser* browser,
apps::mojom::LaunchContainer container)> apps::mojom::LaunchContainer container)>
......
// Copyright 2018 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/apps_launch.h"
#include "chrome/browser/apps/platform_apps/platform_app_launch.h"
namespace apps {
bool OpenApplicationWithReenablePrompt(
Profile* profile,
const std::string& app_id,
const base::CommandLine& command_line,
const base::FilePath& current_directory) {
return OpenExtensionApplicationWithReenablePrompt(
profile, app_id, command_line, current_directory);
}
content::WebContents* OpenAppShortcutWindow(Profile* profile, const GURL& url) {
return OpenExtensionAppShortcutWindow(profile, url);
}
} // namespace apps
// Copyright 2018 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_APPS_LAUNCH_H_
#define CHROME_BROWSER_APPS_APPS_LAUNCH_H_
#include <string>
class GURL;
class Profile;
namespace base {
class CommandLine;
class FilePath;
} // namespace base
namespace content {
class WebContents;
} // namespace content
namespace apps {
// TODO(crbug.com/966288): Move these methods into LaunchService.
// Tries to open |app_id|, and prompts the user if the app is disabled. Returns
// true if the app was successfully opened and false otherwise.
bool OpenApplicationWithReenablePrompt(Profile* profile,
const std::string& app_id,
const base::CommandLine& command_line,
const base::FilePath& current_directory);
// Returns web contents if |url| was successfully opened in a window, and
// nullptr otherwise.
content::WebContents* OpenAppShortcutWindow(Profile* profile, const GURL& url);
} // namespace apps
#endif // CHROME_BROWSER_APPS_APPS_LAUNCH_H_
...@@ -4031,7 +4031,6 @@ jumbo_static_library("ui") { ...@@ -4031,7 +4031,6 @@ jumbo_static_library("ui") {
if (enable_extensions) { if (enable_extensions) {
deps += [ deps += [
"//apps", "//apps",
"//chrome/browser/apps",
"//chrome/browser/apps/platform_apps", # TODO(loyso): Remove this dep. "//chrome/browser/apps/platform_apps", # TODO(loyso): Remove this dep.
"//chrome/browser/apps/platform_apps/api", "//chrome/browser/apps/platform_apps/api",
"//chrome/browser/extensions", "//chrome/browser/extensions",
......
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/apps/app_service/app_service_proxy.h" #include "chrome/browser/apps/app_service/app_service_proxy.h"
#include "chrome/browser/apps/app_service/app_service_proxy_factory.h" #include "chrome/browser/apps/app_service/app_service_proxy_factory.h"
#include "chrome/browser/apps/apps_launch.h"
#include "chrome/browser/apps/platform_apps/install_chrome_app.h" #include "chrome/browser/apps/platform_apps/install_chrome_app.h"
#include "chrome/browser/apps/platform_apps/platform_app_launch.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/custom_handlers/protocol_handler_registry.h" #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
...@@ -403,8 +403,8 @@ bool StartupBrowserCreatorImpl::Launch(Profile* profile, ...@@ -403,8 +403,8 @@ bool StartupBrowserCreatorImpl::Launch(Profile* profile,
std::string app_id = command_line_.GetSwitchValueASCII(switches::kAppId); std::string app_id = command_line_.GetSwitchValueASCII(switches::kAppId);
// If |app_id| is a disabled or terminated platform app we handle it // If |app_id| is a disabled or terminated platform app we handle it
// specially here, otherwise it will be handled below. // specially here, otherwise it will be handled below.
if (apps::OpenApplicationWithReenablePrompt(profile, app_id, command_line_, if (apps::OpenExtensionApplicationWithReenablePrompt(
cur_dir_)) { profile, app_id, command_line_, cur_dir_)) {
return true; return true;
} }
} }
...@@ -583,7 +583,7 @@ bool StartupBrowserCreatorImpl::MaybeLaunchApplication(Profile* profile) { ...@@ -583,7 +583,7 @@ bool StartupBrowserCreatorImpl::MaybeLaunchApplication(Profile* profile) {
// Opens an empty browser window if the app_id is invalid. // Opens an empty browser window if the app_id is invalid.
apps::AppServiceProxyFactory::GetForProfile(profile) apps::AppServiceProxyFactory::GetForProfile(profile)
->BrowserAppLauncher() ->BrowserAppLauncher()
.LaunchAppWithCallback(app_id, cur_dir_, .LaunchAppWithCallback(app_id, command_line_, cur_dir_,
base::BindOnce(&FinalizeWebAppLaunch)); base::BindOnce(&FinalizeWebAppLaunch));
return true; return true;
} }
...@@ -603,7 +603,7 @@ bool StartupBrowserCreatorImpl::MaybeLaunchApplication(Profile* profile) { ...@@ -603,7 +603,7 @@ bool StartupBrowserCreatorImpl::MaybeLaunchApplication(Profile* profile) {
if (policy->IsWebSafeScheme(url.scheme()) || if (policy->IsWebSafeScheme(url.scheme()) ||
url.SchemeIs(url::kFileScheme)) { url.SchemeIs(url::kFileScheme)) {
const content::WebContents* web_contents = const content::WebContents* web_contents =
apps::OpenAppShortcutWindow(profile, url); apps::OpenExtensionAppShortcutWindow(profile, url);
if (web_contents) { if (web_contents) {
FinalizeWebAppLaunch( FinalizeWebAppLaunch(
chrome::FindBrowserWithWebContents(web_contents), chrome::FindBrowserWithWebContents(web_contents),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment