Skip to content

Commit

Permalink
webapps: Delete dead code in bookmark_app_util
Browse files Browse the repository at this point in the history
Util functions were never called outside of tests.

Change-Id: I0baa43d9a395790bbfe2ae339b1cbab5f51982d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5534421
Commit-Queue: Matt Giuca <[email protected]>
Auto-Submit: Glen Robertson <[email protected]>
Reviewed-by: Matt Giuca <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1299917}
  • Loading branch information
Glen Robertson authored and Chromium LUCI CQ committed May 13, 2024
1 parent 6fb5e62 commit 84a8897
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 159 deletions.
5 changes: 1 addition & 4 deletions chrome/browser/web_applications/extensions/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@ source_set("extensions") {
source_set("unit_tests") {
testonly = true

sources = [
"bookmark_app_util_unittest.cc",
"web_app_uninstall_and_replace_job_unittest.cc",
]
sources = [ "web_app_uninstall_and_replace_job_unittest.cc" ]

deps = [
":extensions",
Expand Down
39 changes: 0 additions & 39 deletions chrome/browser/web_applications/extensions/bookmark_app_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,11 @@
#include <string_view>
#include <utility>

#include "base/values.h"
#include "chrome/browser/web_applications/web_app_utils.h"
#include "chrome/common/extensions/api/url_handlers/url_handlers_parser.h"
#include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
#include "content/public/browser/browser_context.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_icon_set.h"
#include "extensions/common/manifest_handlers/icons_handler.h"
#include "url/gurl.h"

namespace extensions {
namespace {
Expand Down Expand Up @@ -49,36 +42,4 @@ bool BookmarkAppIsLocallyInstalled(const ExtensionPrefs* prefs,
return true;
}

bool IsInNavigationScopeForLaunchUrl(const GURL& launch_url, const GURL& url) {
// Drop any "suffix" components after the path (Resolve "."):
const GURL nav_scope = launch_url.GetWithoutFilename();

const int scope_str_length = nav_scope.spec().size();
return std::string_view(nav_scope.spec()) ==
std::string_view(url.spec()).substr(0, scope_str_length);
}

LaunchContainerAndType GetLaunchContainerAndTypeFromDisplayMode(
web_app::DisplayMode display_mode) {
apps::LaunchContainer apps_launch_container =
web_app::ConvertDisplayModeToAppLaunchContainer(display_mode);
switch (apps_launch_container) {
case apps::LaunchContainer::kLaunchContainerNone:
return {apps::LaunchContainer::kLaunchContainerNone,
extensions::LaunchType::LAUNCH_TYPE_DEFAULT};
case apps::LaunchContainer::kLaunchContainerPanelDeprecated:
return {apps::LaunchContainer::kLaunchContainerPanelDeprecated,
extensions::LaunchType::LAUNCH_TYPE_REGULAR};
case apps::LaunchContainer::kLaunchContainerTab:
return {apps::LaunchContainer::kLaunchContainerTab,
extensions::LaunchType::LAUNCH_TYPE_REGULAR};
case apps::LaunchContainer::kLaunchContainerWindow:
return {apps::LaunchContainer::kLaunchContainerTab,
display_mode == web_app::DisplayMode::kFullscreen
? extensions::LaunchType::LAUNCH_TYPE_FULLSCREEN
: extensions::LaunchType::LAUNCH_TYPE_WINDOW};
}
NOTREACHED();
}

} // namespace extensions
18 changes: 0 additions & 18 deletions chrome/browser/web_applications/extensions/bookmark_app_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,11 @@
#ifndef CHROME_BROWSER_WEB_APPLICATIONS_EXTENSIONS_BOOKMARK_APP_UTIL_H_
#define CHROME_BROWSER_WEB_APPLICATIONS_EXTENSIONS_BOOKMARK_APP_UTIL_H_

#include "chrome/browser/web_applications/web_app_constants.h"
#include "chrome/browser/web_applications/web_app_install_info.h"
#include "components/services/app_service/public/cpp/app_launch_util.h"
#include "extensions/common/constants.h"

namespace content {
class BrowserContext;
}

class GURL;

namespace extensions {

class Extension;
Expand All @@ -29,18 +23,6 @@ bool BookmarkAppIsLocallyInstalled(content::BrowserContext* context,
bool BookmarkAppIsLocallyInstalled(const ExtensionPrefs* prefs,
const Extension* extension);

// Generates a scope based on |launch_url| and checks if the |url| falls under
// it. https://www.w3.org/TR/appmanifest/#navigation-scope
bool IsInNavigationScopeForLaunchUrl(const GURL& launch_url, const GURL& url);

struct LaunchContainerAndType {
apps::LaunchContainer launch_container;
extensions::LaunchType launch_type;
};

LaunchContainerAndType GetLaunchContainerAndTypeFromDisplayMode(
web_app::DisplayMode display_mode);

} // namespace extensions

#endif // CHROME_BROWSER_WEB_APPLICATIONS_EXTENSIONS_BOOKMARK_APP_UTIL_H_

This file was deleted.

0 comments on commit 84a8897

Please sign in to comment.