Apply raw_ptr rewrite to libcef (see #3239)

This commit is contained in:
Marshall Greenblatt
2024-05-11 11:48:38 -04:00
parent 2156c9fd5d
commit 0170f431a0
109 changed files with 290 additions and 185 deletions

View File

@ -6,6 +6,7 @@
#define CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_CONTEXT_H_ #define CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_CONTEXT_H_
#pragma once #pragma once
#include "base/memory/raw_ptr.h"
#include "cef/include/cef_request_context_handler.h" #include "cef/include/cef_request_context_handler.h"
#include "cef/libcef/browser/alloy/chrome_profile_alloy.h" #include "cef/libcef/browser/alloy/chrome_profile_alloy.h"
#include "cef/libcef/browser/browser_context.h" #include "cef/libcef/browser/browser_context.h"
@ -131,10 +132,10 @@ class AlloyBrowserContext : public ChromeProfileAlloy,
std::unique_ptr<CefSSLHostStateDelegate> ssl_host_state_delegate_; std::unique_ptr<CefSSLHostStateDelegate> ssl_host_state_delegate_;
std::unique_ptr<visitedlink::VisitedLinkWriter> visitedlink_master_; std::unique_ptr<visitedlink::VisitedLinkWriter> visitedlink_master_;
// |visitedlink_listener_| is owned by visitedlink_master_. // |visitedlink_listener_| is owned by visitedlink_master_.
CefVisitedLinkListener* visitedlink_listener_ = nullptr; raw_ptr<CefVisitedLinkListener> visitedlink_listener_ = nullptr;
// Owned by the KeyedService system. // Owned by the KeyedService system.
extensions::CefExtensionSystem* extension_system_ = nullptr; raw_ptr<extensions::CefExtensionSystem> extension_system_ = nullptr;
// The key to index KeyedService instances created by // The key to index KeyedService instances created by
// SimpleKeyedServiceFactory. // SimpleKeyedServiceFactory.

View File

@ -9,6 +9,7 @@
#include <string_view> #include <string_view>
#include "base/command_line.h" #include "base/command_line.h"
#include "base/memory/raw_ptr.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "cef/libcef/browser/request_context_impl.h" #include "cef/libcef/browser/request_context_impl.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
@ -79,7 +80,7 @@ class AlloyBrowserMainParts : public content::BrowserMainParts {
#endif // BUILDFLAG(IS_WIN) #endif // BUILDFLAG(IS_WIN)
CefRefPtr<CefRequestContextImpl> global_request_context_; CefRefPtr<CefRequestContextImpl> global_request_context_;
CefDevToolsDelegate* devtools_delegate_ = nullptr; // Deletes itself. raw_ptr<CefDevToolsDelegate> devtools_delegate_ = nullptr; // Deletes itself.
// Blocking task runners exposed via CefTaskRunner. For consistency with // Blocking task runners exposed via CefTaskRunner. For consistency with
// previous named thread behavior always execute all pending tasks before // previous named thread behavior always execute all pending tasks before

View File

@ -9,6 +9,7 @@
#include <string> #include <string>
#include <utility> #include <utility>
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "cef/include/cef_request_context_handler.h" #include "cef/include/cef_request_context_handler.h"
@ -278,7 +279,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
const extensions::Extension* GetExtension( const extensions::Extension* GetExtension(
content::SiteInstance* site_instance); content::SiteInstance* site_instance);
AlloyBrowserMainParts* browser_main_parts_ = nullptr; raw_ptr<AlloyBrowserMainParts> browser_main_parts_ = nullptr;
}; };
#endif // CEF_LIBCEF_BROWSER_ALLOY_ALLOY_CONTENT_BROWSER_CLIENT_H_ #endif // CEF_LIBCEF_BROWSER_ALLOY_ALLOY_CONTENT_BROWSER_CLIENT_H_

View File

@ -6,6 +6,7 @@
#define CEF_LIBCEF_BROWSER_ALLOY_ALLOY_WEB_CONTENTS_VIEW_DELEGATE_H_ #define CEF_LIBCEF_BROWSER_ALLOY_ALLOY_WEB_CONTENTS_VIEW_DELEGATE_H_
#pragma once #pragma once
#include "base/memory/raw_ptr.h"
#include "cef/include/internal/cef_ptr.h" #include "cef/include/internal/cef_ptr.h"
#include "content/public/browser/web_contents_view_delegate.h" #include "content/public/browser/web_contents_view_delegate.h"
@ -26,7 +27,7 @@ class AlloyWebContentsViewDelegate : public content::WebContentsViewDelegate {
const content::ContextMenuParams& params) override; const content::ContextMenuParams& params) override;
private: private:
content::WebContents* const web_contents_; const raw_ptr<content::WebContents> web_contents_;
}; };
#endif // CEF_LIBCEF_BROWSER_ALLOY_ALLOY_WEB_CONTENTS_VIEW_DELEGATE_H_ #endif // CEF_LIBCEF_BROWSER_ALLOY_ALLOY_WEB_CONTENTS_VIEW_DELEGATE_H_

View File

@ -213,7 +213,7 @@ void CefBrowserPlatformDelegateAlloy::CreateExtensionHost(
DCHECK(browser_); DCHECK(browser_);
DCHECK(!extension_host_); DCHECK(!extension_host_);
auto alloy_browser = AlloyBrowserHostImpl::FromBaseChecked(browser_); auto alloy_browser = AlloyBrowserHostImpl::FromBaseChecked(browser_.get());
if (host_type == extensions::mojom::ViewType::kExtensionPopup) { if (host_type == extensions::mojom::ViewType::kExtensionPopup) {
// Create an extension host that we own. // Create an extension host that we own.

View File

@ -6,6 +6,7 @@
#ifndef CEF_LIBCEF_BROWSER_ALLOY_BROWSER_PLATFORM_DELEGATE_ALLOY_H_ #ifndef CEF_LIBCEF_BROWSER_ALLOY_BROWSER_PLATFORM_DELEGATE_ALLOY_H_
#define CEF_LIBCEF_BROWSER_ALLOY_BROWSER_PLATFORM_DELEGATE_ALLOY_H_ #define CEF_LIBCEF_BROWSER_ALLOY_BROWSER_PLATFORM_DELEGATE_ALLOY_H_
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "cef/libcef/browser/alloy/dialogs/alloy_web_contents_dialog_helper.h" #include "cef/libcef/browser/alloy/dialogs/alloy_web_contents_dialog_helper.h"
#include "cef/libcef/browser/browser_platform_delegate.h" #include "cef/libcef/browser/browser_platform_delegate.h"
@ -114,7 +115,7 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) #if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
// Used when the browser is hosting an extension. // Used when the browser is hosting an extension.
extensions::ExtensionHost* extension_host_ = nullptr; raw_ptr<extensions::ExtensionHost> extension_host_ = nullptr;
bool is_background_host_ = false; bool is_background_host_ = false;
#endif #endif

View File

@ -5,6 +5,7 @@
#include "cef/libcef/browser/alloy/chrome_profile_alloy.h" #include "cef/libcef/browser/alloy/chrome_profile_alloy.h"
#include "base/memory/raw_ptr.h"
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "components/profile_metrics/browser_profile_type.h" #include "components/profile_metrics/browser_profile_type.h"
#include "components/variations/variations_client.h" #include "components/variations/variations_client.h"
@ -31,7 +32,7 @@ class CefVariationsClient : public variations::VariationsClient {
} }
private: private:
content::BrowserContext* browser_context_; raw_ptr<content::BrowserContext> browser_context_;
}; };
} // namespace } // namespace

View File

@ -6,6 +6,7 @@
#define CEF_LIBCEF_BROWSER_ALLOY_DEVTOOLS_ALLOY_DEVTOOLS_WINDOW_RUNNER_H_ #define CEF_LIBCEF_BROWSER_ALLOY_DEVTOOLS_ALLOY_DEVTOOLS_WINDOW_RUNNER_H_
#pragma once #pragma once
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "cef/libcef/browser/devtools/devtools_window_runner.h" #include "cef/libcef/browser/devtools/devtools_window_runner.h"
@ -31,7 +32,7 @@ class AlloyDevToolsWindowRunner : public CefDevToolsWindowRunner {
// CefDevToolsFrontend will delete itself when the frontend WebContents is // CefDevToolsFrontend will delete itself when the frontend WebContents is
// destroyed. // destroyed.
CefDevToolsFrontend* devtools_frontend_ = nullptr; raw_ptr<CefDevToolsFrontend> devtools_frontend_ = nullptr;
base::WeakPtrFactory<AlloyDevToolsWindowRunner> weak_ptr_factory_{this}; base::WeakPtrFactory<AlloyDevToolsWindowRunner> weak_ptr_factory_{this};
}; };

View File

@ -9,6 +9,7 @@
#include <string> #include <string>
#include "base/functional/callback_forward.h" #include "base/functional/callback_forward.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
namespace base { namespace base {
@ -70,8 +71,8 @@ class CefDevToolsFileManager {
const base::Value* arg3); const base::Value* arg3);
// Guaranteed to outlive this object. // Guaranteed to outlive this object.
AlloyBrowserHostImpl* browser_impl_; raw_ptr<AlloyBrowserHostImpl> browser_impl_;
PrefService* prefs_; raw_ptr<PrefService> prefs_;
using PathsMap = std::map<std::string, base::FilePath>; using PathsMap = std::map<std::string, base::FilePath>;
PathsMap saved_files_; PathsMap saved_files_;

View File

@ -17,6 +17,7 @@
#include "base/json/json_writer.h" #include "base/json/json_writer.h"
#include "base/json/string_escape.h" #include "base/json/string_escape.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
@ -229,7 +230,7 @@ class CefDevToolsFrontend::NetworkResourceLoader
void OnRetry(base::OnceClosure start_retry) override { DCHECK(false); } void OnRetry(base::OnceClosure start_retry) override { DCHECK(false); }
const int stream_id_; const int stream_id_;
CefDevToolsFrontend* const bindings_; const raw_ptr<CefDevToolsFrontend> bindings_;
std::unique_ptr<network::SimpleURLLoader> loader_; std::unique_ptr<network::SimpleURLLoader> loader_;
int request_id_; int request_id_;
scoped_refptr<net::HttpResponseHeaders> response_headers_; scoped_refptr<net::HttpResponseHeaders> response_headers_;

View File

@ -8,6 +8,7 @@
#include <memory> #include <memory>
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/values.h" #include "base/values.h"
@ -91,7 +92,7 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
PrefService* GetPrefs() const; PrefService* GetPrefs() const;
CefRefPtr<AlloyBrowserHostImpl> frontend_browser_; CefRefPtr<AlloyBrowserHostImpl> frontend_browser_;
content::WebContents* inspected_contents_; raw_ptr<content::WebContents> inspected_contents_;
scoped_refptr<content::DevToolsAgentHost> agent_host_; scoped_refptr<content::DevToolsAgentHost> agent_host_;
CefPoint inspect_element_at_; CefPoint inspect_element_at_;
base::OnceClosure frontend_destroyed_callback_; base::OnceClosure frontend_destroyed_callback_;

View File

@ -7,6 +7,7 @@
#pragma once #pragma once
#include "base/functional/callback_forward.h" #include "base/functional/callback_forward.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/observer_list.h" #include "base/observer_list.h"
#include "components/web_modal/modal_dialog_host.h" #include "components/web_modal/modal_dialog_host.h"
@ -40,7 +41,7 @@ class AlloyWebContentsDialogHelper
private: private:
void OnBoundsChanged(); void OnBoundsChanged();
CefBrowserPlatformDelegate* const browser_delegate_; const raw_ptr<CefBrowserPlatformDelegate> browser_delegate_;
// Used to notify WebContentsModalDialog. // Used to notify WebContentsModalDialog.
base::ObserverList<web_modal::ModalDialogHostObserver>::Unchecked base::ObserverList<web_modal::ModalDialogHostObserver>::Unchecked

View File

@ -4,6 +4,7 @@
#include "cef/libcef/browser/browser_contents_delegate.h" #include "cef/libcef/browser/browser_contents_delegate.h"
#include "base/memory/raw_ptr.h"
#include "cef/libcef/browser/browser_host_base.h" #include "cef/libcef/browser/browser_host_base.h"
#include "cef/libcef/browser/browser_platform_delegate.h" #include "cef/libcef/browser/browser_platform_delegate.h"
#include "cef/libcef/browser/browser_util.h" #include "cef/libcef/browser/browser_util.h"
@ -73,8 +74,8 @@ class CefWidgetHostInterceptor
private: private:
CefRefPtr<CefBrowser> const browser_; CefRefPtr<CefBrowser> const browser_;
content::RenderWidgetHost* const render_widget_host_; const raw_ptr<content::RenderWidgetHost> render_widget_host_;
blink::mojom::WidgetHost* const impl_; const raw_ptr<blink::mojom::WidgetHost> impl_;
}; };
} // namespace } // namespace

View File

