Commit cba4cee0 authored by Rachel Carpenter's avatar Rachel Carpenter Committed by Commit Bot

Update the gestures notification to open the Help app.

At the moment it navigates to a support.google.com link in a tab. This
doesn't work offline, so utilising the help app which caches this
article instead.

Bug: b/157935237
Change-Id: Ibb5098b032bc959a826d52b1d05ebd7d14ab7cb3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2362166
Commit-Queue: Rachel Carpenter <carpenterr@chromium.org>
Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Cr-Commit-Position: refs/heads/master@{#800438}
parent adf02bd3
......@@ -13,6 +13,7 @@
#include "chrome/browser/apps/app_service/app_service_proxy.h"
#include "chrome/browser/apps/app_service/app_service_proxy_factory.h"
#include "chrome/browser/chromeos/web_applications/system_web_app_integration_test.h"
#include "chrome/browser/ui/ash/system_tray_client.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
......@@ -260,6 +261,30 @@ IN_PROC_BROWSER_TEST_P(HelpAppIntegrationTest, HelpAppV2ShowParentalControls) {
->GetVisibleURL());
}
// Test that the Help App opens when Gesture help requested.
IN_PROC_BROWSER_TEST_P(HelpAppIntegrationTest, HelpAppOpenGestures) {
WaitForTestSystemAppInstall();
base::HistogramTester histogram_tester;
const GURL expected_url("chrome://help-app/help/sub/3399710/id/9739838");
content::TestNavigationObserver navigation_observer(expected_url);
navigation_observer.StartWatchingNewWebContents();
SystemTrayClient::Get()->ShowGestureEducationHelp();
navigation_observer.Wait();
// There should be two browser windows, one regular and one for the help app.
EXPECT_EQ(2u, chrome::GetTotalBrowserCount());
// Help app should have opened at the gesture article.
EXPECT_EQ(expected_url, chrome::FindLastActive()
->tab_strip_model()
->GetActiveWebContents()
->GetVisibleURL());
// The HELP app is 18, see DefaultAppName in
// src/chrome/browser/apps/app_service/app_service_metrics.cc
histogram_tester.ExpectUniqueSample("Apps.DefaultAppLaunch.FromOtherApp", 18,
1);
}
INSTANTIATE_TEST_SUITE_P(
All,
HelpAppIntegrationTest,
......
......@@ -11,6 +11,8 @@
#include "base/logging.h"
#include "base/memory/weak_ptr.h"
#include "base/metrics/user_metrics.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/browser_process.h"
#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
......@@ -20,6 +22,7 @@
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/chromeos/set_time_dialog.h"
#include "chrome/browser/chromeos/system/system_clock.h"
#include "chrome/browser/chromeos/web_applications/default_web_app_ids.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/lifetime/termination_notification.h"
#include "chrome/browser/profiles/profile_manager.h"
......@@ -284,11 +287,19 @@ void SystemTrayClient::ShowAccessibilitySettings() {
}
void SystemTrayClient::ShowGestureEducationHelp() {
chrome::ScopedTabbedBrowserDisplayer displayer(
ProfileManager::GetActiveUserProfile());
base::RecordAction(base::UserMetricsAction("ShowGestureEducationHelp"));
ShowSingletonTab(displayer.browser(),
GURL(chrome::kChromeOSGestureEducationHelpURL));
Profile* profile = ProfileManager::GetActiveUserProfile();
if (!profile)
return;
// Note that AppServiceProxy is null for off-the-record profiles. For more
// context, see https://crbug.com/1112197.
apps::AppServiceProxy* proxy = apps::AppServiceProxyFactory::GetForProfile(
profile->GetOriginalProfile());
proxy->LaunchAppWithUrl(
chromeos::default_web_apps::kHelpAppId, ui::EventFlags::EF_NONE,
GURL(chrome::kChromeOSGestureEducationHelpURL),
apps::mojom::LaunchSource::kFromOtherApp, display::kDefaultDisplayId);
}
void SystemTrayClient::ShowPaletteHelp() {
......
......@@ -320,8 +320,11 @@ const char kChromeOSAssetPath[] = "/usr/share/chromeos-assets/";
const char kChromeOSCreditsPath[] =
"/opt/google/chrome/resources/about_os_credits.html";
// TODO(carpenterr): Have a solution for plink mapping in Help App.
// The magic numbers in this url are the topic and article ids currently
// required to navigate directly to a help article in the Help App.
const char kChromeOSGestureEducationHelpURL[] =
"https://support.google.com/chromebook?p=tablet_mode_gestures";
"chrome://help-app/help/sub/3399710/id/9739838";
const char kChromePaletteHelpURL[] =
"https://support.google.com/chromebook?p=stylus_help";
......
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