fix: build when some buildflags are disabled (#23307)

This commit is contained in:
Robo 2020-04-28 23:16:10 -07:00 committed by GitHub
parent 3584665a8f
commit ec7942e8b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 82 additions and 44 deletions

View file

@ -34,7 +34,7 @@
#if BUILDFLAG(ENABLE_PRINTING)
#include "chrome/browser/printing/print_view_manager_basic.h"
#include "components/printing/common/print_messages.h"
#include "printing/backend/print_backend.h"
#include "printing/backend/print_backend.h" // nogncheck
#include "shell/browser/printing/print_preview_message_handler.h"
#if defined(OS_WIN)

View file

@ -91,6 +91,7 @@
#include "shell/common/application_info.h"
#include "shell/common/options_switches.h"
#include "shell/common/platform_util.h"
#include "third_party/blink/public/common/loader/url_loader_throttle.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/native_theme/native_theme.h"
#include "v8/include/v8.h"
@ -115,7 +116,7 @@
#endif
#if BUILDFLAG(ENABLE_PEPPER_FLASH)
#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h"
#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h" // nogncheck
#endif // BUILDFLAG(ENABLE_PEPPER_FLASH)
#if BUILDFLAG(OVERRIDE_LOCATION_PROVIDER)
@ -140,6 +141,7 @@
#include "extensions/browser/extension_message_filter.h"
#include "extensions/browser/extension_navigation_throttle.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/browser/guest_view/extensions_guest_view_message_filter.h"
#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h"
#include "extensions/browser/info_map.h"
@ -453,6 +455,7 @@ void ElectronBrowserClient::RenderProcessWillLaunch(
return;
auto* browser_context = host->GetBrowserContext();
ALLOW_UNUSED_LOCAL(browser_context);
#if BUILDFLAG(ENABLE_PRINTING)
host->AddFilter(

View file

@ -14,7 +14,6 @@
#include "base/json/json_string_value_serializer.h"
#include "base/path_service.h"
#include "base/task/post_task.h"
#include "chrome/browser/pdf/pdf_extension_util.h"
#include "chrome/common/chrome_paths.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
@ -22,6 +21,7 @@
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h"
#include "electron/buildflags/buildflags.h"
#include "extensions/browser/api/app_runtime/app_runtime_api.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/info_map.h"
@ -36,6 +36,10 @@
#include "extensions/common/file_util.h"
#include "shell/browser/extensions/electron_extension_loader.h"
#if BUILDFLAG(ENABLE_PDF_VIEWER)
#include "chrome/browser/pdf/pdf_extension_util.h"
#endif
using content::BrowserContext;
using content::BrowserThread;
@ -106,6 +110,7 @@ std::unique_ptr<base::DictionaryValue> ParseManifest(
}
void ElectronExtensionSystem::LoadComponentExtensions() {
#if BUILDFLAG(ENABLE_PDF_VIEWER)
std::string utf8_error;
std::string pdf_manifest_string = pdf_extension_util::GetManifest();
std::unique_ptr<base::DictionaryValue> pdf_manifest =
@ -117,6 +122,7 @@ void ElectronExtensionSystem::LoadComponentExtensions() {
root_directory, extensions::Manifest::COMPONENT, *pdf_manifest,
extensions::Extension::REQUIRE_KEY, &utf8_error);
extension_loader_->registrar()->AddExtension(pdf_extension);
#endif
}
ExtensionService* ElectronExtensionSystem::extension_service() {

View file

@ -375,24 +375,19 @@ void ProxyingWebSocket::OnHeadersReceivedComplete(int error_code) {
ContinueToCompleted();
}
void ProxyingWebSocket::OnAuthRequiredComplete(
extensions::ExtensionWebRequestEventRouter::AuthRequiredResponse rv) {
void ProxyingWebSocket::OnAuthRequiredComplete(AuthRequiredResponse rv) {
CHECK(auth_required_callback_);
ResumeIncomingMethodCallProcessing();
switch (rv) {
case extensions::ExtensionWebRequestEventRouter::AuthRequiredResponse::
AUTH_REQUIRED_RESPONSE_NO_ACTION:
case extensions::ExtensionWebRequestEventRouter::AuthRequiredResponse::
AUTH_REQUIRED_RESPONSE_CANCEL_AUTH:
case AuthRequiredResponse::AUTH_REQUIRED_RESPONSE_NO_ACTION:
case AuthRequiredResponse::AUTH_REQUIRED_RESPONSE_CANCEL_AUTH:
std::move(auth_required_callback_).Run(base::nullopt);
break;
case extensions::ExtensionWebRequestEventRouter::AuthRequiredResponse::
AUTH_REQUIRED_RESPONSE_SET_AUTH:
case AuthRequiredResponse::AUTH_REQUIRED_RESPONSE_SET_AUTH:
std::move(auth_required_callback_).Run(auth_credentials_);
break;
case extensions::ExtensionWebRequestEventRouter::AuthRequiredResponse::
AUTH_REQUIRED_RESPONSE_IO_PENDING:
case AuthRequiredResponse::AUTH_REQUIRED_RESPONSE_IO_PENDING:
NOTREACHED();
break;
}
@ -410,8 +405,7 @@ void ProxyingWebSocket::OnHeadersReceivedCompleteForAuth(
auto continuation = base::BindRepeating(
&ProxyingWebSocket::OnAuthRequiredComplete, weak_factory_.GetWeakPtr());
auto auth_rv = extensions::ExtensionWebRequestEventRouter::
AuthRequiredResponse::AUTH_REQUIRED_RESPONSE_IO_PENDING;
auto auth_rv = AuthRequiredResponse::AUTH_REQUIRED_RESPONSE_IO_PENDING;
PauseIncomingMethodCallProcessing();
OnAuthRequiredComplete(auth_rv);

View file

@ -12,7 +12,7 @@
#include "base/optional.h"
#include "components/keyed_service/core/keyed_service_shutdown_notifier.h"
#include "extensions/browser/api/web_request/web_request_api.h"
#include "content/public/browser/content_browser_client.h"
#include "extensions/browser/api/web_request/web_request_info.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
@ -37,6 +37,21 @@ class ProxyingWebSocket : public network::mojom::WebSocketHandshakeClient,
public:
using WebSocketFactory = content::ContentBrowserClient::WebSocketFactory;
// AuthRequiredResponse indicates how an OnAuthRequired call is handled.
enum class AuthRequiredResponse {
// No credenitals were provided.
AUTH_REQUIRED_RESPONSE_NO_ACTION,
// AuthCredentials is filled in with a username and password, which should
// be used in a response to the provided auth challenge.
AUTH_REQUIRED_RESPONSE_SET_AUTH,
// The request should be canceled.
AUTH_REQUIRED_RESPONSE_CANCEL_AUTH,
// The action will be decided asynchronously. |callback| will be invoked
// when the decision is made, and one of the other AuthRequiredResponse
// values will be passed in with the same semantics as described above.
AUTH_REQUIRED_RESPONSE_IO_PENDING,
};
ProxyingWebSocket(
WebRequestAPI* web_request_api,
WebSocketFactory factory,
@ -100,8 +115,7 @@ class ProxyingWebSocket : public network::mojom::WebSocketHandshakeClient,
void ContinueToStartRequest(int error_code);
void OnHeadersReceivedComplete(int error_code);
void ContinueToHeadersReceived();
void OnAuthRequiredComplete(
extensions::ExtensionWebRequestEventRouter::AuthRequiredResponse rv);
void OnAuthRequiredComplete(AuthRequiredResponse rv);
void OnHeadersReceivedCompleteForAuth(const net::AuthChallengeInfo& auth_info,
int rv);
void ContinueToCompleted();