@ -6,6 +6,7 @@
#define CEF_LIBCEF_BROWSER_BROWSER_HOST_BASE_H_ #define CEF_LIBCEF_BROWSER_BROWSER_HOST_BASE_H_
#pragma once #pragma once
#include "base/memory/raw_ptr.h"
#include "base/observer_list.h" #include "base/observer_list.h"
#include "base/synchronization/lock.h" #include "base/synchronization/lock.h"
#include "cef/include/cef_browser.h" #include "cef/include/cef_browser.h"
@ -120,7 +121,7 @@ struct CefBrowserCreateParams {
// Used when explicitly creating the browser as an extension host via // Used when explicitly creating the browser as an extension host via
// ProcessManager::CreateBackgroundHost. Currently used with the alloy // ProcessManager::CreateBackgroundHost. Currently used with the alloy
// runtime only. // runtime only.
const extensions::Extension* extension = nullptr; raw_ptr<const extensions::Extension> extension = nullptr;
extensions::mojom::ViewType extension_host_type = extensions::mojom::ViewType extension_host_type =
extensions::mojom::ViewType::kInvalid; extensions::mojom::ViewType::kInvalid;
#endif #endif
@ -438,7 +439,7 @@ class CefBrowserHostBase : public CefBrowserHost,
// Only accessed on the UI thread. // Only accessed on the UI thread.
std::unique_ptr<CefBrowserContentsDelegate> contents_delegate_; std::unique_ptr<CefBrowserContentsDelegate> contents_delegate_;
CefRefPtr<CefUnresponsiveProcessCallback> unresponsive_process_callback_; CefRefPtr<CefUnresponsiveProcessCallback> unresponsive_process_callback_;
RenderViewContextMenuObserver* context_menu_observer_ = nullptr; raw_ptr<RenderViewContextMenuObserver> context_menu_observer_ = nullptr;
// Observers that want to be notified of changes to this object. // Observers that want to be notified of changes to this object.
// Only accessed on the UI thread. // Only accessed on the UI thread.

View File

@ -12,6 +12,7 @@
#include "base/containers/unique_ptr_adapters.h" #include "base/containers/unique_ptr_adapters.h"
#include "base/functional/callback.h" #include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/synchronization/lock.h" #include "base/synchronization/lock.h"
@ -169,7 +170,7 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
return frame_ && is_main_frame_ && !is_speculative_ && !is_in_bfcache_; return frame_ && is_main_frame_ && !is_speculative_ && !is_in_bfcache_;
} }
content::RenderFrameHost* host_; raw_ptr<content::RenderFrameHost> host_;
content::GlobalRenderFrameHostId global_id_; content::GlobalRenderFrameHostId global_id_;
bool is_main_frame_; bool is_main_frame_;
bool is_speculative_; bool is_speculative_;
@ -210,7 +211,7 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
protected: protected:
friend class CefBrowserInfo; friend class CefBrowserInfo;
CefBrowserInfo* const browser_info_; const raw_ptr<CefBrowserInfo> browser_info_;
CefRefPtr<CefFrameHandler> frame_handler_; CefRefPtr<CefFrameHandler> frame_handler_;
std::unique_ptr<base::AutoLock> browser_info_lock_scope_; std::unique_ptr<base::AutoLock> browser_info_lock_scope_;
std::queue<FrameNotifyOnceAction> queue_; std::queue<FrameNotifyOnceAction> queue_;
@ -219,7 +220,7 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
mutable base::Lock notification_lock_; mutable base::Lock notification_lock_;
// These members must be protected by |notification_lock_|. // These members must be protected by |notification_lock_|.
NotificationStateLock* notification_state_lock_ = nullptr; raw_ptr<NotificationStateLock> notification_state_lock_ = nullptr;
CefRefPtr<CefFrameHandler> frame_handler_; CefRefPtr<CefFrameHandler> frame_handler_;
mutable base::Lock lock_; mutable base::Lock lock_;

View File

@ -11,6 +11,7 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include "base/memory/raw_ptr.h"
#include "base/synchronization/lock.h" #include "base/synchronization/lock.h"
#include "base/task/sequenced_task_runner.h" #include "base/task/sequenced_task_runner.h"
#include "cef/include/cef_client.h" #include "cef/include/cef_client.h"
@ -209,7 +210,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
bool use_default_browser_creation = false; bool use_default_browser_creation = false;
// The newly created WebContents (set in WebContentsCreated). // The newly created WebContents (set in WebContentsCreated).
content::WebContents* new_contents = nullptr; raw_ptr<content::WebContents> new_contents = nullptr;
}; };
// Manage pending popups. Only called on the UI thread. // Manage pending popups. Only called on the UI thread.

View File

@ -10,6 +10,7 @@
#include <vector> #include <vector>
#include "base/functional/callback_forward.h" #include "base/functional/callback_forward.h"
#include "base/memory/raw_ptr.h"
#include "cef/include/cef_client.h" #include "cef/include/cef_client.h"
#include "cef/include/cef_drag_data.h" #include "cef/include/cef_drag_data.h"
#include "cef/include/internal/cef_types.h" #include "cef/include/internal/cef_types.h"
@ -409,8 +410,8 @@ class CefBrowserPlatformDelegate {
static int TranslateWebEventModifiers(uint32_t cef_modifiers); static int TranslateWebEventModifiers(uint32_t cef_modifiers);
// Not owned by this object. // Not owned by this object.
content::WebContents* web_contents_ = nullptr; raw_ptr<content::WebContents> web_contents_ = nullptr;
CefBrowserHostBase* browser_ = nullptr; raw_ptr<CefBrowserHostBase> browser_ = nullptr;
}; };
#endif // CEF_LIBCEF_BROWSER_BROWSER_PLATFORM_DELEGATE_H_ #endif // CEF_LIBCEF_BROWSER_BROWSER_PLATFORM_DELEGATE_H_

View File

@ -5,6 +5,7 @@
#ifndef CEF_LIBCEF_BROWSER_CHROME_BROWSER_PLATFORM_DELEGATE_CHROME_H_ #ifndef CEF_LIBCEF_BROWSER_CHROME_BROWSER_PLATFORM_DELEGATE_CHROME_H_
#define CEF_LIBCEF_BROWSER_CHROME_BROWSER_PLATFORM_DELEGATE_CHROME_H_ #define CEF_LIBCEF_BROWSER_CHROME_BROWSER_PLATFORM_DELEGATE_CHROME_H_
#include "base/memory/raw_ptr.h"
#include "cef/libcef/browser/browser_platform_delegate.h" #include "cef/libcef/browser/browser_platform_delegate.h"
#include "cef/libcef/browser/native/browser_platform_delegate_native.h" #include "cef/libcef/browser/native/browser_platform_delegate_native.h"
@ -60,7 +61,7 @@ class CefBrowserPlatformDelegateChrome
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate_; std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate_;
Browser* chrome_browser_ = nullptr; raw_ptr<Browser> chrome_browser_ = nullptr;
}; };
#endif // CEF_LIBCEF_BROWSER_CHROME_BROWSER_PLATFORM_DELEGATE_CHROME_H_ #endif // CEF_LIBCEF_BROWSER_CHROME_BROWSER_PLATFORM_DELEGATE_CHROME_H_

View File

@ -6,6 +6,7 @@
#define CEF_LIBCEF_BROWSER_CHROME_CHROME_BROWSER_CONTEXT_H_ #define CEF_LIBCEF_BROWSER_CHROME_CHROME_BROWSER_CONTEXT_H_
#pragma once #pragma once
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "cef/libcef/browser/browser_context.h" #include "cef/libcef/browser/browser_context.h"
#include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_manager.h"
@ -55,7 +56,7 @@ class ChromeBrowserContext : public CefBrowserContext, public ProfileObserver {
void ProfileCreated(CreateStatus status, Profile* profile); void ProfileCreated(CreateStatus status, Profile* profile);
base::OnceClosure initialized_cb_; base::OnceClosure initialized_cb_;
Profile* profile_ = nullptr; raw_ptr<Profile> profile_ = nullptr;
bool should_destroy_ = false; bool should_destroy_ = false;
bool destroyed_ = false; bool destroyed_ = false;

View File

@ -244,7 +244,7 @@ void ChromeBrowserDelegate::SetAsDelegate(content::WebContents* web_contents,
if (browser_host) { if (browser_host) {
// We already have a browser host, so just change the associated Browser. // We already have a browser host, so just change the associated Browser.
browser_host->SetBrowser(set_delegate ? browser_ : nullptr); browser_host->SetBrowser(set_delegate ? browser_.get() : nullptr);
return; return;
} }

View File

@ -9,6 +9,7 @@
#include <memory> #include <memory>
#include <optional> #include <optional>
#include "base/memory/raw_ptr.h"
#include "cef/libcef/browser/browser_host_base.h" #include "cef/libcef/browser/browser_host_base.h"
#include "cef/libcef/browser/browser_info.h" #include "cef/libcef/browser/browser_info.h"
#include "cef/libcef/browser/chrome/browser_delegate.h" #include "cef/libcef/browser/chrome/browser_delegate.h"
@ -161,7 +162,7 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
CefWindowImpl* GetCefWindowImpl() const; CefWindowImpl* GetCefWindowImpl() const;
CefWindowView* GetCefWindowView() const; CefWindowView* GetCefWindowView() const;
Browser* const browser_; const raw_ptr<Browser> browser_;
base::WeakPtr<ChromeBrowserHostImpl> opener_host_; base::WeakPtr<ChromeBrowserHostImpl> opener_host_;
// Used when creating a new browser host. // Used when creating a new browser host.

View File

@ -8,6 +8,7 @@
#include <memory> #include <memory>
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "cef/libcef/browser/browser_host_base.h" #include "cef/libcef/browser/browser_host_base.h"
#include "cef/libcef/browser/chrome/browser_delegate.h" #include "cef/libcef/browser/chrome/browser_delegate.h"
@ -174,7 +175,7 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase {
// TabStripModel::kNoTab if not found. // TabStripModel::kNoTab if not found.
int GetCurrentTabIndex() const; int GetCurrentTabIndex() const;
Browser* browser_ = nullptr; raw_ptr<Browser> browser_ = nullptr;
CefWindowHandle host_window_handle_ = kNullWindowHandle; CefWindowHandle host_window_handle_ = kNullWindowHandle;
base::WeakPtrFactory<ChromeBrowserHostImpl> weak_ptr_factory_{this}; base::WeakPtrFactory<ChromeBrowserHostImpl> weak_ptr_factory_{this};

View File

@ -8,6 +8,7 @@
#include <memory> #include <memory>
#include "base/memory/raw_ptr.h"
#include "cef/libcef/browser/request_context_impl.h" #include "cef/libcef/browser/request_context_impl.h"
#include "chrome/browser/chrome_content_browser_client.h" #include "chrome/browser/chrome_content_browser_client.h"
#include "content/public/browser/web_contents_view_delegate.h" #include "content/public/browser/web_contents_view_delegate.h"
@ -140,7 +141,7 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
static std::unique_ptr<content::WebContentsViewDelegate> static std::unique_ptr<content::WebContentsViewDelegate>
CreateWebContentsViewDelegate(content::WebContents* web_contents); CreateWebContentsViewDelegate(content::WebContents* web_contents);
ChromeBrowserMainExtraPartsCef* browser_main_parts_ = nullptr; raw_ptr<ChromeBrowserMainExtraPartsCef> browser_main_parts_ = nullptr;
}; };
#endif // CEF_LIBCEF_BROWSER_CHROME_CHROME_CONTENT_BROWSER_CLIENT_CEF_ #endif // CEF_LIBCEF_BROWSER_CHROME_CHROME_CONTENT_BROWSER_CLIENT_CEF_

View File

@ -4,6 +4,7 @@
#include "cef/libcef/browser/chrome/chrome_context_menu_handler.h" #include "cef/libcef/browser/chrome/chrome_context_menu_handler.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "cef/libcef/browser/alloy/alloy_browser_host_impl.h" #include "cef/libcef/browser/alloy/alloy_browser_host_impl.h"
#include "cef/libcef/browser/browser_host_base.h" #include "cef/libcef/browser/browser_host_base.h"
@ -271,7 +272,7 @@ class CefContextMenuObserver : public RenderViewContextMenuObserver,
OnMenuClosed(); OnMenuClosed();
} }
RenderViewContextMenu* const context_menu_; const raw_ptr<RenderViewContextMenu> context_menu_;
CefRefPtr<CefBrowserHostBase> browser_; CefRefPtr<CefBrowserHostBase> browser_;
CefRefPtr<CefContextMenuHandler> handler_; CefRefPtr<CefContextMenuHandler> handler_;
CefRefPtr<CefContextMenuParams> params_; CefRefPtr<CefContextMenuParams> params_;

View File

@ -6,6 +6,7 @@
#define CEF_LIBCEF_BROWSER_CHROME_CHROME_WEB_CONTENTS_VIEW_DELEGATE_CEF_H_ #define CEF_LIBCEF_BROWSER_CHROME_CHROME_WEB_CONTENTS_VIEW_DELEGATE_CEF_H_
#pragma once #pragma once
#include "base/memory/raw_ptr.h"
#include "build/build_config.h" #include "build/build_config.h"
#if BUILDFLAG(IS_MAC) #if BUILDFLAG(IS_MAC)
@ -31,7 +32,7 @@ class ChromeWebContentsViewDelegateCef
const content::ContextMenuParams& params) override; const content::ContextMenuParams& params) override;
private: private:
content::WebContents* const web_contents_; const raw_ptr<content::WebContents> web_contents_;
}; };
#endif // CEF_LIBCEF_BROWSER_CHROME_CHROME_WEB_CONTENTS_VIEW_DELEGATE_CEF_H_ #endif // CEF_LIBCEF_BROWSER_CHROME_CHROME_WEB_CONTENTS_VIEW_DELEGATE_CEF_H_

View File

@ -6,6 +6,7 @@
#ifndef CEF_LIBCEF_BROWSER_CHROME_EXTENSIONS_CHROME_MIME_HANDLER_VIEW_GUEST_DELEGATE_CEF_H_ #ifndef CEF_LIBCEF_BROWSER_CHROME_EXTENSIONS_CHROME_MIME_HANDLER_VIEW_GUEST_DELEGATE_CEF_H_
#define CEF_LIBCEF_BROWSER_CHROME_EXTENSIONS_CHROME_MIME_HANDLER_VIEW_GUEST_DELEGATE_CEF_H_ #define CEF_LIBCEF_BROWSER_CHROME_EXTENSIONS_CHROME_MIME_HANDLER_VIEW_GUEST_DELEGATE_CEF_H_
#include "base/memory/raw_ptr.h"
#include "chrome/browser/guest_view/mime_handler_view/chrome_mime_handler_view_guest_delegate.h" #include "chrome/browser/guest_view/mime_handler_view/chrome_mime_handler_view_guest_delegate.h"
namespace extensions { namespace extensions {
@ -31,7 +32,7 @@ class ChromeMimeHandlerViewGuestDelegateCef
const content::ContextMenuParams& params) override; const content::ContextMenuParams& params) override;
private: private:
content::WebContents* owner_web_contents_; raw_ptr<content::WebContents> owner_web_contents_;
}; };
} // namespace extensions } // namespace extensions

View File

