Commit e4bb155a authored by Alexey Baskakov's avatar Alexey Baskakov Committed by Commit Bot

WebApp: Move RevealAppShim utility into BookmarkAppInstallFinalizer

This CL erases
chrome/browser/extensions/bookmark_app_extension_util.cc
completely.

That's the last bookmark_app* prefixed file in extensions/.

Cleaned up owners files.

Bug: 973288
Change-Id: I1f1e094d8e64e9db75c49e4c6b7356124555810f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1732170
Commit-Queue: Alexey Baskakov <loyso@chromium.org>
Reviewed-by: default avatarBen Wells <benwells@chromium.org>
Cr-Commit-Position: refs/heads/master@{#683905}
parent 6bbf3348
......@@ -422,8 +422,6 @@ jumbo_static_library("extensions") {
"blacklist_factory.h",
"blacklist_state_fetcher.cc",
"blacklist_state_fetcher.h",
"bookmark_app_extension_util.cc",
"bookmark_app_extension_util.h",
"browser_context_keyed_service_factories.cc",
"browser_context_keyed_service_factories.h",
"browser_extension_window_controller.cc",
......
......@@ -3,11 +3,6 @@ file://extensions/OWNERS
per-file *networking*=stevenjb@chromium.org
per-file *networking*=tbarzic@chromium.org
per-file bookmark_app_*=calamity@chromium.org
per-file bookmark_app_*=dominickn@chromium.org
per-file bookmark_app_*=mgiuca@chromium.org
per-file bookmark_app_*=ortuno@chromium.org
per-file extension_gcm_app_handler*=file://chrome/browser/extensions/api/gcm/OWNERS
# For adding/renaming files for Chrome OS apps APIs.
......
// Copyright 2019 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/extensions/bookmark_app_extension_util.h"
#include "build/build_config.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/web_applications/extensions/web_app_extension_shortcut.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_switches.h"
#if defined(OS_MACOSX)
#include "chrome/browser/web_applications/extensions/web_app_extension_shortcut_mac.h"
#endif
namespace extensions {
bool CanBookmarkAppRevealAppShim() {
#if defined(OS_MACOSX)
return true;
#else // defined(OS_MACOSX)
return false;
#endif // !defined(OS_MACOSX)
}
void BookmarkAppRevealAppShim(Profile* profile, const Extension* extension) {
DCHECK(CanBookmarkAppRevealAppShim());
#if defined(OS_MACOSX)
if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
::switches::kDisableHostedAppShimCreation)) {
Profile* current_profile = profile->GetOriginalProfile();
web_app::RevealAppShimInFinderForApp(current_profile, extension);
}
#endif // defined(OS_MACOSX)
}
} // namespace extensions
// Copyright 2019 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_EXTENSIONS_BOOKMARK_APP_EXTENSION_UTIL_H_
#define CHROME_BROWSER_EXTENSIONS_BOOKMARK_APP_EXTENSION_UTIL_H_
class Profile;
namespace extensions {
class Extension;
bool CanBookmarkAppRevealAppShim();
void BookmarkAppRevealAppShim(Profile* profile, const Extension* extension);
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_BOOKMARK_APP_EXTENSION_UTIL_H_
......@@ -8,10 +8,11 @@
#include <utility>
#include "base/bind.h"
#include "base/command_line.h"
#include "base/logging.h"
#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/extensions/bookmark_app_extension_util.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/crx_installer.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/launch_util.h"
......@@ -20,6 +21,7 @@
#include "chrome/browser/web_applications/components/web_app_helpers.h"
#include "chrome/browser/web_applications/extensions/bookmark_app_finalizer_utils.h"
#include "chrome/browser/web_applications/extensions/bookmark_app_util.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
#include "chrome/common/web_application_info.h"
#include "extensions/browser/extension_registry.h"
......@@ -31,6 +33,10 @@
#include "extensions/common/extension_set.h"
#include "url/gurl.h"
#if defined(OS_MACOSX)
#include "chrome/browser/web_applications/extensions/web_app_extension_shortcut_mac.h"
#endif
namespace extensions {
namespace {
......@@ -220,12 +226,22 @@ bool BookmarkAppInstallFinalizer::CanReparentTab(const web_app::AppId& app_id,
}
bool BookmarkAppInstallFinalizer::CanRevealAppShim() const {
return CanBookmarkAppRevealAppShim();
#if defined(OS_MACOSX)
return true;
#else // defined(OS_MACOSX)
return false;
#endif // !defined(OS_MACOSX)
}
void BookmarkAppInstallFinalizer::RevealAppShim(const web_app::AppId& app_id) {
DCHECK(CanRevealAppShim());
#if defined(OS_MACOSX)
const Extension* app = GetExtensionById(profile_, app_id);
BookmarkAppRevealAppShim(profile_, app);
if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
::switches::kDisableHostedAppShimCreation)) {
web_app::RevealAppShimInFinderForApp(profile_, app);
}
#endif // defined(OS_MACOSX)
}
bool BookmarkAppInstallFinalizer::CanSkipAppUpdateForSync(
......
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