Commit 090883ab authored by Manu Cornet's avatar Manu Cornet Committed by Commit Bot

CrOS: Get rid of some leftover panel code

Change-Id: Ib985375a552b06dacf7a647fafcdc87b30afd9e2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2108161
Commit-Queue: Manu Cornet <manucornet@chromium.org>
Reviewed-by: default avatarBen Wells <benwells@chromium.org>
Cr-Commit-Position: refs/heads/master@{#755125}
parent b9220309
......@@ -413,55 +413,6 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest,
"prohibited.html"));
}
IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, LaunchPanelApp) {
// Load an extension that calls launchApp() on any app that gets
// installed.
ExtensionTestMessageListener launcher_loaded("launcher loaded", false);
ASSERT_TRUE(LoadExtension(
test_data_dir_.AppendASCII("management/launch_on_install")));
ASSERT_TRUE(launcher_loaded.WaitUntilSatisfied());
// Load an app with app.launch.container = "panel".
std::string app_id;
LoadAndWaitForLaunch("management/launch_app_panel", &app_id);
ASSERT_FALSE(HasFatalFailure()); // Stop the test if any ASSERT failed.
// Find the app's browser. Check that it is a popup.
ASSERT_EQ(2u, chrome::GetBrowserCount(browser()->profile()));
Browser* app_browser = FindOtherBrowser(browser());
ASSERT_TRUE(app_browser->is_type_app());
// Close the app panel.
CloseBrowserSynchronously(app_browser);
extensions::ExtensionRegistry* registry =
extensions::ExtensionRegistry::Get(browser()->profile());
// Unload the extension.
UninstallExtension(app_id);
ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile()));
ASSERT_FALSE(registry->GetExtensionById(
app_id, extensions::ExtensionRegistry::EVERYTHING));
// Set a pref indicating that the user wants to launch in a regular tab.
// This should be ignored, because panel apps always load in a popup.
extensions::SetLaunchType(browser()->profile(), app_id,
extensions::LAUNCH_TYPE_REGULAR);
// Load the extension again.
std::string app_id_new;
LoadAndWaitForLaunch("management/launch_app_panel", &app_id_new);
ASSERT_FALSE(HasFatalFailure());
// If the ID changed, then the pref will not apply to the app.
ASSERT_EQ(app_id, app_id_new);
// Find the app's browser. Apps that should load in a panel ignore
// prefs, so we should still see the launch in a popup.
ASSERT_EQ(2u, chrome::GetBrowserCount(browser()->profile()));
app_browser = FindOtherBrowser(browser());
ASSERT_TRUE(app_browser->is_type_app());
}
// Disabled: crbug.com/230165, crbug.com/915339, crbug.com/979399
#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || \
defined(OS_CHROMEOS)
......
......@@ -80,9 +80,6 @@ LaunchContainer GetLaunchContainer(const ExtensionPrefs* prefs,
base::Optional<LaunchContainer> result;
if (manifest_launch_container ==
LaunchContainer::kLaunchContainerPanelDeprecated) {
result = manifest_launch_container;
} else if (manifest_launch_container ==
LaunchContainer::kLaunchContainerTab) {
// Look for prefs that indicate the user's choice of launch container. The
// app's menu on the NTP provides a UI to set this preference.
......
......@@ -338,8 +338,6 @@ WebContents* OpenEnabledApplication(Profile* profile,
NOTREACHED();
break;
}
// Panels are deprecated. Launch a normal window instead.
case extensions::LaunchContainer::kLaunchContainerPanelDeprecated:
case extensions::LaunchContainer::kLaunchContainerWindow:
tab = OpenApplicationWindow(profile, params, url);
break;
......
......@@ -52,8 +52,7 @@ content::WebContents* PermissionBubbleBrowserTest::OpenExtensionAppWindow() {
CHECK(extension);
apps::AppLaunchParams params(
extension->id(),
apps::mojom::LaunchContainer::kLaunchContainerPanelDeprecated,
extension->id(), apps::mojom::LaunchContainer::kLaunchContainerNone,
WindowOpenDisposition::NEW_WINDOW,
apps::mojom::AppLaunchSource::kSourceTest);
......
......@@ -156,8 +156,10 @@ DisplayMode BookmarkAppRegistrar::GetAppUserDisplayMode(
switch (extensions::GetLaunchContainer(
extensions::ExtensionPrefs::Get(profile()), extension)) {
case LaunchContainer::kLaunchContainerWindow:
case LaunchContainer::kLaunchContainerPanelDeprecated:
NOTREACHED();
FALLTHROUGH;
case LaunchContainer::kLaunchContainerWindow:
return DisplayMode::kStandalone;
case LaunchContainer::kLaunchContainerTab:
return DisplayMode::kBrowser;
......
......@@ -27,30 +27,6 @@ namespace errors = manifest_errors;
namespace {
bool ReadLaunchDimension(const extensions::Manifest* manifest,
const char* key,
int* target,
bool is_valid_container,
base::string16* error) {
const base::Value* temp = NULL;
if (manifest->Get(key, &temp)) {
if (!is_valid_container) {
*error = ErrorUtils::FormatErrorMessageUTF16(
errors::kInvalidLaunchValueContainer,
key);
return false;
}
if (!temp->GetAsInteger(target) || *target < 0) {
*target = 0;
*error = ErrorUtils::FormatErrorMessageUTF16(
errors::kInvalidLaunchValue,
key);
return false;
}
}
return true;
}
bool HasValidComponentBookmarkAppURL(const GURL& url) {
// For component Bookmark Apps we additionally accept chrome:// and
// chrome-untrusted://.
......@@ -284,30 +260,6 @@ bool AppLaunchInfo::LoadLaunchContainer(Extension* extension,
*error = base::ASCIIToUTF16(errors::kInvalidLaunchContainer);
return false;
}
// TODO(manucornet): Remove this special behavior now that panels are
// deprecated.
bool can_specify_initial_size =
launch_container_ == LaunchContainer::kLaunchContainerPanelDeprecated;
// Validate the container width if present.
if (!ReadLaunchDimension(extension->manifest(),
keys::kLaunchWidth,
&launch_width_,
can_specify_initial_size,
error)) {
return false;
}
// Validate container height if present.
if (!ReadLaunchDimension(extension->manifest(),
keys::kLaunchHeight,
&launch_height_,
can_specify_initial_size,
error)) {
return false;
}
return true;
}
......@@ -356,8 +308,7 @@ bool AppLaunchManifestHandler::AlwaysParseForType(Manifest::Type type) const {
base::span<const char* const> AppLaunchManifestHandler::Keys() const {
static constexpr const char* kKeys[] = {
keys::kLaunchLocalPath, keys::kLaunchWebURL, keys::kLaunchContainer,
keys::kLaunchHeight, keys::kLaunchWidth};
keys::kLaunchLocalPath, keys::kLaunchWebURL, keys::kLaunchContainer};
return kKeys;
}
......
......@@ -27,20 +27,10 @@ TEST_F(AppLaunchManifestTest, AppLaunchContainer) {
EXPECT_EQ(LaunchContainer::kLaunchContainerTab,
AppLaunchInfo::GetLaunchContainer(extension.get()));
extension = LoadAndExpectSuccess("launch_panel.json");
EXPECT_EQ(LaunchContainer::kLaunchContainerPanelDeprecated,
AppLaunchInfo::GetLaunchContainer(extension.get()));
extension = LoadAndExpectSuccess("launch_default.json");
EXPECT_EQ(LaunchContainer::kLaunchContainerTab,
AppLaunchInfo::GetLaunchContainer(extension.get()));
extension = LoadAndExpectSuccess("launch_width.json");
EXPECT_EQ(640, AppLaunchInfo::GetLaunchWidth(extension.get()));
extension = LoadAndExpectSuccess("launch_height.json");
EXPECT_EQ(480, AppLaunchInfo::GetLaunchHeight(extension.get()));
Testcase testcases[] = {
Testcase("launch_window.json", errors::kInvalidLaunchContainer),
Testcase("launch_container_invalid_type.json",
......@@ -49,22 +39,6 @@ TEST_F(AppLaunchManifestTest, AppLaunchContainer) {
errors::kInvalidLaunchContainer),
Testcase("launch_container_without_launch_url.json",
errors::kLaunchURLRequired),
Testcase("launch_width_invalid.json",
ErrorUtils::FormatErrorMessage(
errors::kInvalidLaunchValueContainer,
keys::kLaunchWidth)),
Testcase("launch_width_negative.json",
ErrorUtils::FormatErrorMessage(
errors::kInvalidLaunchValue,
keys::kLaunchWidth)),
Testcase("launch_height_invalid.json",
ErrorUtils::FormatErrorMessage(
errors::kInvalidLaunchValueContainer,
keys::kLaunchHeight)),
Testcase("launch_height_negative.json",
ErrorUtils::FormatErrorMessage(
errors::kInvalidLaunchValue,
keys::kLaunchHeight))
};
RunTestcases(testcases, base::size(testcases), EXPECT_TYPE_ERROR);
}
......
{
"name": "test",
"manifest_version": 2,
"version": "1",
"app": {
"launch": {
"container": "tab",
"height": 480,
"local_path": "bar.html"
}
}
}
{
"name": "test",
"manifest_version": 2,
"version": "1",
"app": {
"launch": {
"container": "panel",
"height": -1,
"local_path": "bar.html"
}
}
}
{
"name": "test",
"manifest_version": 2,
"version": "1",
"app": {
"launch": {
"container": "panel",
"web_url": "http://www.google.com/hot.html"
}
}
}
{
"name": "test",
"manifest_version": 2,
"version": "1",
"app": {
"launch": {
"container": "tab",
"width": 640,
"local_path": "bar.html"
}
}
}
{
"name": "test",
"manifest_version": 2,
"version": "1",
"app": {
"launch": {
"container": "panel",
"width": -1,
"local_path": "bar.html"
}
}
}
......@@ -95,10 +95,8 @@ const char kKioskSecondaryApps[] = "kiosk_secondary_apps";
const char kLanguage[] = "language";
const char kLaunch[] = "app.launch";
const char kLaunchContainer[] = "app.launch.container";
const char kLaunchHeight[] = "app.launch.height";
const char kLaunchLocalPath[] = "app.launch.local_path";
const char kLaunchWebURL[] = "app.launch.web_url";
const char kLaunchWidth[] = "app.launch.width";
const char kLayouts[] = "layouts";
const char kLinkedAppIcons[] = "app.linked_icons";
const char kLinkedAppIconURL[] = "url";
......
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