chromium/chrome/browser/ui/webui/top_chrome/webui_contents_wrapper.h

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_UI_WEBUI_TOP_CHROME_WEBUI_CONTENTS_WRAPPER_H_
#define CHROME_BROWSER_UI_WEBUI_TOP_CHROME_WEBUI_CONTENTS_WRAPPER_H_

#include <memory>
#include <utility>

#include "base/memory/weak_ptr.h"
#include "base/scoped_observation.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_observer.h"
#include "chrome/browser/ui/webui/top_chrome/top_chrome_web_ui_controller.h"
#include "chrome/browser/ui/webui/top_chrome/top_chrome_webui_config.h"
#include "chrome/browser/ui/webui_name_variants.h"
#include "content/public/browser/file_select_listener.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/common/referrer.h"
#include "third_party/blink/public/mojom/page/draggable_region.mojom.h"
#include "ui/base/models/menu_model.h"

// WebUIContentsWrapper wraps a WebContents that hosts a top chrome WebUI.
// This class notifies the Host when it should be shown or hidden via ShowUI()
// and CloseUI() in addition to passing through resize events so the Host can
// adjust bounds accordingly.
class WebUIContentsWrapper : public content::WebContentsDelegate,
                             public content::WebContentsObserver,
                             public ProfileObserver,
                             public TopChromeWebUIController::Embedder {};

// WebUIContentsWrapperT is designed to be paired with the WebUIController
// subclass used by the hosted WebUI. This type information allows compile time
// checking that the WebUIController subclasses TopChromeWebUIController as
// expected.
template <typename T>
class WebUIContentsWrapperT : public WebUIContentsWrapper {};

#endif  // CHROME_BROWSER_UI_WEBUI_TOP_CHROME_WEBUI_CONTENTS_WRAPPER_H_