refactor: extensions::ViewType was moved to mojom

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2710351
This commit is contained in:
Samuel Attard 2021-03-05 15:41:32 -08:00
parent 1a296e59c2
commit dc36e8e6fc

View file

@ -157,6 +157,7 @@
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) #if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
#include "extensions/browser/script_executor.h" #include "extensions/browser/script_executor.h"
#include "extensions/browser/view_type_utils.h" #include "extensions/browser/view_type_utils.h"
#include "extensions/common/mojom/view_type.mojom.h"
#include "shell/browser/extensions/electron_extension_web_contents_observer.h" #include "shell/browser/extensions/electron_extension_web_contents_observer.h"
#endif #endif
@ -593,17 +594,17 @@ bool IsDevToolsFileSystemAdded(content::WebContents* web_contents,
WebContents::Type GetTypeFromViewType(extensions::mojom::ViewType view_type) { WebContents::Type GetTypeFromViewType(extensions::mojom::ViewType view_type) {
switch (view_type) { switch (view_type) {
case extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE: case extensions::mojom::ViewType::kExtensionBackgroundPage:
return WebContents::Type::kBackgroundPage; return WebContents::Type::kBackgroundPage;
case extensions::VIEW_TYPE_APP_WINDOW: case extensions::mojom::ViewType::kAppWindow:
case extensions::VIEW_TYPE_COMPONENT: case extensions::mojom::ViewType::kComponent:
case extensions::VIEW_TYPE_EXTENSION_DIALOG: case extensions::mojom::ViewType::kExtensionDialog:
case extensions::VIEW_TYPE_EXTENSION_POPUP: case extensions::mojom::ViewType::kExtensionPopup:
case extensions::VIEW_TYPE_BACKGROUND_CONTENTS: case extensions::mojom::ViewType::kBackgroundContents:
case extensions::VIEW_TYPE_EXTENSION_GUEST: case extensions::mojom::ViewType::kExtensionGuest:
case extensions::VIEW_TYPE_TAB_CONTENTS: case extensions::mojom::ViewType::kTabContents:
case extensions::VIEW_TYPE_INVALID: case extensions::mojom::ViewType::kInvalid:
return WebContents::Type::kRemote; return WebContents::Type::kRemote;
} }
} }
@ -626,7 +627,7 @@ WebContents::WebContents(v8::Isolate* isolate,
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) #if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
// WebContents created by extension host will have valid ViewType set. // WebContents created by extension host will have valid ViewType set.
extensions::mojom::ViewType view_type = extensions::GetViewType(web_contents); extensions::mojom::ViewType view_type = extensions::GetViewType(web_contents);
if (view_type != extensions::VIEW_TYPE_INVALID) { if (view_type != extensions::mojom::ViewType::kInvalid) {
InitWithExtensionView(isolate, web_contents, view_type); InitWithExtensionView(isolate, web_contents, view_type);
} }