Commit 9d99b3b8 authored by Sigurdur Asgeirsson's avatar Sigurdur Asgeirsson Committed by Commit Bot

Retire ScopedObserver in /components/arc/intent_helper.

ScopedObserver is being deprecated in favor of two new classes:
- base::ScopedObservation for observers that only ever observe
  a single source.
- base::ScopedMultiSourceObservation for observers that do or may
  observe more than a single source.

This CL was uploaded by git cl split.

R=djacobo@chromium.org

Bug: 1145565
Change-Id: I436bf817ddb0820060ddcc817c324cf2ae5c9cee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2532715Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Reviewed-by: default avatarDavid Jacobo <djacobo@chromium.org>
Commit-Queue: David Jacobo <djacobo@chromium.org>
Auto-Submit: Sigurður Ásgeirsson <siggi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827867}
parent ecc645fc
......@@ -20,7 +20,7 @@ namespace arc {
CustomTab::CustomTab(aura::Window* arc_app_window)
: arc_app_window_(arc_app_window) {
arc_app_window_observer_.Add(arc_app_window_);
arc_app_window_observation_.Observe(arc_app_window_);
host_->set_owned_by_client();
auto* const widget = views::Widget::GetWidgetForNativeWindow(arc_app_window_);
DCHECK(widget);
......@@ -35,7 +35,7 @@ void CustomTab::Attach(gfx::NativeView view) {
host_->Attach(view);
aura::Window* const container = host_->GetNativeViewContainer();
container->SetEventTargeter(std::make_unique<aura::WindowTargeter>());
other_windows_observer_.Add(container);
other_windows_observation_.Observe(container);
EnsureWindowOrders();
UpdateHostBounds(arc_app_window_);
}
......@@ -48,7 +48,7 @@ void CustomTab::OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) {
if (arc_app_window_observer_.IsObserving(window) &&
if (arc_app_window_observation_.IsObservingSource(window) &&
old_bounds.size() != new_bounds.size()) {
UpdateHostBounds(window);
}
......@@ -69,10 +69,10 @@ void CustomTab::OnWindowStackingChanged(aura::Window* window) {
}
void CustomTab::OnWindowDestroying(aura::Window* window) {
if (arc_app_window_observer_.IsObserving(window))
arc_app_window_observer_.Remove(window);
if (other_windows_observer_.IsObserving(window))
other_windows_observer_.Remove(window);
if (arc_app_window_observation_.IsObservingSource(window))
arc_app_window_observation_.RemoveObservation();
if (other_windows_observation_.IsObservingSource(window))
other_windows_observation_.RemoveObservation();
}
void CustomTab::UpdateHostBounds(aura::Window* arc_app_window) {
......
......@@ -8,7 +8,7 @@
#include <memory>
#include "base/macros.h"
#include "base/scoped_observer.h"
#include "base/scoped_observation.h"
#include "components/arc/arc_export.h"
#include "ui/aura/window.h"
#include "ui/aura/window_observer.h"
......@@ -53,10 +53,10 @@ class ARC_EXPORT CustomTab : public aura::WindowObserver {
std::unique_ptr<views::NativeViewHost> host_ =
std::make_unique<views::NativeViewHost>();
aura::Window* const arc_app_window_;
ScopedObserver<aura::Window, aura::WindowObserver> arc_app_window_observer_{
this};
ScopedObserver<aura::Window, aura::WindowObserver> other_windows_observer_{
this};
base::ScopedObservation<aura::Window, aura::WindowObserver>
arc_app_window_observation_{this};
base::ScopedObservation<aura::Window, aura::WindowObserver>
other_windows_observation_{this};
base::WeakPtrFactory<CustomTab> weak_ptr_factory_{this};
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment