Commit f909466a authored by Jeevan Shikaram's avatar Jeevan Shikaram Committed by Commit Bot

[App Management] App info in launcher now opens in App Management.

Right clicking on an application in the launcher and selecting app info
now opens App Management with the application selected.

Bug: 949405
Change-Id: I3373f716eacc934f8cd3e939bcbef160c5e4908b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1612863
Commit-Queue: Jeevan Shikaram <jshikaram@chromium.org>
Reviewed-by: default avatarIlya Sherman <isherman@chromium.org>
Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#660298}
parent 578b6ff7
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "ash/public/cpp/app_list/app_list_switches.h" #include "ash/public/cpp/app_list/app_list_switches.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/feature_list.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/extensions/extension_util.h" #include "chrome/browser/extensions/extension_util.h"
...@@ -18,6 +19,7 @@ ...@@ -18,6 +19,7 @@
#include "chrome/browser/ui/apps/app_info_dialog.h" #include "chrome/browser/ui/apps/app_info_dialog.h"
#include "chrome/browser/ui/ash/tablet_mode_client.h" #include "chrome/browser/ui/ash/tablet_mode_client.h"
#include "chrome/browser/ui/chrome_pages.h" #include "chrome/browser/ui/chrome_pages.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/manifest_handlers/app_launch_info.h" #include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
#include "extensions/browser/extension_prefs.h" #include "extensions/browser/extension_prefs.h"
...@@ -92,6 +94,12 @@ void AppListControllerDelegate::DoShowAppInfoFlow( ...@@ -92,6 +94,12 @@ void AppListControllerDelegate::DoShowAppInfoFlow(
const extensions::Extension* extension = GetExtension(profile, extension_id); const extensions::Extension* extension = GetExtension(profile, extension_id);
DCHECK(extension); DCHECK(extension);
if (base::FeatureList::IsEnabled(features::kAppManagement)) {
chrome::ShowAppManagementPage(profile, extension_id);
return;
}
if (extension->is_hosted_app() && extension->from_bookmark()) { if (extension->is_hosted_app() && extension->from_bookmark()) {
chrome::ShowSiteSettings( chrome::ShowSiteSettings(
profile, extensions::AppLaunchInfo::GetFullLaunchURL(extension)); profile, extensions::AppLaunchInfo::GetFullLaunchURL(extension));
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <utility> #include <utility>
#include "base/bind.h" #include "base/bind.h"
#include "base/feature_list.h"
#include "chrome/browser/chromeos/arc/app_shortcuts/arc_app_shortcuts_menu_builder.h" #include "chrome/browser/chromeos/arc/app_shortcuts/arc_app_shortcuts_menu_builder.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_list/app_context_menu_delegate.h" #include "chrome/browser/ui/app_list/app_context_menu_delegate.h"
...@@ -16,6 +17,8 @@ ...@@ -16,6 +17,8 @@
#include "chrome/browser/ui/app_list/arc/arc_app_utils.h" #include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
#include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h" #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h"
#include "chrome/browser/ui/ash/tablet_mode_client.h" #include "chrome/browser/ui/ash/tablet_mode_client.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/common/chrome_features.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
ArcAppContextMenu::ArcAppContextMenu(app_list::AppContextMenuDelegate* delegate, ArcAppContextMenu::ArcAppContextMenu(app_list::AppContextMenuDelegate* delegate,
...@@ -129,6 +132,10 @@ void ArcAppContextMenu::ShowPackageInfo() { ...@@ -129,6 +132,10 @@ void ArcAppContextMenu::ShowPackageInfo() {
<< app_id() << "."; << app_id() << ".";
return; return;
} }
if (base::FeatureList::IsEnabled(features::kAppManagement)) {
chrome::ShowAppManagementPage(profile(), app_id());
return;
}
if (arc::ShowPackageInfo(app_info->package_name, if (arc::ShowPackageInfo(app_info->package_name,
arc::mojom::ShowPackageInfoPage::MAIN, arc::mojom::ShowPackageInfoPage::MAIN,
controller()->GetAppListDisplayId()) && controller()->GetAppListDisplayId()) &&
......
...@@ -66,6 +66,11 @@ namespace { ...@@ -66,6 +66,11 @@ namespace {
const char kHashMark[] = "#"; const char kHashMark[] = "#";
#if defined(OS_CHROMEOS)
const char kAppManagementPagePrefix[] =
"chrome://app-management/detail?ref=settings&id=";
#endif
void FocusWebContents(Browser* browser) { void FocusWebContents(Browser* browser) {
auto* const contents = browser->tab_strip_model()->GetActiveWebContents(); auto* const contents = browser->tab_strip_model()->GetActiveWebContents();
if (contents) if (contents)
...@@ -401,6 +406,31 @@ void ShowManagementPageForProfile(Profile* profile) { ...@@ -401,6 +406,31 @@ void ShowManagementPageForProfile(Profile* profile) {
SettingsWindowManager::GetInstance()->ShowChromePageForProfile( SettingsWindowManager::GetInstance()->ShowChromePageForProfile(
profile, GURL(page_path)); profile, GURL(page_path));
} }
void ShowAppManagementPage(Profile* profile, const std::string& app_id) {
DCHECK(base::FeatureList::IsEnabled(features::kAppManagement));
base::RecordAction(base::UserMetricsAction("ShowAppManagementPage"));
GURL url(kAppManagementPagePrefix + app_id);
#if defined(OS_CHROMEOS)
SettingsWindowManager* settings = SettingsWindowManager::GetInstance();
if (!base::FeatureList::IsEnabled(chromeos::features::kSplitSettings)) {
base::RecordAction(base::UserMetricsAction("ShowOptions"));
settings->ShowChromePageForProfile(profile, url);
return;
}
// Fall through and open browser settings in a tab.
#endif
Browser* browser = chrome::FindTabbedBrowser(profile, false);
if (!browser)
browser = new Browser(Browser::CreateParams(profile, true));
FocusWebContents(browser);
NavigateParams params(GetSingletonTabNavigateParams(browser, url));
params.path_behavior = NavigateParams::IGNORE_AND_NAVIGATE;
ShowSingletonTabOverwritingNTP(browser, std::move(params));
}
#endif #endif
#if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
......
...@@ -99,6 +99,8 @@ void ShowContentSettingsExceptionsForProfile( ...@@ -99,6 +99,8 @@ void ShowContentSettingsExceptionsForProfile(
void ShowSiteSettings(Profile* profile, const GURL& url); void ShowSiteSettings(Profile* profile, const GURL& url);
void ShowSiteSettings(Browser* browser, const GURL& url); void ShowSiteSettings(Browser* browser, const GURL& url);
void ShowAppManagementPage(Profile* profile, const std::string& app_id);
void ShowContentSettings(Browser* browser, void ShowContentSettings(Browser* browser,
ContentSettingsType content_settings_type); ContentSettingsType content_settings_type);
void ShowSettingsSubPageInTabbedBrowser(Browser* browser, void ShowSettingsSubPageInTabbedBrowser(Browser* browser,
......
...@@ -17363,6 +17363,14 @@ should be able to be added at any place in this file. ...@@ -17363,6 +17363,14 @@ should be able to be added at any place in this file.
<description>Please enter the description of this user action.</description> <description>Please enter the description of this user action.</description>
</action> </action>
<action name="ShowAppManagementPage">
<owner>jshikaram@chromium.org</owner>
<owner>dominickn@chromium.org</owner>
<description>
The user selected the App Info context menu item in the app launcher.
</description>
</action>
<action name="ShowAppMenu"> <action name="ShowAppMenu">
<owner>Please list the metric's owners. Add more owner tags as needed.</owner> <owner>Please list the metric's owners. Add more owner tags as needed.</owner>
<description>Please enter the description of this user action.</description> <description>Please enter the description of this user action.</description>
......
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