web_contents_proxy.cc 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Copyright 2019 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "components/performance_manager/public/web_contents_proxy.h"
  5. #include "components/performance_manager/web_contents_proxy_impl.h"
  6. namespace performance_manager {
  7. WebContentsProxy::WebContentsProxy() = default;
  8. WebContentsProxy::WebContentsProxy(const WebContentsProxy& other)
  9. : impl_(other.impl_) {}
  10. WebContentsProxy::WebContentsProxy(WebContentsProxy&& other)
  11. : impl_(std::move(other.impl_)) {}
  12. WebContentsProxy::~WebContentsProxy() = default;
  13. WebContentsProxy& WebContentsProxy::operator=(const WebContentsProxy& other) {
  14. impl_ = other.impl_;
  15. return *this;
  16. }
  17. WebContentsProxy& WebContentsProxy::operator=(WebContentsProxy&& other) {
  18. impl_ = std::move(other.impl_);
  19. return *this;
  20. }
  21. content::WebContents* WebContentsProxy::Get() const {
  22. auto* proxy = impl_.get();
  23. if (!proxy)
  24. return nullptr;
  25. return proxy->GetWebContents();
  26. }
  27. int64_t WebContentsProxy::LastNavigationId() const {
  28. auto* proxy = impl_.get();
  29. if (!proxy)
  30. return 0;
  31. return proxy->LastNavigationId();
  32. }
  33. int64_t WebContentsProxy::LastNewDocNavigationId() const {
  34. auto* proxy = impl_.get();
  35. if (!proxy)
  36. return 0;
  37. return proxy->LastNewDocNavigationId();
  38. }
  39. WebContentsProxy::WebContentsProxy(
  40. const base::WeakPtr<WebContentsProxyImpl>& impl)
  41. : impl_(impl) {}
  42. } // namespace performance_manager