@ -48,7 +48,7 @@ void CefBrowserPlatformDelegateChromeViews::BrowserCreated(
void CefBrowserPlatformDelegateChromeViews::NotifyBrowserCreated() { void CefBrowserPlatformDelegateChromeViews::NotifyBrowserCreated() {
if (auto delegate = browser_view_->delegate()) { if (auto delegate = browser_view_->delegate()) {
delegate->OnBrowserCreated(browser_view_, browser_); delegate->OnBrowserCreated(browser_view_, browser_.get());
// DevTools windows hide the notification bubble by default. However, we // DevTools windows hide the notification bubble by default. However, we
// don't currently have the ability to intercept WebContents creation via // don't currently have the ability to intercept WebContents creation via
@ -76,7 +76,8 @@ void CefBrowserPlatformDelegateChromeViews::NotifyBrowserCreated() {
void CefBrowserPlatformDelegateChromeViews::NotifyBrowserDestroyed() { void CefBrowserPlatformDelegateChromeViews::NotifyBrowserDestroyed() {
if (browser_view_->delegate()) { if (browser_view_->delegate()) {
browser_view_->delegate()->OnBrowserDestroyed(browser_view_, browser_); browser_view_->delegate()->OnBrowserDestroyed(browser_view_,
browser_.get());
} }
} }

View File

@ -8,6 +8,7 @@
#include <map> #include <map>
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "cef/libcef/browser/views/color_provider_tracker.h" #include "cef/libcef/browser/views/color_provider_tracker.h"
#include "cef/libcef/browser/views/widget.h" #include "cef/libcef/browser/views/widget.h"
@ -148,8 +149,8 @@ class ChromeBrowserFrame : public BrowserFrame,
void NotifyThemeColorsChanged(bool chrome_theme); void NotifyThemeColorsChanged(bool chrome_theme);
CefWindowView* window_view_; raw_ptr<CefWindowView> window_view_;
BrowserView* browser_view_ = nullptr; raw_ptr<BrowserView> browser_view_ = nullptr;
bool initialized_ = false; bool initialized_ = false;
bool native_theme_change_ = false; bool native_theme_change_ = false;

View File

@ -76,7 +76,8 @@ void ChromeBrowserView::OnGestureEvent(ui::GestureEvent* event) {
ToolbarView* ChromeBrowserView::OverrideCreateToolbar() { ToolbarView* ChromeBrowserView::OverrideCreateToolbar() {
if (cef_delegate()) { if (cef_delegate()) {
auto toolbar_type = cef_delegate()->GetChromeToolbarType(cef_browser_view_); auto toolbar_type =
cef_delegate()->GetChromeToolbarType(cef_browser_view_.get());
std::optional<ToolbarView::DisplayMode> display_mode; std::optional<ToolbarView::DisplayMode> display_mode;
switch (toolbar_type) { switch (toolbar_type) {
case CEF_CTT_NORMAL: case CEF_CTT_NORMAL:

View File

@ -6,6 +6,7 @@
#define CEF_LIBCEF_BROWSER_CHROME_VIEWS_CHROME_BROWSER_VIEW_H_ #define CEF_LIBCEF_BROWSER_CHROME_VIEWS_CHROME_BROWSER_VIEW_H_
#pragma once #pragma once
#include "base/memory/raw_ptr.h"
#include "cef/include/views/cef_browser_view.h" #include "cef/include/views/cef_browser_view.h"
#include "cef/include/views/cef_browser_view_delegate.h" #include "cef/include/views/cef_browser_view_delegate.h"
#include "cef/libcef/browser/chrome/views/toolbar_view_impl.h" #include "cef/libcef/browser/chrome/views/toolbar_view_impl.h"
@ -52,9 +53,9 @@ class ChromeBrowserView
CefBrowserViewImpl* cef_browser_view() const { return cef_browser_view_; } CefBrowserViewImpl* cef_browser_view() const { return cef_browser_view_; }
private: private:
CefBrowserViewImpl* const cef_browser_view_; const raw_ptr<CefBrowserViewImpl> cef_browser_view_;
views::WebView* web_view_ = nullptr; raw_ptr<views::WebView> web_view_ = nullptr;
bool destroyed_ = false; bool destroyed_ = false;

View File

@ -6,6 +6,7 @@
#define CEF_LIBCEF_BROWSER_CHROME_VIEWS_TOOLBAR_VIEW_IMPL_H_ #define CEF_LIBCEF_BROWSER_CHROME_VIEWS_TOOLBAR_VIEW_IMPL_H_
#pragma once #pragma once
#include "base/memory/raw_ptr.h"
#include "cef/include/views/cef_view_delegate.h" #include "cef/include/views/cef_view_delegate.h"
#include "cef/libcef/browser/chrome/views/toolbar_view_view.h" #include "cef/libcef/browser/chrome/views/toolbar_view_view.h"
#include "cef/libcef/browser/views/view_impl.h" #include "cef/libcef/browser/views/view_impl.h"
@ -46,8 +47,8 @@ class CefToolbarViewImpl
CefToolbarViewView* CreateRootView() override; CefToolbarViewView* CreateRootView() override;
void InitializeRootView() override; void InitializeRootView() override;
Browser* const browser_; const raw_ptr<Browser> browser_;
BrowserView* const browser_view_; const raw_ptr<BrowserView> browser_view_;
std::optional<ToolbarView::DisplayMode> const display_mode_; std::optional<ToolbarView::DisplayMode> const display_mode_;
IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefToolbarViewImpl); IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefToolbarViewImpl);

View File

@ -8,6 +8,7 @@
#include <memory> #include <memory>
#include "base/containers/span.h" #include "base/containers/span.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h" #include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/observer_list.h" #include "base/observer_list.h"
@ -68,7 +69,7 @@ class CefDevToolsController : public content::DevToolsAgentHostClient {
bool EnsureAgentHost(); bool EnsureAgentHost();
content::WebContents* const inspected_contents_; const raw_ptr<content::WebContents> inspected_contents_;
scoped_refptr<content::DevToolsAgentHost> agent_host_; scoped_refptr<content::DevToolsAgentHost> agent_host_;
int next_message_id_ = 1; int next_message_id_ = 1;

View File

@ -4,6 +4,7 @@
#include "cef/libcef/browser/devtools/devtools_protocol_manager.h" #include "cef/libcef/browser/devtools/devtools_protocol_manager.h"
#include "base/memory/raw_ptr.h"
#include "cef/libcef/browser/browser_host_base.h" #include "cef/libcef/browser/browser_host_base.h"
#include "cef/libcef/browser/devtools/devtools_controller.h" #include "cef/libcef/browser/devtools/devtools_controller.h"
#include "cef/libcef/browser/thread_util.h" #include "cef/libcef/browser/thread_util.h"
@ -51,7 +52,7 @@ class CefDevToolsRegistrationImpl : public CefRegistration,
// CefDevToolsController::Observer methods: // CefDevToolsController::Observer methods:
bool OnDevToolsMessage(const std::string_view& message) override { bool OnDevToolsMessage(const std::string_view& message) override {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
return observer_->OnDevToolsMessage(browser_, message.data(), return observer_->OnDevToolsMessage(browser_.get(), message.data(),
message.size()); message.size());
} }
@ -59,25 +60,25 @@ class CefDevToolsRegistrationImpl : public CefRegistration,
bool success, bool success,
const std::string_view& result) override { const std::string_view& result) override {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
observer_->OnDevToolsMethodResult(browser_, message_id, success, observer_->OnDevToolsMethodResult(browser_.get(), message_id, success,
result.data(), result.size()); result.data(), result.size());
} }
void OnDevToolsEvent(const std::string_view& method, void OnDevToolsEvent(const std::string_view& method,
const std::string_view& params) override { const std::string_view& params) override {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
observer_->OnDevToolsEvent(browser_, std::string(method), params.data(), observer_->OnDevToolsEvent(browser_.get(), std::string(method),
params.size()); params.data(), params.size());
} }
void OnDevToolsAgentAttached() override { void OnDevToolsAgentAttached() override {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
observer_->OnDevToolsAgentAttached(browser_); observer_->OnDevToolsAgentAttached(browser_.get());
} }
void OnDevToolsAgentDetached() override { void OnDevToolsAgentDetached() override {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
observer_->OnDevToolsAgentDetached(browser_); observer_->OnDevToolsAgentDetached(browser_.get());
} }
void OnDevToolsControllerDestroyed() override { void OnDevToolsControllerDestroyed() override {
@ -88,7 +89,7 @@ class CefDevToolsRegistrationImpl : public CefRegistration,
CefRefPtr<CefDevToolsMessageObserver> observer_; CefRefPtr<CefDevToolsMessageObserver> observer_;
CefBrowserHostBase* browser_ = nullptr; raw_ptr<CefBrowserHostBase> browser_ = nullptr;
base::WeakPtr<CefDevToolsController> controller_; base::WeakPtr<CefDevToolsController> controller_;
IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefDevToolsRegistrationImpl); IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefDevToolsRegistrationImpl);

View File

@ -8,6 +8,7 @@
#include <memory> #include <memory>
#include "base/memory/raw_ptr.h"
#include "cef/include/cef_browser.h" #include "cef/include/cef_browser.h"
class CefBrowserHostBase; class CefBrowserHostBase;
@ -48,7 +49,7 @@ class CefDevToolsProtocolManager {
private: private:
bool EnsureController(); bool EnsureController();
CefBrowserHostBase* const inspected_browser_; const raw_ptr<CefBrowserHostBase> inspected_browser_;
std::unique_ptr<CefDevToolsController> devtools_controller_; std::unique_ptr<CefDevToolsController> devtools_controller_;
}; };

View File

@ -8,6 +8,7 @@
#include <set> #include <set>
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "cef/libcef/browser/browser_host_base.h" #include "cef/libcef/browser/browser_host_base.h"
#include "cef/libcef/browser/download_manager_delegate.h" #include "cef/libcef/browser/download_manager_delegate.h"
@ -57,7 +58,7 @@ class CefDownloadManagerDelegateImpl
void ResetManager(); void ResetManager();
content::DownloadManager* manager_; raw_ptr<content::DownloadManager> manager_;
base::WeakPtrFactory<content::DownloadManager> manager_ptr_factory_; base::WeakPtrFactory<content::DownloadManager> manager_ptr_factory_;
const bool alloy_bootstrap_; const bool alloy_bootstrap_;

View File

@ -57,7 +57,7 @@ CefRefPtr<CefRequestContext> CefExtensionImpl::GetLoaderContext() {
return nullptr; return nullptr;
} }
return loader_context_; return loader_context_.get();
} }
bool CefExtensionImpl::IsLoaded() { bool CefExtensionImpl::IsLoaded() {

View File

@ -8,6 +8,7 @@
#include <memory> #include <memory>
#include "base/memory/raw_ptr.h"
#include "cef/include/cef_extension.h" #include "cef/include/cef_extension.h"
#include "cef/include/cef_extension_handler.h" #include "cef/include/cef_extension_handler.h"
#include "cef/include/cef_request_context.h" #include "cef/include/cef_request_context.h"
@ -48,7 +49,7 @@ class CefExtensionImpl : public CefExtension {
CefString path_; CefString path_;
CefRefPtr<CefDictionaryValue> manifest_; CefRefPtr<CefDictionaryValue> manifest_;
CefRequestContext* loader_context_; raw_ptr<CefRequestContext> loader_context_;
CefRefPtr<CefExtensionHandler> handler_; CefRefPtr<CefExtensionHandler> handler_;
// Only accessed on the UI thread. // Only accessed on the UI thread.

View File

@ -5,6 +5,7 @@
#ifndef CEF_LIBCEF_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_ #ifndef CEF_LIBCEF_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_
#define CEF_LIBCEF_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_ #define CEF_LIBCEF_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_
#include "base/memory/raw_ptr.h"
#include "cef/libcef/browser/extensions/extension_function_details.h" #include "cef/libcef/browser/extensions/extension_function_details.h"
#include "chrome/common/extensions/api/tabs.h" #include "chrome/common/extensions/api/tabs.h"
#include "extensions/browser/api/execute_code_function.h" #include "extensions/browser/api/execute_code_function.h"
@ -68,7 +69,7 @@ class TabsUpdateFunction : public BaseAPIFunction {
DECLARE_EXTENSION_FUNCTION("tabs.update", TABS_UPDATE) DECLARE_EXTENSION_FUNCTION("tabs.update", TABS_UPDATE)
int tab_id_ = -1; int tab_id_ = -1;
content::WebContents* web_contents_ = nullptr; raw_ptr<content::WebContents> web_contents_ = nullptr;
}; };
// Implement API calls tabs.executeScript, tabs.insertCSS, and tabs.removeCSS. // Implement API calls tabs.executeScript, tabs.insertCSS, and tabs.removeCSS.

View File

@ -28,8 +28,9 @@ void CefBrowserPlatformDelegateBackground::CloseHostWindow() {
// No host window, so continue browser destruction now. Do it asynchronously // No host window, so continue browser destruction now. Do it asynchronously
// so the call stack has a chance to unwind. // so the call stack has a chance to unwind.
CEF_POST_TASK( CEF_POST_TASK(
CEF_UIT, base::BindOnce(&AlloyBrowserHostImpl::WindowDestroyed, CEF_UIT,
AlloyBrowserHostImpl::FromBaseChecked(browser_))); base::BindOnce(&AlloyBrowserHostImpl::WindowDestroyed,
AlloyBrowserHostImpl::FromBaseChecked(browser_.get())));
} }
CefWindowHandle CefBrowserPlatformDelegateBackground::GetHostWindowHandle() CefWindowHandle CefBrowserPlatformDelegateBackground::GetHostWindowHandle()

View File

@ -6,6 +6,7 @@
#define CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DETAILS_H_ #define CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DETAILS_H_
#include "base/functional/callback_forward.h" #include "base/functional/callback_forward.h"
#include "base/memory/raw_ptr.h"
#include "cef/include/cef_extension.h" #include "cef/include/cef_extension.h"
#include "cef/libcef/browser/alloy/alloy_browser_host_impl.h" #include "cef/libcef/browser/alloy/alloy_browser_host_impl.h"
#include "chrome/common/extensions/api/tabs.h" #include "chrome/common/extensions/api/tabs.h"
@ -136,7 +137,7 @@ class CefExtensionFunctionDetails {
private: private:
// The function for which these details have been created. Must outlive the // The function for which these details have been created. Must outlive the
// CefExtensionFunctionDetails instance. // CefExtensionFunctionDetails instance.
ExtensionFunction* function_; raw_ptr<ExtensionFunction> function_;
mutable CefRefPtr<CefExtension> cef_extension_; mutable CefRefPtr<CefExtension> cef_extension_;

View File

@ -9,6 +9,7 @@
#include <map> #include <map>
#include <memory> #include <memory>
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/one_shot_event.h" #include "base/one_shot_event.h"
#include "cef/include/cef_extension_handler.h" #include "cef/include/cef_extension_handler.h"
@ -152,7 +153,7 @@ class CefExtensionSystem : public ExtensionSystem {
void NotifyExtensionUnloaded(const Extension* extension, void NotifyExtensionUnloaded(const Extension* extension,
UnloadedExtensionReason reason); UnloadedExtensionReason reason);
content::BrowserContext* browser_context_; // Not owned. raw_ptr<content::BrowserContext> browser_context_; // Not owned.
bool initialized_ = false; bool initialized_ = false;
@ -169,11 +170,11 @@ class CefExtensionSystem : public ExtensionSystem {
base::OneShotEvent ready_; base::OneShotEvent ready_;
// Sets of enabled/disabled/terminated/blacklisted extensions. Not owned. // Sets of enabled/disabled/terminated/blacklisted extensions. Not owned.
ExtensionRegistry* registry_; raw_ptr<ExtensionRegistry> registry_;
// The associated RendererStartupHelper. Guaranteed to outlive the // The associated RendererStartupHelper. Guaranteed to outlive the
// ExtensionSystem, and thus us. // ExtensionSystem, and thus us.
extensions::RendererStartupHelper* renderer_helper_; raw_ptr<extensions::RendererStartupHelper> renderer_helper_;
// Map of extension ID to CEF extension object. // Map of extension ID to CEF extension object.
ExtensionMap extension_map_; ExtensionMap extension_map_;

View File

@ -6,6 +6,7 @@
#ifndef CEF_LIBCEF_BROWSER_EXTENSIONS_MIME_HANDLER_VIEW_GUEST_DELEGATE_H_ #ifndef CEF_LIBCEF_BROWSER_EXTENSIONS_MIME_HANDLER_VIEW_GUEST_DELEGATE_H_
#define CEF_LIBCEF_BROWSER_EXTENSIONS_MIME_HANDLER_VIEW_GUEST_DELEGATE_H_ #define CEF_LIBCEF_BROWSER_EXTENSIONS_MIME_HANDLER_VIEW_GUEST_DELEGATE_H_
#include "base/memory/raw_ptr.h"
#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest_delegate.h" #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest_delegate.h"
namespace content { namespace content {
@ -34,7 +35,7 @@ class CefMimeHandlerViewGuestDelegate : public MimeHandlerViewGuestDelegate {
const content::ContextMenuParams& params) override; const content::ContextMenuParams& params) override;
private: private:
content::WebContents* owner_web_contents_; raw_ptr<content::WebContents> owner_web_contents_;
}; };
} // namespace extensions } // namespace extensions

View File

@ -10,6 +10,7 @@
#include <memory> #include <memory>
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/memory/raw_ptr.h"
#include "components/value_store/value_store_factory.h" #include "components/value_store/value_store_factory.h"
namespace value_store { namespace value_store {
@ -48,7 +49,7 @@ class CefValueStoreFactory : public ValueStoreFactory {
std::unique_ptr<ValueStore> CreateStore(); std::unique_ptr<ValueStore> CreateStore();
base::FilePath db_path_; base::FilePath db_path_;
ValueStore* last_created_store_ = nullptr; raw_ptr<ValueStore> last_created_store_ = nullptr;
// A mapping from directories to their ValueStore. None of these value // A mapping from directories to their ValueStore. None of these value
// stores are owned by this factory, so care must be taken when calling // stores are owned by this factory, so care must be taken when calling

View File

@ -7,6 +7,7 @@
#include <utility> #include <utility>
#include "base/memory/raw_ptr.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "cef/include/cef_dialog_handler.h" #include "cef/include/cef_dialog_handler.h"
#include "cef/libcef/browser/browser_host_base.h" #include "cef/libcef/browser/browser_host_base.h"
@ -253,8 +254,8 @@ class CefSelectFileDialogListener : public ui::SelectFileDialog::Listener {
delete this; delete this;
} }
ui::SelectFileDialog::Listener* const listener_; const raw_ptr<ui::SelectFileDialog::Listener> listener_;
void* const params_; const raw_ptr<void> params_;
base::OnceClosure callback_; base::OnceClosure callback_;
// Used to avoid re-entrancy from Cancel(). // Used to avoid re-entrancy from Cancel().
@ -488,8 +489,9 @@ CefFileDialogManager::MaybeRunDelegate(
CefRefPtr<CefFileDialogCallbackImpl> callbackImpl( CefRefPtr<CefFileDialogCallbackImpl> callbackImpl(
new CefFileDialogCallbackImpl(std::move(callback))); new CefFileDialogCallbackImpl(std::move(callback)));
const bool handled = handler->OnFileDialog( const bool handled = handler->OnFileDialog(
browser_, static_cast<cef_file_dialog_mode_t>(mode), params.title, browser_.get(), static_cast<cef_file_dialog_mode_t>(mode),
params.default_file_name.value(), accept_filters, callbackImpl.get()); params.title, params.default_file_name.value(), accept_filters,
callbackImpl.get());
if (!handled) { if (!handled) {
// May return nullptr if the client has already executed the callback. // May return nullptr if the client has already executed the callback.
callback = callbackImpl->Disconnect(); callback = callbackImpl->Disconnect();

View File

@ -10,6 +10,7 @@
#include <memory> #include <memory>
#include <set> #include <set>
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h" #include "base/memory/scoped_refptr.h"
#include "cef/include/cef_browser.h" #include "cef/include/cef_browser.h"
#include "third_party/blink/public/mojom/choosers/file_chooser.mojom.h" #include "third_party/blink/public/mojom/choosers/file_chooser.mojom.h"
@ -83,11 +84,11 @@ class CefFileDialogManager {
void SelectFileDoneByListenerCallback(bool listener_destroyed); void SelectFileDoneByListenerCallback(bool listener_destroyed);
// CefBrowserHostBase pointer is guaranteed to outlive this object. // CefBrowserHostBase pointer is guaranteed to outlive this object.
CefBrowserHostBase* const browser_; const raw_ptr<CefBrowserHostBase> browser_;
// Used when running a platform dialog via RunSelectFile. // Used when running a platform dialog via RunSelectFile.
scoped_refptr<ui::SelectFileDialog> dialog_; scoped_refptr<ui::SelectFileDialog> dialog_;
CefSelectFileDialogListener* dialog_listener_ = nullptr; raw_ptr<CefSelectFileDialogListener> dialog_listener_ = nullptr;
// List of all currently active listeners. // List of all currently active listeners.
std::set<ui::SelectFileDialog::Listener*> active_listeners_; std::set<ui::SelectFileDialog::Listener*> active_listeners_;

View File

@ -11,6 +11,7 @@
#include <queue> #include <queue>
#include <string> #include <string>
#include "base/memory/raw_ptr.h"
#include "base/synchronization/lock.h" #include "base/synchronization/lock.h"
#include "cef/include/cef_frame.h" #include "cef/include/cef_frame.h"
#include "cef/libcef/common/mojom/cef.mojom.h" #include "cef/libcef/common/mojom/cef.mojom.h"
@ -195,7 +196,7 @@ class CefFrameHostImpl : public CefFrame, public cef::mojom::BrowserFrame {
std::optional<content::GlobalRenderFrameHostToken> parent_frame_token_; std::optional<content::GlobalRenderFrameHostToken> parent_frame_token_;
// The following members are only accessed on the UI thread. // The following members are only accessed on the UI thread.
content::RenderFrameHost* render_frame_host_ = nullptr; raw_ptr<content::RenderFrameHost> render_frame_host_ = nullptr;
std::queue<std::pair<std::string, RenderFrameAction>> std::queue<std::pair<std::string, RenderFrameAction>>
queued_renderer_actions_; queued_renderer_actions_;

View File

@ -9,6 +9,7 @@
#include "base/functional/bind.h" #include "base/functional/bind.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/threading/thread_checker.h" #include "base/threading/thread_checker.h"
#include "content/public/browser/navigation_handle.h" #include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_frame_host.h"
@ -116,7 +117,7 @@ class FrameServiceBase : public Interface, public WebContentsObserver {
delete this; delete this;
} }
RenderFrameHost* const render_frame_host_ = nullptr; const raw_ptr<RenderFrameHost> render_frame_host_ = nullptr;
const url::Origin origin_; const url::Origin origin_;
mojo::Receiver<Interface> receiver_; mojo::Receiver<Interface> receiver_;
}; };

View File

@ -4,6 +4,7 @@
#include "cef/libcef/browser/hang_monitor.h" #include "cef/libcef/browser/hang_monitor.h"
#include "base/memory/raw_ptr.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "cef/include/cef_client.h" #include "cef/include/cef_client.h"
#include "cef/libcef/browser/browser_host_base.h" #include "cef/libcef/browser/browser_host_base.h"
@ -87,7 +88,7 @@ class CefUnresponsiveProcessCallbackImpl
} }
} }
content::RenderWidgetHost* render_widget_host_; raw_ptr<content::RenderWidgetHost> render_widget_host_;
base::RepeatingClosure hang_monitor_restarter_; base::RepeatingClosure hang_monitor_restarter_;
IMPLEMENT_REFCOUNTING(CefUnresponsiveProcessCallbackImpl); IMPLEMENT_REFCOUNTING(CefUnresponsiveProcessCallbackImpl);

View File

@ -124,7 +124,7 @@ void CefJavaScriptDialogManager::RunJavaScriptDialog(
// Execute the user callback. // Execute the user callback.
bool handled = handler->OnJSDialog( bool handled = handler->OnJSDialog(
browser_, origin_url.spec(), browser_.get(), origin_url.spec(),
static_cast<cef_jsdialog_type_t>(message_type), message_text, static_cast<cef_jsdialog_type_t>(message_type), message_text,
default_prompt_text, callbackPtr.get(), *did_suppress_message); default_prompt_text, callbackPtr.get(), *did_suppress_message);
if (handled) { if (handled) {
@ -206,7 +206,7 @@ void CefJavaScriptDialogManager::RunBeforeUnloadDialog(
// Execute the user callback. // Execute the user callback.
bool handled = handler->OnBeforeUnloadDialog( bool handled = handler->OnBeforeUnloadDialog(
browser_, message_text, is_reload, callbackPtr.get()); browser_.get(), message_text, is_reload, callbackPtr.get());
if (handled) { if (handled) {
return; return;
} }
@ -281,7 +281,7 @@ void CefJavaScriptDialogManager::CancelDialogs(
bool reset_state) { bool reset_state) {
if (handler_) { if (handler_) {
if (reset_state) { if (reset_state) {
handler_->OnResetDialogState(browser_); handler_->OnResetDialogState(browser_.get());
} }
handler_ = nullptr; handler_ = nullptr;
return; return;
@ -314,7 +314,7 @@ void CefJavaScriptDialogManager::DialogClosed(
bool success, bool success,
const std::u16string& user_input) { const std::u16string& user_input) {
if (handler_) { if (handler_) {
handler_->OnDialogClosed(browser_); handler_->OnDialogClosed(browser_.get());
// Call OnResetDialogState. // Call OnResetDialogState.
CancelDialogs(/*web_contents=*/nullptr, /*reset_state=*/true); CancelDialogs(/*web_contents=*/nullptr, /*reset_state=*/true);
} }

View File

@ -10,6 +10,7 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "cef/include/cef_jsdialog_handler.h" #include "cef/include/cef_jsdialog_handler.h"
#include "cef/libcef/browser/javascript_dialog_runner.h" #include "cef/libcef/browser/javascript_dialog_runner.h"
@ -60,7 +61,7 @@ class CefJavaScriptDialogManager : public content::JavaScriptDialogManager {
bool CanUseChromeDialogs() const; bool CanUseChromeDialogs() const;
// CefBrowserHostBase pointer is guaranteed to outlive this object. // CefBrowserHostBase pointer is guaranteed to outlive this object.
CefBrowserHostBase* const browser_; const raw_ptr<CefBrowserHostBase> browser_;
CefRefPtr<CefJSDialogHandler> handler_; CefRefPtr<CefJSDialogHandler> handler_;

View File

@ -9,6 +9,7 @@
#include "base/base_switches.h" #include "base/base_switches.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/debug/debugger.h" #include "base/debug/debugger.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/sequence_checker.h" #include "base/sequence_checker.h"
#include "base/synchronization/lock.h" #include "base/synchronization/lock.h"
@ -236,7 +237,7 @@ class CefUIThread : public base::PlatformThread::Delegate {
#endif #endif
} }
CefMainRunner* const runner_; const raw_ptr<CefMainRunner> runner_;
base::OnceClosure setup_callback_; base::OnceClosure setup_callback_;
base::OnceClosure shutdown_callback_; base::OnceClosure shutdown_callback_;

View File

@ -4,6 +4,7 @@
#include "cef/libcef/browser/media_router/media_router_manager.h" #include "cef/libcef/browser/media_router/media_router_manager.h"
#include "base/memory/raw_ptr.h"
#include "cef/libcef/browser/browser_context.h" #include "cef/libcef/browser/browser_context.h"
#include "cef/libcef/browser/thread_util.h" #include "cef/libcef/browser/thread_util.h"
#include "components/media_router/browser/media_router_factory.h" #include "components/media_router/browser/media_router_factory.h"
@ -34,7 +35,7 @@ class CefMediaRoutesObserver : public media_router::MediaRoutesObserver {
} }
private: private:
CefMediaRouterManager* const manager_; const raw_ptr<CefMediaRouterManager> manager_;
}; };
// Used to receive messages if PresentationConnection is not supported. // Used to receive messages if PresentationConnection is not supported.
@ -61,7 +62,7 @@ class CefPresentationConnectionMessageObserver
} }
private: private:
CefMediaRouterManager* const manager_; const raw_ptr<CefMediaRouterManager> manager_;
const media_router::MediaRoute route_; const media_router::MediaRoute route_;
}; };
@ -118,7 +119,7 @@ class CefPresentationConnection : public blink::mojom::PresentationConnection {
} }
private: private:
CefMediaRouterManager* const manager_; const raw_ptr<CefMediaRouterManager> manager_;
const media_router::MediaRoute route_; const media_router::MediaRoute route_;
// Used to receive messages from the MRP. // Used to receive messages from the MRP.

View File

@ -6,6 +6,7 @@
#define CEF_LIBCEF_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MANAGER_H_ #define CEF_LIBCEF_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MANAGER_H_
#pragma once #pragma once
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/observer_list.h" #include "base/observer_list.h"
#include "cef/include/cef_media_router.h" #include "cef/include/cef_media_router.h"
@ -107,7 +108,7 @@ class CefMediaRouterManager
RouteState* GetRouteState(const media_router::MediaRoute::Id& route_id); RouteState* GetRouteState(const media_router::MediaRoute::Id& route_id);
void RemoveRouteState(const media_router::MediaRoute::Id& route_id); void RemoveRouteState(const media_router::MediaRoute::Id& route_id);
content::BrowserContext* const browser_context_; const raw_ptr<content::BrowserContext> browser_context_;
base::ObserverList<Observer> observers_; base::ObserverList<Observer> observers_;

View File

@ -105,7 +105,7 @@ void CefMediaStreamRegistrar::NotifyMediaStreamChange() {
if (auto client = browser_->GetClient()) { if (auto client = browser_->GetClient()) {
if (auto handler = client->GetDisplayHandler()) { if (auto handler = client->GetDisplayHandler()) {
handler->OnMediaAccessChange(browser_, video, audio); handler->OnMediaAccessChange(browser_.get(), video, audio);
} }
} }
} }

View File

@ -10,6 +10,7 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "content/public/browser/media_stream_request.h" #include "content/public/browser/media_stream_request.h"
@ -37,7 +38,7 @@ class CefMediaStreamRegistrar {
void NotifyMediaStreamChange(); void NotifyMediaStreamChange();
// Guaranteed to outlive this object. // Guaranteed to outlive this object.
CefBrowserHostBase* const browser_; const raw_ptr<CefBrowserHostBase> browser_;
struct MediaStreamInfo { struct MediaStreamInfo {
bool video; bool video;

View File

@ -151,7 +151,7 @@ bool CefMenuManager::CreateContextMenu(
new CefContextMenuParamsImpl(&params_)); new CefContextMenuParamsImpl(&params_));
CefRefPtr<CefFrame> frame = browser_->GetFocusedFrame(); CefRefPtr<CefFrame> frame = browser_->GetFocusedFrame();
handler->OnBeforeContextMenu(browser_, frame, paramsPtr.get(), handler->OnBeforeContextMenu(browser_.get(), frame, paramsPtr.get(),
model_.get()); model_.get());
MenuWillShow(model_); MenuWillShow(model_);
@ -166,7 +166,7 @@ bool CefMenuManager::CreateContextMenu(
// the callback object is deleted. // the callback object is deleted.
custom_menu_callback_ = callbackImpl.get(); custom_menu_callback_ = callbackImpl.get();
if (handler->RunContextMenu(browser_, frame, paramsPtr.get(), if (handler->RunContextMenu(browser_.get(), frame, paramsPtr.get(),
model_.get(), callbackImpl.get())) { model_.get(), callbackImpl.get())) {
custom_menu = true; custom_menu = true;
} else { } else {
@ -224,8 +224,8 @@ void CefMenuManager::ExecuteCommand(CefRefPtr<CefMenuModelImpl> source,
new CefContextMenuParamsImpl(&params_)); new CefContextMenuParamsImpl(&params_));
bool handled = handler->OnContextMenuCommand( bool handled = handler->OnContextMenuCommand(
browser_, browser_->GetFocusedFrame(), paramsPtr.get(), command_id, browser_.get(), browser_->GetFocusedFrame(), paramsPtr.get(),
event_flags); command_id, event_flags);
// Do not keep references to the parameters in the callback. // Do not keep references to the parameters in the callback.
std::ignore = paramsPtr->Detach(nullptr); std::ignore = paramsPtr->Detach(nullptr);
@ -277,7 +277,8 @@ void CefMenuManager::MenuClosed(CefRefPtr<CefMenuModelImpl> source) {
if (client.get()) { if (client.get()) {
CefRefPtr<CefContextMenuHandler> handler = client->GetContextMenuHandler(); CefRefPtr<CefContextMenuHandler> handler = client->GetContextMenuHandler();
if (handler.get()) { if (handler.get()) {
handler->OnContextMenuDismissed(browser_, browser_->GetFocusedFrame()); handler->OnContextMenuDismissed(browser_.get(),
browser_->GetFocusedFrame());
} }
} }

View File

@ -6,6 +6,7 @@
#define CEF_LIBCEF_BROWSER_MENU_MANAGER_H_ #define CEF_LIBCEF_BROWSER_MENU_MANAGER_H_
#pragma once #pragma once
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "cef/libcef/browser/menu_model_impl.h" #include "cef/libcef/browser/menu_model_impl.h"
#include "cef/libcef/browser/menu_runner.h" #include "cef/libcef/browser/menu_runner.h"
@ -62,7 +63,7 @@ class CefMenuManager : public CefMenuModelImpl::Delegate,
bool IsCustomContextMenuCommand(int command_id); bool IsCustomContextMenuCommand(int command_id);
// AlloyBrowserHostImpl pointer is guaranteed to outlive this object. // AlloyBrowserHostImpl pointer is guaranteed to outlive this object.
AlloyBrowserHostImpl* browser_; raw_ptr<AlloyBrowserHostImpl> browser_;
std::unique_ptr<CefMenuRunner> runner_; std::unique_ptr<CefMenuRunner> runner_;
@ -70,7 +71,7 @@ class CefMenuManager : public CefMenuModelImpl::Delegate,
content::ContextMenuParams params_; content::ContextMenuParams params_;
// Not owned by this class. // Not owned by this class.
CefRunContextMenuCallback* custom_menu_callback_ = nullptr; raw_ptr<CefRunContextMenuCallback> custom_menu_callback_ = nullptr;
// Must be the last member. // Must be the last member.
base::WeakPtrFactory<CefMenuManager> weak_ptr_factory_; base::WeakPtrFactory<CefMenuManager> weak_ptr_factory_;

View File

@ -10,6 +10,7 @@
#include "base/functional/bind.h" #include "base/functional/bind.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "cef/libcef/browser/thread_util.h" #include "cef/libcef/browser/thread_util.h"
#include "cef/libcef/common/task_runner_impl.h" #include "cef/libcef/common/task_runner_impl.h"
#include "third_party/blink/public/mojom/context_menu/context_menu.mojom.h" #include "third_party/blink/public/mojom/context_menu/context_menu.mojom.h"
@ -169,7 +170,7 @@ class CefSimpleMenuModel : public ui::MenuModel {
void MenuWillClose() override { impl_->MenuWillClose(); } void MenuWillClose() override { impl_->MenuWillClose(); }
private: private:
CefMenuModelImpl* impl_; raw_ptr<CefMenuModelImpl> impl_;
}; };
cef_menu_color_type_t GetMenuColorType(bool is_text, cef_menu_color_type_t GetMenuColorType(bool is_text,

View File

@ -9,6 +9,7 @@
#include <vector> #include <vector>
#include "base/memory/raw_ptr.h"
#include "base/threading/platform_thread.h" #include "base/threading/platform_thread.h"
#include "cef/include/cef_menu_model.h" #include "cef/include/cef_menu_model.h"
#include "cef/include/cef_menu_model_delegate.h" #include "cef/include/cef_menu_model_delegate.h"
@ -213,7 +214,7 @@ class CefMenuModelImpl : public CefMenuModel {
base::PlatformThreadId supported_thread_id_; base::PlatformThreadId supported_thread_id_;
// Used when created via CefMenuManager. // Used when created via CefMenuManager.
Delegate* delegate_; raw_ptr<Delegate> delegate_;
// Used when created via CefMenuModel::CreateMenuModel(). // Used when created via CefMenuModel::CreateMenuModel().
CefRefPtr<CefMenuModelDelegate> menu_model_delegate_; CefRefPtr<CefMenuModelDelegate> menu_model_delegate_;

View File

@ -5,6 +5,7 @@
#ifndef CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_H_ #ifndef CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_H_
#define CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_H_ #define CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_H_
#include "base/memory/raw_ptr.h"
#include "cef/libcef/browser/alloy/browser_platform_delegate_alloy.h" #include "cef/libcef/browser/alloy/browser_platform_delegate_alloy.h"
// Base implementation of native browser functionality. // Base implementation of native browser functionality.
@ -70,7 +71,7 @@ class CefBrowserPlatformDelegateNative
const SkColor background_color_; const SkColor background_color_;
// Not owned by this object. // Not owned by this object.
WindowlessHandler* windowless_handler_ = nullptr; raw_ptr<WindowlessHandler> windowless_handler_ = nullptr;
}; };
#endif // CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_H_ #endif // CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_H_

View File

@ -5,6 +5,7 @@
#ifndef CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_AURA_H_ #ifndef CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_AURA_H_
#define CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_AURA_H_ #define CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_AURA_H_
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "cef/libcef/browser/native/browser_platform_delegate_native.h" #include "cef/libcef/browser/native/browser_platform_delegate_native.h"
#include "ui/events/event.h" #include "ui/events/event.h"
@ -79,7 +80,7 @@ class CefBrowserPlatformDelegateNativeAura
// Widget hosting the web contents. It will be deleted automatically when the // Widget hosting the web contents. It will be deleted automatically when the
// associated root window is destroyed. // associated root window is destroyed.
views::Widget* window_widget_ = nullptr; raw_ptr<views::Widget> window_widget_ = nullptr;
private: private:
// Will only be called if the Widget is deleted before // Will only be called if the Widget is deleted before

View File

@ -65,7 +65,7 @@ bool CefBrowserPlatformDelegateNativeLinux::CreateHostWindow() {
// Create a new window object. It will delete itself when the associated X11 // Create a new window object. It will delete itself when the associated X11
// window is destroyed. // window is destroyed.
window_x11_ = window_x11_ =
new CefWindowX11(browser_, parent_window, rect, new CefWindowX11(browser_.get(), parent_window, rect,
CefString(&window_info_.window_name).ToString()); CefString(&window_info_.window_name).ToString());
DCHECK_NE(window_x11_->xwindow(), x11::Window::None); DCHECK_NE(window_x11_->xwindow(), x11::Window::None);
window_info_.window = window_info_.window =

View File

@ -5,6 +5,7 @@
#ifndef CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_LINUX_H_ #ifndef CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_LINUX_H_
#define CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_LINUX_H_ #define CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_LINUX_H_
#include "base/memory/raw_ptr.h"
#include "cef/libcef/browser/native/browser_platform_delegate_native_aura.h" #include "cef/libcef/browser/native/browser_platform_delegate_native_aura.h"
#include "ui/base/ozone_buildflags.h" #include "ui/base/ozone_buildflags.h"
@ -44,7 +45,7 @@ class CefBrowserPlatformDelegateNativeLinux
bool host_window_created_ = false; bool host_window_created_ = false;
#if BUILDFLAG(IS_OZONE_X11) #if BUILDFLAG(IS_OZONE_X11)
CefWindowX11* window_x11_ = nullptr; raw_ptr<CefWindowX11> window_x11_ = nullptr;
#endif #endif
}; };

View File

@ -74,7 +74,7 @@ void CefWindowDelegateView::Init(gfx::AcceleratedWidget parent_widget,
void CefWindowDelegateView::InitContent() { void CefWindowDelegateView::InitContent() {
SetBackground(views::CreateSolidBackground(background_color_)); SetBackground(views::CreateSolidBackground(background_color_));
SetLayoutManager(std::make_unique<views::FillLayout>()); SetLayoutManager(std::make_unique<views::FillLayout>());
AddChildView(web_view_); AddChildView(web_view_.get());
} }
void CefWindowDelegateView::DeleteDelegate() { void CefWindowDelegateView::DeleteDelegate() {

View File

@ -6,6 +6,7 @@
#define CEF_LIBCEF_BROWSER_NATIVE_WINDOW_DELEGATE_VIEW_H_ #define CEF_LIBCEF_BROWSER_NATIVE_WINDOW_DELEGATE_VIEW_H_
#pragma once #pragma once
#include "base/memory/raw_ptr.h"
#include "ui/views/widget/widget_delegate.h" #include "ui/views/widget/widget_delegate.h"
namespace content { namespace content {
@ -54,7 +55,7 @@ class CefWindowDelegateView : public views::WidgetDelegateView {
base::RepeatingClosure on_bounds_changed_; base::RepeatingClosure on_bounds_changed_;
base::OnceClosure on_delete_; base::OnceClosure on_delete_;
views::WebView* web_view_ = nullptr; raw_ptr<views::WebView> web_view_ = nullptr;
}; };
#endif // CEF_LIBCEF_BROWSER_NATIVE_WINDOW_DELEGATE_VIEW_H_ #endif // CEF_LIBCEF_BROWSER_NATIVE_WINDOW_DELEGATE_VIEW_H_

View File

@ -7,6 +7,7 @@
#define CEF_LIBCEF_BROWSER_NATIVE_WINDOW_X11_H_ #define CEF_LIBCEF_BROWSER_NATIVE_WINDOW_X11_H_
#pragma once #pragma once
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "cef/include/internal/cef_ptr.h" #include "cef/include/internal/cef_ptr.h"
#include "ui/events/platform/platform_event_dispatcher.h" #include "ui/events/platform/platform_event_dispatcher.h"
@ -70,7 +71,7 @@ class CefWindowX11 : public ui::PlatformEventDispatcher,
CefRefPtr<CefBrowserHostBase> browser_; CefRefPtr<CefBrowserHostBase> browser_;
// The display and the native X window hosting the root window. // The display and the native X window hosting the root window.
x11::Connection* const connection_; const raw_ptr<x11::Connection> connection_;
x11::Window parent_xwindow_; x11::Window parent_xwindow_;
x11::Window xwindow_; x11::Window xwindow_;

View File

@ -15,6 +15,7 @@
#include "base/lazy_instance.h" #include "base/lazy_instance.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted_memory.h" #include "base/memory/ref_counted_memory.h"
#include "base/path_service.h" #include "base/path_service.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
@ -504,7 +505,7 @@ class CefURLDataSource : public content::URLDataSource {
private: private:
const std::string host_; const std::string host_;
const ChromeHostId host_id_; const ChromeHostId host_id_;
Profile* const profile_; const raw_ptr<Profile> profile_;
std::string mime_type_; std::string mime_type_;
scoped_refptr<base::RefCountedString> output_; scoped_refptr<base::RefCountedString> output_;

View File

@ -9,6 +9,7 @@
#include "base/barrier_closure.h" #include "base/barrier_closure.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "cef/libcef/browser/context.h" #include "cef/libcef/browser/context.h"
#include "cef/libcef/browser/origin_whitelist_impl.h" #include "cef/libcef/browser/origin_whitelist_impl.h"
@ -324,7 +325,7 @@ class InterceptedRequest : public network::mojom::URLLoader,
void OnUploadProgressACK(); void OnUploadProgressACK();
ProxyURLLoaderFactory* const factory_; const raw_ptr<ProxyURLLoaderFactory> factory_;
const int32_t id_; const int32_t id_;
const uint32_t options_; const uint32_t options_;
bool input_stream_previously_failed_ = false; bool input_stream_previously_failed_ = false;
@ -373,7 +374,7 @@ class InterceptedRequest : public network::mojom::URLLoader,
mojo::Receiver<network::mojom::TrustedHeaderClient> header_client_receiver_{ mojo::Receiver<network::mojom::TrustedHeaderClient> header_client_receiver_{
this}; this};
StreamReaderURLLoader* stream_loader_ = nullptr; raw_ptr<StreamReaderURLLoader> stream_loader_ = nullptr;
base::WeakPtrFactory<InterceptedRequest> weak_factory_; base::WeakPtrFactory<InterceptedRequest> weak_factory_;
}; };

View File

@ -4,6 +4,7 @@
#include "cef/libcef/browser/net_service/resource_handler_wrapper.h" #include "cef/libcef/browser/net_service/resource_handler_wrapper.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "cef/libcef/browser/net_service/proxy_url_loader_factory.h" #include "cef/libcef/browser/net_service/proxy_url_loader_factory.h"
#include "cef/libcef/browser/thread_util.h" #include "cef/libcef/browser/thread_util.h"
@ -224,7 +225,7 @@ class ReadResponseCallbackWrapper : public CefCallback {
} }
scoped_refptr<HandlerProvider> handler_provider_; scoped_refptr<HandlerProvider> handler_provider_;
net::IOBuffer* const dest_; const raw_ptr<net::IOBuffer> dest_;
int length_; int length_;
CefRefPtr<ReadCallbackWrapper> callback_; CefRefPtr<ReadCallbackWrapper> callback_;

View File

@ -6,6 +6,7 @@
#include <memory> #include <memory>
#include "base/memory/raw_ptr.h"
#include "cef/libcef/browser/browser_host_base.h" #include "cef/libcef/browser/browser_host_base.h"
#include "cef/libcef/browser/context.h" #include "cef/libcef/browser/context.h"
#include "cef/libcef/browser/iothread_state.h" #include "cef/libcef/browser/iothread_state.h"
@ -142,7 +143,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
} }
const int32_t id_; const int32_t id_;
network::ResourceRequest* const request_; const raw_ptr<network::ResourceRequest> request_;
const bool request_was_redirected_; const bool request_was_redirected_;
OnBeforeRequestResultCallback callback_; OnBeforeRequestResultCallback callback_;
CancelRequestCallback cancel_callback_; CancelRequestCallback cancel_callback_;
@ -357,7 +358,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
} }
base::Lock lock_; base::Lock lock_;
InterceptedRequestHandlerWrapper* wrapper_; raw_ptr<InterceptedRequestHandlerWrapper> wrapper_;
}; };
InterceptedRequestHandlerWrapper() InterceptedRequestHandlerWrapper()

View File

@ -176,7 +176,7 @@ gfx::Point CefBrowserPlatformDelegateOsr::GetScreenPoint(
CefRefPtr<CefRenderHandler> handler = browser_->client()->GetRenderHandler(); CefRefPtr<CefRenderHandler> handler = browser_->client()->GetRenderHandler();
if (handler.get()) { if (handler.get()) {
int screenX = 0, screenY = 0; int screenX = 0, screenY = 0;
if (handler->GetScreenPoint(browser_, view.x(), view.y(), screenX, if (handler->GetScreenPoint(browser_.get(), view.x(), view.y(), screenX,
screenY)) { screenY)) {
gfx::Point screen_point(screenX, screenY); gfx::Point screen_point(screenX, screenY);
#if !BUILDFLAG(IS_MAC) #if !BUILDFLAG(IS_MAC)
@ -537,7 +537,7 @@ void CefBrowserPlatformDelegateOsr::StartDragging(
drag_data->SetReadOnly(true); drag_data->SetReadOnly(true);
base::CurrentThread::ScopedAllowApplicationTasksInNativeNestedLoop allow; base::CurrentThread::ScopedAllowApplicationTasksInNativeNestedLoop allow;
handled = handler->StartDragging( handled = handler->StartDragging(
browser_, drag_data.get(), browser_.get(), drag_data.get(),
static_cast<CefRenderHandler::DragOperationsMask>(allowed_ops), static_cast<CefRenderHandler::DragOperationsMask>(allowed_ops),
event_info.location.x(), event_info.location.y()); event_info.location.x(), event_info.location.y());
} }
@ -556,7 +556,8 @@ void CefBrowserPlatformDelegateOsr::UpdateDragOperation(
browser_->GetClient()->GetRenderHandler(); browser_->GetClient()->GetRenderHandler();
if (handler.get()) { if (handler.get()) {
handler->UpdateDragCursor( handler->UpdateDragCursor(
browser_, static_cast<CefRenderHandler::DragOperation>(operation)); browser_.get(),
static_cast<CefRenderHandler::DragOperation>(operation));
} }
} }

View File

@ -5,6 +5,7 @@
#ifndef CEF_LIBCEF_BROWSER_OSR_BROWSER_PLATFORM_DELEGATE_OSR_H_ #ifndef CEF_LIBCEF_BROWSER_OSR_BROWSER_PLATFORM_DELEGATE_OSR_H_
#define CEF_LIBCEF_BROWSER_OSR_BROWSER_PLATFORM_DELEGATE_OSR_H_ #define CEF_LIBCEF_BROWSER_OSR_BROWSER_PLATFORM_DELEGATE_OSR_H_
#include "base/memory/raw_ptr.h"
#include "cef/libcef/browser/alloy/browser_platform_delegate_alloy.h" #include "cef/libcef/browser/alloy/browser_platform_delegate_alloy.h"
#include "cef/libcef/browser/native/browser_platform_delegate_native.h" #include "cef/libcef/browser/native/browser_platform_delegate_native.h"
@ -113,7 +114,8 @@ class CefBrowserPlatformDelegateOsr
const bool use_shared_texture_; const bool use_shared_texture_;
const bool use_external_begin_frame_; const bool use_external_begin_frame_;
CefWebContentsViewOSR* view_osr_ = nullptr; // Not owned by this class. // Not owned by this class.
raw_ptr<CefWebContentsViewOSR> view_osr_ = nullptr;
// Pending drag/drop data. // Pending drag/drop data.
CefRefPtr<CefDragData> drag_data_; CefRefPtr<CefDragData> drag_data_;
@ -126,7 +128,7 @@ class CefBrowserPlatformDelegateOsr
// We also keep track of the RenderViewHost we're dragging over to avoid // We also keep track of the RenderViewHost we're dragging over to avoid
// sending the drag exited message after leaving the current // sending the drag exited message after leaving the current
// view. |current_rvh_for_drag_| should not be dereferenced. // view. |current_rvh_for_drag_| should not be dereferenced.
void* current_rvh_for_drag_ = nullptr; raw_ptr<void> current_rvh_for_drag_ = nullptr;
// We keep track of the RenderWidgetHost from which the current drag started, // We keep track of the RenderWidgetHost from which the current drag started,
// in order to properly route the drag end message to it. // in order to properly route the drag end message to it.

View File

@ -6,6 +6,7 @@
#include <utility> #include <utility>
#include "base/memory/raw_ptr.h"
#include "base/memory/shared_memory_mapping.h" #include "base/memory/shared_memory_mapping.h"
#include "cef/libcef/browser/osr/render_widget_host_view_osr.h" #include "cef/libcef/browser/osr/render_widget_host_view_osr.h"
#include "components/viz/common/resources/resource_sizes.h" #include "components/viz/common/resources/resource_sizes.h"
@ -43,7 +44,7 @@ class CefLayeredWindowUpdaterOSR : public viz::mojom::LayeredWindowUpdater {
void Draw(const gfx::Rect& damage_rect, DrawCallback draw_callback) override; void Draw(const gfx::Rect& damage_rect, DrawCallback draw_callback) override;
private: private:
CefRenderWidgetHostViewOSR* const view_; const raw_ptr<CefRenderWidgetHostViewOSR> view_;
mojo::Receiver<viz::mojom::LayeredWindowUpdater> receiver_; mojo::Receiver<viz::mojom::LayeredWindowUpdater> receiver_;
bool active_ = false; bool active_ = false;
base::WritableSharedMemoryMapping shared_memory_; base::WritableSharedMemoryMapping shared_memory_;

View File

@ -8,6 +8,7 @@
#include <memory> #include <memory>
#include "base/functional/callback.h" #include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/shared_memory_mapping.h" #include "base/memory/shared_memory_mapping.h"
#include "components/viz/host/host_display_client.h" #include "components/viz/host/host_display_client.h"
#include "ui/gfx/native_widget_types.h" #include "ui/gfx/native_widget_types.h"
@ -41,7 +42,7 @@ class CefHostDisplayClientOSR : public viz::HostDisplayClient {
void DidCompleteSwapWithNewSize(const gfx::Size& size) override; void DidCompleteSwapWithNewSize(const gfx::Size& size) override;
#endif #endif
CefRenderWidgetHostViewOSR* const view_; const raw_ptr<CefRenderWidgetHostViewOSR> view_;
std::unique_ptr<CefLayeredWindowUpdaterOSR> layered_window_updater_; std::unique_ptr<CefLayeredWindowUpdaterOSR> layered_window_updater_;
bool active_ = false; bool active_ = false;
}; };

View File

@ -13,6 +13,7 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/functional/callback_helpers.h" #include "base/functional/callback_helpers.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "cc/base/switches.h" #include "cc/base/switches.h"
#include "cef/libcef/browser/alloy/alloy_browser_host_impl.h" #include "cef/libcef/browser/alloy/alloy_browser_host_impl.h"
@ -126,7 +127,7 @@ class CefDelegatedFrameHostClient : public content::DelegatedFrameHostClient {
bool ShouldShowStaleContentOnEviction() override { return false; } bool ShouldShowStaleContentOnEviction() override { return false; }
private: private:
CefRenderWidgetHostViewOSR* const view_; const raw_ptr<CefRenderWidgetHostViewOSR> view_;
}; };
ui::GestureProvider::Config CreateGestureProviderConfig() { ui::GestureProvider::Config CreateGestureProviderConfig() {
@ -1034,7 +1035,7 @@ CefRenderWidgetHostViewOSR::CreateHostDisplayClient() {
host_display_client_ = host_display_client_ =
new CefHostDisplayClientOSR(this, gfx::kNullAcceleratedWidget); new CefHostDisplayClientOSR(this, gfx::kNullAcceleratedWidget);
host_display_client_->SetActive(true); host_display_client_->SetActive(true);
return base::WrapUnique(host_display_client_); return base::WrapUnique(host_display_client_.get());
} }
bool CefRenderWidgetHostViewOSR::InstallTransparency() { bool CefRenderWidgetHostViewOSR::InstallTransparency() {

View File

@ -11,6 +11,7 @@
#include <set> #include <set>
#include <vector> #include <vector>
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "cc/layers/deadline_policy.h" #include "cc/layers/deadline_policy.h"
@ -407,7 +408,7 @@ class CefRenderWidgetHostViewOSR
bool external_begin_frame_enabled_ = false; bool external_begin_frame_enabled_ = false;
bool needs_external_begin_frames_ = false; bool needs_external_begin_frames_ = false;
CefHostDisplayClientOSR* host_display_client_ = nullptr; raw_ptr<CefHostDisplayClientOSR> host_display_client_ = nullptr;
std::unique_ptr<CefVideoConsumerOSR> video_consumer_; std::unique_ptr<CefVideoConsumerOSR> video_consumer_;
bool hold_resize_ = false; bool hold_resize_ = false;
@ -418,12 +419,12 @@ class CefRenderWidgetHostViewOSR
// The associated Model. While |this| is being Destroyed, // The associated Model. While |this| is being Destroyed,
// |render_widget_host_| is NULL and the message loop is run one last time // |render_widget_host_| is NULL and the message loop is run one last time
// Message handlers must check for a NULL |render_widget_host_|. // Message handlers must check for a NULL |render_widget_host_|.
content::RenderWidgetHostImpl* render_widget_host_; raw_ptr<content::RenderWidgetHostImpl> render_widget_host_;
bool has_parent_; bool has_parent_;
CefRenderWidgetHostViewOSR* parent_host_view_; raw_ptr<CefRenderWidgetHostViewOSR> parent_host_view_;
CefRenderWidgetHostViewOSR* popup_host_view_ = nullptr; raw_ptr<CefRenderWidgetHostViewOSR> popup_host_view_ = nullptr;
CefRenderWidgetHostViewOSR* child_host_view_ = nullptr; raw_ptr<CefRenderWidgetHostViewOSR> child_host_view_ = nullptr;
std::set<CefRenderWidgetHostViewOSR*> guest_host_views_; std::set<CefRenderWidgetHostViewOSR*> guest_host_views_;
CefRefPtr<AlloyBrowserHostImpl> browser_impl_; CefRefPtr<AlloyBrowserHostImpl> browser_impl_;

View File

@ -4,6 +4,7 @@
#include <optional> #include <optional>
#include "base/functional/callback.h" #include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "components/viz/host/client_frame_sink_video_capturer.h" #include "components/viz/host/client_frame_sink_video_capturer.h"
#include "media/capture/mojom/video_capture_types.mojom.h" #include "media/capture/mojom/video_capture_types.mojom.h"
@ -40,7 +41,7 @@ class CefVideoConsumerOSR : public viz::mojom::FrameSinkVideoConsumer {
const bool use_shared_texture_; const bool use_shared_texture_;
CefRenderWidgetHostViewOSR* const view_; const raw_ptr<CefRenderWidgetHostViewOSR> view_;
std::unique_ptr<viz::ClientFrameSinkVideoCapturer> video_capturer_; std::unique_ptr<viz::ClientFrameSinkVideoCapturer> video_capturer_;
gfx::Size size_in_pixels_; gfx::Size size_in_pixels_;

View File

@ -6,6 +6,7 @@
#ifndef CEF_LIBCEF_BROWSER_OSR_WEB_CONTENTS_VIEW_OSR_H_ #ifndef CEF_LIBCEF_BROWSER_OSR_WEB_CONTENTS_VIEW_OSR_H_
#define CEF_LIBCEF_BROWSER_OSR_WEB_CONTENTS_VIEW_OSR_H_ #define CEF_LIBCEF_BROWSER_OSR_WEB_CONTENTS_VIEW_OSR_H_
#include "base/memory/raw_ptr.h"
#include "content/browser/renderer_host/render_view_host_delegate_view.h" #include "content/browser/renderer_host/render_view_host_delegate_view.h"
#include "content/browser/web_contents/web_contents_view.h" #include "content/browser/web_contents/web_contents_view.h"
#include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkColor.h"
@ -97,7 +98,7 @@ class CefWebContentsViewOSR : public content::WebContentsView,
const bool use_shared_texture_; const bool use_shared_texture_;
const bool use_external_begin_frame_; const bool use_external_begin_frame_;
content::WebContents* web_contents_ = nullptr; raw_ptr<content::WebContents> web_contents_ = nullptr;
}; };
#endif // CEF_LIBCEF_BROWSER_OSR_WEB_CONTENTS_VIEW_OSR_H_ #endif // CEF_LIBCEF_BROWSER_OSR_WEB_CONTENTS_VIEW_OSR_H_

View File

@ -4,6 +4,7 @@
#include "cef/libcef/browser/prefs/pref_registrar.h" #include "cef/libcef/browser/prefs/pref_registrar.h"
#include "base/memory/raw_ptr.h"
#include "cef/include/cef_app.h" #include "cef/include/cef_app.h"
#include "cef/include/cef_browser_process_handler.h" #include "cef/include/cef_browser_process_handler.h"
#include "cef/include/cef_preference.h" #include "cef/include/cef_preference.h"
@ -77,7 +78,7 @@ class CefPreferenceRegistrarImpl : public CefPreferenceRegistrar {
} }
} }
PrefRegistrySimple* const registry_; const raw_ptr<PrefRegistrySimple> registry_;
}; };
} // namespace } // namespace

View File

@ -7,6 +7,7 @@
#define LIBCEF_BROWSER_PRINTING_PRINT_DIALOG_LINUX_H_ #define LIBCEF_BROWSER_PRINTING_PRINT_DIALOG_LINUX_H_
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/task/sequenced_task_runner_helpers.h" #include "base/task/sequenced_task_runner_helpers.h"
#include "cef/include/cef_print_handler.h" #include "cef/include/cef_print_handler.h"
@ -40,7 +41,7 @@ class CefPrintingContextLinuxDelegate
void SetDefaultDelegate(ui::PrintingContextLinuxDelegate* delegate); void SetDefaultDelegate(ui::PrintingContextLinuxDelegate* delegate);
private: private:
ui::PrintingContextLinuxDelegate* default_delegate_ = nullptr; raw_ptr<ui::PrintingContextLinuxDelegate> default_delegate_ = nullptr;
}; };
// Needs to be freed on the UI thread to clean up its member variables. // Needs to be freed on the UI thread to clean up its member variables.
@ -99,7 +100,7 @@ class CefPrintDialogLinux : public printing::PrintDialogLinuxInterface,
// Printing dialog callback. // Printing dialog callback.
PrintingContextLinux::PrintSettingsCallback callback_; PrintingContextLinux::PrintSettingsCallback callback_;
PrintingContextLinux* context_; raw_ptr<PrintingContextLinux> context_;
CefRefPtr<CefBrowserHostBase> browser_; CefRefPtr<CefBrowserHostBase> browser_;
CefRefPtr<CefPrintHandler> handler_; CefRefPtr<CefPrintHandler> handler_;

View File

@ -6,6 +6,7 @@
#define CEF_LIBCEF_BROWSER_REQUEST_CONTEXT_IMPL_H_ #define CEF_LIBCEF_BROWSER_REQUEST_CONTEXT_IMPL_H_
#pragma once #pragma once
#include "base/memory/raw_ptr.h"
#include "cef/include/cef_request_context.h" #include "cef/include/cef_request_context.h"
#include "cef/libcef/browser/browser_context.h" #include "cef/libcef/browser/browser_context.h"
#include "cef/libcef/browser/media_router/media_router_impl.h" #include "cef/libcef/browser/media_router/media_router_impl.h"
@ -158,7 +159,7 @@ class CefRequestContextImpl : public CefRequestContext {
// Wrap an existing (non-global) browser context. When specifying this value // Wrap an existing (non-global) browser context. When specifying this value
// GetOrCreateRequestContext() must be called on the UI thread. // GetOrCreateRequestContext() must be called on the UI thread.
CefBrowserContext* browser_context = nullptr; raw_ptr<CefBrowserContext> browser_context = nullptr;
// |settings| or |other| will be set when creating a new CefRequestContext // |settings| or |other| will be set when creating a new CefRequestContext
// via the API. // via the API.
@ -220,7 +221,7 @@ class CefRequestContextImpl : public CefRequestContext {
CefBrowserContext* browser_context() const; CefBrowserContext* browser_context() const;
// We must disassociate from this on destruction. // We must disassociate from this on destruction.
CefBrowserContext* browser_context_ = nullptr; raw_ptr<CefBrowserContext> browser_context_ = nullptr;
Config config_; Config config_;

View File

@ -10,6 +10,7 @@
#include <optional> #include <optional>
#include <vector> #include <vector>
#include "base/memory/raw_ptr.h"
#include "base/threading/platform_thread.h" #include "base/threading/platform_thread.h"
#include "cef/include/cef_menu_model.h" #include "cef/include/cef_menu_model.h"
#include "ui/base/models/simple_menu_model.h" #include "ui/base/models/simple_menu_model.h"
@ -154,9 +155,9 @@ class CefSimpleMenuModelImpl : public CefMenuModel {
base::PlatformThreadId supported_thread_id_; base::PlatformThreadId supported_thread_id_;
ui::SimpleMenuModel* model_; raw_ptr<ui::SimpleMenuModel> model_;
ui::SimpleMenuModel::Delegate* const delegate_; const raw_ptr<ui::SimpleMenuModel::Delegate> delegate_;
StateDelegate* const state_delegate_; const raw_ptr<StateDelegate> state_delegate_;
const bool is_owned_; const bool is_owned_;
const bool is_submenu_; const bool is_submenu_;

View File

@ -159,7 +159,7 @@ size_t CefBytesReader::Read(void* ptr, size_t size, size_t n) {
base::AutoLock lock_scope(lock_); base::AutoLock lock_scope(lock_);
size_t s = (datasize_ - offset_) / size; size_t s = (datasize_ - offset_) / size;
size_t ret = (n < s ? n : s); size_t ret = (n < s ? n : s);
memcpy(ptr, (reinterpret_cast<char*>(data_)) + offset_, ret * size); memcpy(ptr, (reinterpret_cast<char*>(data_.get())) + offset_, ret * size);
offset_ += ret * size; offset_ += ret * size;
return ret; return ret;
} }
@ -249,7 +249,7 @@ size_t CefBytesWriter::Write(const void* ptr, size_t size, size_t n) {
Grow(size * n) == 0) { Grow(size * n) == 0) {
rv = 0; rv = 0;
} else { } else {
memcpy(reinterpret_cast<char*>(data_) + offset_, ptr, size * n); memcpy(reinterpret_cast<char*>(data_.get()) + offset_, ptr, size * n);
offset_ += size * n; offset_ += size * n;
rv = n; rv = n;
} }
@ -300,7 +300,7 @@ int CefBytesWriter::Flush() {
std::string CefBytesWriter::GetDataString() { std::string CefBytesWriter::GetDataString() {
base::AutoLock lock_scope(lock_); base::AutoLock lock_scope(lock_);
std::string str(reinterpret_cast<char*>(data_), offset_); std::string str(reinterpret_cast<char*>(data_.get()), offset_);
return str; return str;
} }

View File

@ -10,6 +10,7 @@
#include <string> #include <string>
#include "base/memory/raw_ptr.h"
#include "base/synchronization/lock.h" #include "base/synchronization/lock.h"
#include "cef/include/cef_stream.h" #include "cef/include/cef_stream.h"
@ -27,7 +28,7 @@ class CefFileReader : public CefStreamReader {
protected: protected:
bool close_; bool close_;
FILE* file_; raw_ptr<FILE> file_;
base::Lock lock_; base::Lock lock_;
@ -47,7 +48,7 @@ class CefFileWriter : public CefStreamWriter {
bool MayBlock() override { return true; } bool MayBlock() override { return true; }
protected: protected:
FILE* file_; raw_ptr<FILE> file_;
bool close_; bool close_;
base::Lock lock_; base::Lock lock_;
@ -73,7 +74,7 @@ class CefBytesReader : public CefStreamReader {
size_t GetDataSize() { return offset_; } size_t GetDataSize() { return offset_; }
protected: protected:
void* data_ = nullptr; raw_ptr<void> data_ = nullptr;
int64_t datasize_ = 0; int64_t datasize_ = 0;
bool copy_ = false; bool copy_ = false;
int64_t offset_ = 0; int64_t offset_ = 0;
@ -103,7 +104,7 @@ class CefBytesWriter : public CefStreamWriter {
size_t Grow(size_t size); size_t Grow(size_t size);
size_t grow_; size_t grow_;
void* data_; raw_ptr<void> data_;
int64_t datasize_; int64_t datasize_;
int64_t offset_ = 0; int64_t offset_ = 0;

View File

@ -57,7 +57,7 @@ void CefBrowserPlatformDelegateViews::NotifyBrowserCreated() {
DCHECK(browser_view_); DCHECK(browser_view_);
DCHECK(browser_); DCHECK(browser_);
if (browser_view_->delegate()) { if (browser_view_->delegate()) {
browser_view_->delegate()->OnBrowserCreated(browser_view_, browser_); browser_view_->delegate()->OnBrowserCreated(browser_view_, browser_.get());
} }
} }
@ -65,7 +65,8 @@ void CefBrowserPlatformDelegateViews::NotifyBrowserDestroyed() {
DCHECK(browser_view_); DCHECK(browser_view_);
DCHECK(browser_); DCHECK(browser_);
if (browser_view_->delegate()) { if (browser_view_->delegate()) {
browser_view_->delegate()->OnBrowserDestroyed(browser_view_, browser_); browser_view_->delegate()->OnBrowserDestroyed(browser_view_,
browser_.get());
} }
} }

View File

@ -7,6 +7,7 @@
#pragma once #pragma once
#include "base/functional/callback_forward.h" #include "base/functional/callback_forward.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "cef/include/cef_client.h" #include "cef/include/cef_client.h"
#include "cef/include/views/cef_browser_view.h" #include "cef/include/views/cef_browser_view.h"
@ -138,8 +139,8 @@ class CefBrowserViewImpl
base::RepeatingClosure on_bounds_changed_; base::RepeatingClosure on_bounds_changed_;
CefWidget* cef_widget_ = nullptr; raw_ptr<CefWidget> cef_widget_ = nullptr;
Profile* profile_ = nullptr; raw_ptr<Profile> profile_ = nullptr;
base::WeakPtrFactory<CefBrowserViewImpl> weak_ptr_factory_; base::WeakPtrFactory<CefBrowserViewImpl> weak_ptr_factory_;

View File

@ -6,6 +6,7 @@
#define CEF_LIBCEF_BROWSER_VIEWS_BROWSER_VIEW_VIEW_H_ #define CEF_LIBCEF_BROWSER_VIEWS_BROWSER_VIEW_VIEW_H_
#pragma once #pragma once
#include "base/memory/raw_ptr.h"
#include "cef/include/views/cef_browser_view_delegate.h" #include "cef/include/views/cef_browser_view_delegate.h"
#include "cef/libcef/browser/views/view_view.h" #include "cef/libcef/browser/views/view_view.h"
#include "ui/views/controls/webview/webview.h" #include "ui/views/controls/webview/webview.h"
@ -63,7 +64,7 @@ class CefBrowserViewView
private: private:
// Not owned by this object. // Not owned by this object.
Delegate* browser_view_delegate_; raw_ptr<Delegate> browser_view_delegate_;
}; };
#endif // CEF_LIBCEF_BROWSER_VIEWS_BROWSER_VIEW_VIEW_H_ #endif // CEF_LIBCEF_BROWSER_VIEWS_BROWSER_VIEW_VIEW_H_

View File

@ -6,6 +6,7 @@
#define CEF_LIBCEF_BROWSER_VIEWS_COLOR_PROVIDER_TRACKER_H_ #define CEF_LIBCEF_BROWSER_VIEWS_COLOR_PROVIDER_TRACKER_H_
#pragma once #pragma once
#include "base/memory/raw_ptr.h"
#include "base/scoped_observation.h" #include "base/scoped_observation.h"
#include "ui/color/color_provider_manager.h" #include "ui/color/color_provider_manager.h"
@ -52,7 +53,7 @@ class CefColorProviderTracker : public ui::ColorProviderManagerObserver {
void OnColorProviderCacheReset() override; void OnColorProviderCacheReset() override;
void OnAfterNativeThemeUpdated() override; void OnAfterNativeThemeUpdated() override;
Observer* const observer_; const raw_ptr<Observer> observer_;
bool got_theme_updated_ = false; bool got_theme_updated_ = false;
base::ScopedObservation<ui::ColorProviderManager, base::ScopedObservation<ui::ColorProviderManager,

View File

@ -7,6 +7,7 @@
#pragma once #pragma once
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "cef/include/views/cef_box_layout.h" #include "cef/include/views/cef_box_layout.h"
#include "cef/include/views/cef_fill_layout.h" #include "cef/include/views/cef_fill_layout.h"
#include "cef/include/views/cef_layout.h" #include "cef/include/views/cef_layout.h"
@ -55,7 +56,7 @@ class CefLayoutImpl : public CefLayoutAdapter, public CefLayoutClass {
owner_view_ = owner_view; owner_view_ = owner_view;
layout_ref_ = CreateLayout(); layout_ref_ = CreateLayout();
DCHECK(layout_ref_); DCHECK(layout_ref_);
owner_view->SetLayoutManager(base::WrapUnique(layout_ref_)); owner_view->SetLayoutManager(base::WrapUnique(layout_ref_.get()));
layout_util::Assign(this, owner_view); layout_util::Assign(this, owner_view);
} }
@ -65,11 +66,11 @@ class CefLayoutImpl : public CefLayoutAdapter, public CefLayoutClass {
private: private:
// Unowned reference to the views::LayoutManager wrapped by this object. Will // Unowned reference to the views::LayoutManager wrapped by this object. Will
// be nullptr after the views::LayoutManager is destroyed. // be nullptr after the views::LayoutManager is destroyed.
ViewsLayoutClass* layout_ref_ = nullptr; raw_ptr<ViewsLayoutClass> layout_ref_ = nullptr;
// Unowned reference to the views::View that owns this object. Will be nullptr // Unowned reference to the views::View that owns this object. Will be nullptr
// after the views::LayoutManager is destroyed. // after the views::LayoutManager is destroyed.
views::View* owner_view_ = nullptr; raw_ptr<views::View> owner_view_ = nullptr;
}; };
#endif // CEF_LIBCEF_BROWSER_VIEWS_LAYOUT_IMPL_H_ #endif // CEF_LIBCEF_BROWSER_VIEWS_LAYOUT_IMPL_H_

View File

@ -6,6 +6,7 @@
#define CEF_LIBCEF_BROWSER_VIEWS_MENU_RUNNER_VIEWS_H_ #define CEF_LIBCEF_BROWSER_VIEWS_MENU_RUNNER_VIEWS_H_
#pragma once #pragma once
#include "base/memory/raw_ptr.h"
#include "cef/libcef/browser/menu_runner.h" #include "cef/libcef/browser/menu_runner.h"
class CefBrowserViewImpl; class CefBrowserViewImpl;
@ -23,7 +24,7 @@ class CefMenuRunnerViews : public CefMenuRunner {
bool FormatLabel(std::u16string& label) override; bool FormatLabel(std::u16string& label) override;
private: private:
CefBrowserViewImpl* browser_view_; raw_ptr<CefBrowserViewImpl> browser_view_;
}; };
#endif // CEF_LIBCEF_BROWSER_VIEWS_MENU_RUNNER_VIEWS_H_ #endif // CEF_LIBCEF_BROWSER_VIEWS_MENU_RUNNER_VIEWS_H_

View File

@ -6,6 +6,7 @@
#define CEF_LIBCEF_BROWSER_VIEWS_NATIVE_WIDGET_MAC_H_ #define CEF_LIBCEF_BROWSER_VIEWS_NATIVE_WIDGET_MAC_H_
#pragma once #pragma once
#include "base/memory/raw_ptr.h"
#include "cef/include/internal/cef_ptr.h" #include "cef/include/internal/cef_ptr.h"
#include "ui/views/widget/native_widget_mac.h" #include "ui/views/widget/native_widget_mac.h"
@ -45,12 +46,12 @@ class CefNativeWidgetMac : public views::NativeWidgetMac {
private: private:
const CefRefPtr<CefWindow> window_; const CefRefPtr<CefWindow> window_;
CefWindowDelegate* const window_delegate_; const raw_ptr<CefWindowDelegate> window_delegate_;
// Returns true if the CefWindow is fully initialized. // Returns true if the CefWindow is fully initialized.
bool IsCefWindowInitialized() const; bool IsCefWindowInitialized() const;
BrowserView* browser_view_ = nullptr; raw_ptr<BrowserView> browser_view_ = nullptr;
}; };
#endif // CEF_LIBCEF_BROWSER_VIEWS_NATIVE_WIDGET_MAC_H_ #endif // CEF_LIBCEF_BROWSER_VIEWS_NATIVE_WIDGET_MAC_H_

View File

@ -5,6 +5,7 @@
#include "cef/libcef/browser/views/overlay_view_host.h" #include "cef/libcef/browser/views/overlay_view_host.h"
#include "base/i18n/rtl.h" #include "base/i18n/rtl.h"
#include "base/memory/raw_ptr.h"
#include "cef/libcef/browser/views/view_util.h" #include "cef/libcef/browser/views/view_util.h"
#include "cef/libcef/browser/views/window_view.h" #include "cef/libcef/browser/views/window_view.h"
#include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/frame/browser_view.h"
@ -161,7 +162,7 @@ class CefOverlayControllerImpl : public CefOverlayController {
bool IsDrawn() override { return IsVisible(); } bool IsDrawn() override { return IsVisible(); }
private: private:
CefOverlayViewHost* host_; raw_ptr<CefOverlayViewHost> host_;
CefRefPtr<CefView> view_; CefRefPtr<CefView> view_;
IMPLEMENT_REFCOUNTING(CefOverlayControllerImpl); IMPLEMENT_REFCOUNTING(CefOverlayControllerImpl);

View File

@ -8,6 +8,7 @@
#include <memory> #include <memory>
#include "base/memory/raw_ptr.h"
#include "cef/include/views/cef_overlay_controller.h" #include "cef/include/views/cef_overlay_controller.h"
#include "cef/include/views/cef_view.h" #include "cef/include/views/cef_view.h"
#include "ui/views/view_observer.h" #include "ui/views/view_observer.h"
@ -58,15 +59,15 @@ class CefOverlayViewHost : public views::WidgetDelegate,
void Cleanup(); void Cleanup();
// The CefWindowView that created us. // The CefWindowView that created us.
CefWindowView* window_view_; raw_ptr<CefWindowView> window_view_;
const cef_docking_mode_t docking_mode_; const cef_docking_mode_t docking_mode_;
// The host view that the overlay is positioned relative to. // The host view that the overlay is positioned relative to.
views::View* host_view_ = nullptr; raw_ptr<views::View> host_view_ = nullptr;
// Our view, which is responsible for drawing the UI. // Our view, which is responsible for drawing the UI.
views::View* view_ = nullptr; raw_ptr<views::View> view_ = nullptr;
// The Widget implementation that is created and maintained by the overlay. // The Widget implementation that is created and maintained by the overlay.
// It contains |view_|. // It contains |view_|.

View File

@ -6,6 +6,7 @@
#define CEF_LIBCEF_BROWSER_VIEWS_VIEW_IMPL_H_ #define CEF_LIBCEF_BROWSER_VIEWS_VIEW_IMPL_H_
#pragma once #pragma once
#include "base/memory/raw_ptr.h"
// CEF exposes views framework functionality via a hierarchy of CefView and // CEF exposes views framework functionality via a hierarchy of CefView and
// related objects. While the goal is to accurately represent views framework // related objects. While the goal is to accurately represent views framework
// capabilities there is not always a direct 1:1 mapping between the CEF // capabilities there is not always a direct 1:1 mapping between the CEF
@ -443,7 +444,7 @@ CEF_VIEW_IMPL_T class CefViewImpl : public CefViewAdapter, public CefViewClass {
// Unowned reference to the views::View wrapped by this object. Will be // Unowned reference to the views::View wrapped by this object. Will be
// nullptr before the View is created and after the View is destroyed. // nullptr before the View is created and after the View is destroyed.
ViewsViewClass* root_view_ref_; raw_ptr<ViewsViewClass> root_view_ref_;
}; };
CEF_VIEW_IMPL_T CefString CEF_VIEW_IMPL_D::GetTypeString() { CEF_VIEW_IMPL_T CefString CEF_VIEW_IMPL_D::GetTypeString() {

View File

@ -6,6 +6,7 @@
#include <utility> #include <utility>
#include "base/memory/raw_ptr.h"
#include "cef/include/cef_color_ids.h" #include "cef/include/cef_color_ids.h"
#include "cef/libcef/browser/views/view_adapter.h" #include "cef/libcef/browser/views/view_adapter.h"
#include "cef/libcef/browser/views/widget.h" #include "cef/libcef/browser/views/widget.h"
@ -54,7 +55,7 @@ class UserData : public base::SupportsUserData::Data {
DCHECK(view); DCHECK(view);
UserData* data = static_cast<UserData*>(view->GetUserData(UserDataKey())); UserData* data = static_cast<UserData*>(view->GetUserData(UserDataKey()));
if (data) { if (data) {
return data->view_ref_; return data->view_ref_.get();
} }
return nullptr; return nullptr;
} }
@ -111,7 +112,7 @@ class UserData : public base::SupportsUserData::Data {
} }
} }
void TakeReference() { view_ = view_ref_; } void TakeReference() { view_ = view_ref_.get(); }
void ReleaseReference() { view_ = nullptr; } void ReleaseReference() { view_ = nullptr; }
@ -123,7 +124,7 @@ class UserData : public base::SupportsUserData::Data {
} }
CefRefPtr<CefView> view_; CefRefPtr<CefView> view_;
CefView* view_ref_; raw_ptr<CefView> view_ref_;
}; };
// Based on Widget::GetNativeTheme. // Based on Widget::GetNativeTheme.

View File

@ -7,6 +7,7 @@
#pragma once #pragma once
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "cef/include/views/cef_view.h" #include "cef/include/views/cef_view.h"
#include "cef/include/views/cef_view_delegate.h" #include "cef/include/views/cef_view_delegate.h"
#include "cef/libcef/browser/thread_util.h" #include "cef/libcef/browser/thread_util.h"
@ -87,7 +88,7 @@ CEF_VIEW_VIEW_T class CefViewView : public ViewsViewClass {
const views::ViewHierarchyChangedDetails& details); const views::ViewHierarchyChangedDetails& details);
// Not owned by this object. // Not owned by this object.
CefViewDelegateClass* const cef_delegate_; const raw_ptr<CefViewDelegateClass> cef_delegate_;
}; };
CEF_VIEW_VIEW_T gfx::Size CEF_VIEW_VIEW_D::CalculatePreferredSize() const { CEF_VIEW_VIEW_T gfx::Size CEF_VIEW_VIEW_D::CalculatePreferredSize() const {

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be found // Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file. // in the LICENSE file.
#include "base/memory/raw_ptr.h"
#include "base/scoped_observation.h" #include "base/scoped_observation.h"
#include "ui/views/widget/widget_observer.h" #include "ui/views/widget/widget_observer.h"
@ -27,7 +28,7 @@ class WidgetDestructionObserver : public views::WidgetObserver {
views::Widget* widget() const { return widget_; } views::Widget* widget() const { return widget_; }
private: private:
views::Widget* widget_; raw_ptr<views::Widget> widget_;
base::ScopedObservation<views::Widget, views::WidgetObserver> observation_{ base::ScopedObservation<views::Widget, views::WidgetObserver> observation_{
this}; this};

View File

@ -8,6 +8,7 @@
#include <map> #include <map>
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "cef/libcef/browser/views/color_provider_tracker.h" #include "cef/libcef/browser/views/color_provider_tracker.h"
#include "cef/libcef/browser/views/widget.h" #include "cef/libcef/browser/views/widget.h"
@ -83,7 +84,7 @@ class CefWidgetImpl : public views::Widget,
// CefColorProviderTracker::Observer methods: // CefColorProviderTracker::Observer methods:
void OnColorProviderCacheResetMissed() override; void OnColorProviderCacheResetMissed() override;
CefWindowView* window_view_; raw_ptr<CefWindowView> window_view_;
bool initialized_ = false; bool initialized_ = false;

View File

@ -7,6 +7,7 @@
#include <memory> #include <memory>
#include "base/i18n/rtl.h" #include "base/i18n/rtl.h"
#include "base/memory/raw_ptr.h"
#include "cef/libcef/browser/browser_util.h" #include "cef/libcef/browser/browser_util.h"
#include "cef/libcef/browser/thread_util.h" #include "cef/libcef/browser/thread_util.h"
#include "cef/libcef/browser/views/browser_view_impl.h" #include "cef/libcef/browser/views/browser_view_impl.h"
@ -93,11 +94,11 @@ class CefUnhandledKeyEventHandler : public ui::EventHandler {
private: private:
// Members are guaranteed to outlive this object. // Members are guaranteed to outlive this object.
CefWindowImpl* window_impl_; raw_ptr<CefWindowImpl> window_impl_;
views::Widget* widget_; raw_ptr<views::Widget> widget_;
// |window_| is the event target that is associated with this class. // |window_| is the event target that is associated with this class.
aura::Window* window_; raw_ptr<aura::Window> window_;
}; };
#endif // defined(USE_AURA) #endif // defined(USE_AURA)

View File

@ -8,6 +8,7 @@
#include <map> #include <map>
#include "base/memory/raw_ptr.h"
#include "cef/include/views/cef_window.h" #include "cef/include/views/cef_window.h"
#include "cef/include/views/cef_window_delegate.h" #include "cef/include/views/cef_window_delegate.h"
#include "cef/libcef/browser/menu_model_impl.h" #include "cef/libcef/browser/menu_model_impl.h"
@ -152,7 +153,7 @@ class CefWindowImpl
// Initialize the Widget. // Initialize the Widget.
void CreateWidget(gfx::AcceleratedWidget parent_widget); void CreateWidget(gfx::AcceleratedWidget parent_widget);
views::Widget* widget_ = nullptr; raw_ptr<views::Widget> widget_ = nullptr;
// True if the window has been initialized. // True if the window has been initialized.
bool initialized_ = false; bool initialized_ = false;

Some files were not shown because too many files have changed in this diff Show More