summaryrefslogtreecommitdiffstats
path: root/chromium/chrome/browser/ui/webui/ntp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-01-20 13:40:20 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-01-22 12:41:23 +0000
commit7961cea6d1041e3e454dae6a1da660b453efd238 (patch)
treec0eeb4a9ff9ba32986289c1653d9608e53ccb444 /chromium/chrome/browser/ui/webui/ntp
parentb7034d0803538058e5c9d904ef03cf5eab34f6ef (diff)
BASELINE: Update Chromium to 78.0.3904.130
Change-Id: If185e0c0061b3437531c97c9c8c78f239352a68b Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/chrome/browser/ui/webui/ntp')
-rw-r--r--chromium/chrome/browser/ui/webui/ntp/app_launcher_handler.cc46
-rw-r--r--chromium/chrome/browser/ui/webui/ntp/new_tab_ui.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/ntp/new_tab_ui.h2
3 files changed, 31 insertions, 19 deletions
diff --git a/chromium/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chromium/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
index eb64fce1c92..abeeef88687 100644
--- a/chromium/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
+++ b/chromium/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -20,9 +20,9 @@
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
+#include "chrome/browser/apps/launch_service/launch_service.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
-#include "chrome/browser/extensions/bookmark_app_extension_util.h"
#include "chrome/browser/extensions/crx_installer.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_ui_util.h"
@@ -37,12 +37,12 @@
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/extensions/app_launch_params.h"
-#include "chrome/browser/ui/extensions/application_launch.h"
#include "chrome/browser/ui/extensions/extension_enable_flow.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/webui/extensions/extension_basic_info.h"
#include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
#include "chrome/browser/ui/webui/ntp/new_tab_ui.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/buildflags.h"
#include "chrome/common/chrome_switches.h"
@@ -488,8 +488,11 @@ void AppLauncherHandler::HandleLaunchApp(const base::ListValue* args) {
CHECK(launch_bucket >= 0 &&
launch_bucket < extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
+ Profile* profile = extension_service_->profile();
+
const Extension* extension =
- extension_service_->GetExtensionById(extension_id, false);
+ extensions::ExtensionRegistry::Get(profile)->GetExtensionById(
+ extension_id, extensions::ExtensionRegistry::ENABLED);
// Prompt the user to re-enable the application if disabled.
if (!extension) {
@@ -497,8 +500,6 @@ void AppLauncherHandler::HandleLaunchApp(const base::ListValue* args) {
return;
}
- Profile* profile = extension_service_->profile();
-
WindowOpenDisposition disposition =
args->GetSize() > 3 ? webui::GetDispositionFromClick(args, 3)
: WindowOpenDisposition::CURRENT_TAB;
@@ -526,11 +527,11 @@ void AppLauncherHandler::HandleLaunchApp(const base::ListValue* args) {
AppLaunchParams params(
profile, extension_id,
disposition == WindowOpenDisposition::NEW_WINDOW
- ? extensions::LaunchContainer::kLaunchContainerWindow
- : extensions::LaunchContainer::kLaunchContainerTab,
- disposition, extensions::AppLaunchSource::kSourceNewTabPage);
+ ? apps::mojom::LaunchContainer::kLaunchContainerWindow
+ : apps::mojom::LaunchContainer::kLaunchContainerTab,
+ disposition, apps::mojom::AppLaunchSource::kSourceNewTabPage);
params.override_url = override_url;
- OpenApplication(params);
+ apps::LaunchService::Get(profile)->OpenApplication(params);
} else {
// To give a more "launchy" experience when using the NTP launcher, we close
// it automatically.
@@ -546,7 +547,8 @@ void AppLauncherHandler::HandleLaunchApp(const base::ListValue* args) {
: WindowOpenDisposition::NEW_FOREGROUND_TAB,
extensions::AppLaunchSource::kSourceNewTabPage);
params.override_url = override_url;
- WebContents* new_contents = OpenApplication(params);
+ WebContents* new_contents =
+ apps::LaunchService::Get(profile)->OpenApplication(params);
// This will also destroy the handler, so do not perform any actions after.
if (new_contents != old_contents && browser &&
@@ -563,7 +565,9 @@ void AppLauncherHandler::HandleSetLaunchType(const base::ListValue* args) {
CHECK(args->GetDouble(1, &launch_type));
const Extension* extension =
- extension_service_->GetExtensionById(extension_id, true);
+ extensions::ExtensionRegistry::Get(extension_service_->profile())
+ ->GetExtensionById(extension_id,
+ extensions::ExtensionRegistry::COMPATIBILITY);
if (!extension)
return;
@@ -615,7 +619,9 @@ void AppLauncherHandler::HandleCreateAppShortcut(const base::ListValue* args) {
CHECK(args->GetString(0, &extension_id));
const Extension* extension =
- extension_service_->GetExtensionById(extension_id, true);
+ extensions::ExtensionRegistry::Get(extension_service_->profile())
+ ->GetExtensionById(extension_id,
+ extensions::ExtensionRegistry::COMPATIBILITY);
if (!extension)
return;
@@ -631,7 +637,9 @@ void AppLauncherHandler::HandleInstallAppLocally(const base::ListValue* args) {
CHECK(args->GetString(0, &extension_id));
const Extension* extension =
- extension_service_->GetExtensionById(extension_id, true);
+ extensions::ExtensionRegistry::Get(extension_service_->profile())
+ ->GetExtensionById(extension_id,
+ extensions::ExtensionRegistry::COMPATIBILITY);
if (!extension)
return;
@@ -654,7 +662,9 @@ void AppLauncherHandler::HandleShowAppInfo(const base::ListValue* args) {
CHECK(args->GetString(0, &extension_id));
const Extension* extension =
- extension_service_->GetExtensionById(extension_id, true);
+ extensions::ExtensionRegistry::Get(extension_service_->profile())
+ ->GetExtensionById(extension_id,
+ extensions::ExtensionRegistry::COMPATIBILITY);
if (!extension)
return;
@@ -831,8 +841,8 @@ void AppLauncherHandler::PromptToEnableApp(const std::string& extension_id) {
return; // Only one prompt at a time.
extension_id_prompting_ = extension_id;
- extension_enable_flow_.reset(new ExtensionEnableFlow(
- Profile::FromWebUI(web_ui()), extension_id, this));
+ extension_enable_flow_ = std::make_unique<ExtensionEnableFlow>(
+ Profile::FromWebUI(web_ui()), extension_id, this);
extension_enable_flow_->StartForWebContents(web_ui()->GetWebContents());
}
@@ -862,7 +872,9 @@ void AppLauncherHandler::ExtensionEnableFlowAborted(bool user_initiated) {
// We record the histograms here because ExtensionUninstallCanceled is also
// called when the extension uninstall dialog is canceled.
const Extension* extension =
- extension_service_->GetExtensionById(extension_id_prompting_, true);
+ extensions::ExtensionRegistry::Get(extension_service_->profile())
+ ->GetExtensionById(extension_id_prompting_,
+ extensions::ExtensionRegistry::COMPATIBILITY);
std::string histogram_name = user_initiated ? "ReEnableCancel"
: "ReEnableAbort";
extensions::ExtensionService::RecordPermissionMessagesHistogram(
diff --git a/chromium/chrome/browser/ui/webui/ntp/new_tab_ui.cc b/chromium/chrome/browser/ui/webui/ntp/new_tab_ui.cc
index 9102ea06af4..48f2a16a42c 100644
--- a/chromium/chrome/browser/ui/webui/ntp/new_tab_ui.cc
+++ b/chromium/chrome/browser/ui/webui/ntp/new_tab_ui.cc
@@ -150,7 +150,7 @@ std::string NewTabUI::NewTabHTMLSource::GetSource() {
void NewTabUI::NewTabHTMLSource::StartDataRequest(
const std::string& path,
- const content::ResourceRequestInfo::WebContentsGetter& wc_getter,
+ const content::WebContents::Getter& wc_getter,
const content::URLDataSource::GotDataCallback& callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
diff --git a/chromium/chrome/browser/ui/webui/ntp/new_tab_ui.h b/chromium/chrome/browser/ui/webui/ntp/new_tab_ui.h
index 61e2451c3db..01d668a40d7 100644
--- a/chromium/chrome/browser/ui/webui/ntp/new_tab_ui.h
+++ b/chromium/chrome/browser/ui/webui/ntp/new_tab_ui.h
@@ -57,7 +57,7 @@ class NewTabUI : public content::WebUIController {
std::string GetSource() override;
void StartDataRequest(
const std::string& path,
- const content::ResourceRequestInfo::WebContentsGetter& wc_getter,
+ const content::WebContents::Getter& wc_getter,
const content::URLDataSource::GotDataCallback& callback) override;
std::string GetMimeType(const std::string&) override;
bool ShouldReplaceExistingSource() override;