chromium/chrome/browser/ui/lens/lens_overlay_side_panel_coordinator.h

// Copyright 2024 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_LENS_LENS_OVERLAY_SIDE_PANEL_COORDINATOR_H_
#define CHROME_BROWSER_UI_LENS_LENS_OVERLAY_SIDE_PANEL_COORDINATOR_H_

#include "base/memory/weak_ptr.h"
#include "chrome/browser/ui/chrome_web_modal_dialog_manager_delegate.h"
#include "chrome/browser/ui/views/side_panel/side_panel_entry_observer.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/page_navigator.h"
#include "content/public/browser/web_contents_observer.h"
#include "ui/base/models/menu_model.h"
#include "ui/base/models/simple_menu_model.h"

class GURL;
class LensOverlayController;
class LensOverlaySidePanelWebView;

enum class SidePanelEntryHideReason;

namespace content {
class WebContents;
}  // namespace content

namespace views {
class View;
}  // namespace views

namespace lens {

// Handles the creation and registration of the lens overlay side panel entry.
// There are two ways for this instance to be torn down.
//   (1) Its owner, LensOverlayController can destroy it.
//   (2) `side_panel_web_view_` can be destroyed by the side panel.
// In the case of (2), this instance is no longer functional and needs to be
// torn down. There are two constraints:
//   (2a) The shutdown path of LensOverlayController must be asynchronous. This
//   avoids re-entrancy into the code that is in turn calling (2).
//   (2b) Clearing local state associated with `side_panel_web_view_` must be
//   done synchronously.
class LensOverlaySidePanelCoordinator
    : public SidePanelEntryObserver,
      public content::WebContentsObserver,
      public ChromeWebModalDialogManagerDelegate,
      public ui::SimpleMenuModel::Delegate {};

}  // namespace lens

#endif  // CHROME_BROWSER_UI_LENS_LENS_OVERLAY_SIDE_PANEL_COORDINATOR_H_