Commit 41ae6dc5 authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

chromeos: renames ArcCustomTabView

Removes the Classic part, which is no longer appropriate.

BUG=958135
TEST=covered by tests
TBR=mukai@chromium.org

Change-Id: I1ed6c902713f7db1a9d640577676f1fe51cc012d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1601319Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#657736}
parent 99b3fb68
...@@ -70,8 +70,8 @@ std::unique_ptr<ArcCustomTab> ArcCustomTab::Create(int32_t task_id, ...@@ -70,8 +70,8 @@ std::unique_ptr<ArcCustomTab> ArcCustomTab::Create(int32_t task_id,
return nullptr; return nullptr;
} }
auto* parent = widget->widget_delegate()->GetContentsView(); auto* parent = widget->widget_delegate()->GetContentsView();
auto view = std::make_unique<ArcCustomTabViewClassic>(arc_app_window, auto view = std::make_unique<ArcCustomTabView>(arc_app_window, surface_id,
surface_id, top_margin); top_margin);
parent->AddChildView(view.get()); parent->AddChildView(view.get());
parent->SetLayoutManager(std::make_unique<views::FillLayout>()); parent->SetLayoutManager(std::make_unique<views::FillLayout>());
parent->Layout(); parent->Layout();
...@@ -79,7 +79,7 @@ std::unique_ptr<ArcCustomTab> ArcCustomTab::Create(int32_t task_id, ...@@ -79,7 +79,7 @@ std::unique_ptr<ArcCustomTab> ArcCustomTab::Create(int32_t task_id,
return std::move(view); return std::move(view);
} }
ArcCustomTabViewClassic::ArcCustomTabViewClassic(aura::Window* arc_app_window, ArcCustomTabView::ArcCustomTabView(aura::Window* arc_app_window,
int32_t surface_id, int32_t surface_id,
int32_t top_margin) int32_t top_margin)
: host_(new views::NativeViewHost()), : host_(new views::NativeViewHost()),
...@@ -92,7 +92,7 @@ ArcCustomTabViewClassic::ArcCustomTabViewClassic(aura::Window* arc_app_window, ...@@ -92,7 +92,7 @@ ArcCustomTabViewClassic::ArcCustomTabViewClassic(aura::Window* arc_app_window,
set_owned_by_client(); set_owned_by_client();
} }
ArcCustomTabViewClassic::~ArcCustomTabViewClassic() { ArcCustomTabView::~ArcCustomTabView() {
for (auto* window : observed_surfaces_) for (auto* window : observed_surfaces_)
window->RemoveObserver(this); window->RemoveObserver(this);
arc_app_window_->RemoveObserver(this); arc_app_window_->RemoveObserver(this);
...@@ -103,7 +103,7 @@ ArcCustomTabViewClassic::~ArcCustomTabViewClassic() { ...@@ -103,7 +103,7 @@ ArcCustomTabViewClassic::~ArcCustomTabViewClassic() {
native_view_container_->RemoveObserver(this); native_view_container_->RemoveObserver(this);
} }
void ArcCustomTabViewClassic::Attach(gfx::NativeView view) { void ArcCustomTabView::Attach(gfx::NativeView view) {
DCHECK(view); DCHECK(view);
DCHECK(!host_->native_view()); DCHECK(!host_->native_view());
host_->Attach(view); host_->Attach(view);
...@@ -114,15 +114,14 @@ void ArcCustomTabViewClassic::Attach(gfx::NativeView view) { ...@@ -114,15 +114,14 @@ void ArcCustomTabViewClassic::Attach(gfx::NativeView view) {
native_view_container_->AddObserver(this); native_view_container_->AddObserver(this);
} }
void ArcCustomTabViewClassic::OnBoundsChanged( void ArcCustomTabView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
const gfx::Rect& previous_bounds) {
if (previous_bounds.size() != size()) { if (previous_bounds.size() != size()) {
InvalidateLayout(); InvalidateLayout();
host_->InvalidateLayout(); host_->InvalidateLayout();
} }
} }
void ArcCustomTabViewClassic::Layout() { void ArcCustomTabView::Layout() {
exo::Surface* surface = FindSurface(); exo::Surface* surface = FindSurface();
if (!surface) if (!surface)
return; return;
...@@ -144,7 +143,7 @@ void ArcCustomTabViewClassic::Layout() { ...@@ -144,7 +143,7 @@ void ArcCustomTabViewClassic::Layout() {
host_->SetBoundsRect(bounds); host_->SetBoundsRect(bounds);
} }
void ArcCustomTabViewClassic::OnWindowHierarchyChanged( void ArcCustomTabView::OnWindowHierarchyChanged(
const HierarchyChangeParams& params) { const HierarchyChangeParams& params) {
if (params.receiver == arc_app_window_) { if (params.receiver == arc_app_window_) {
auto* surface = exo::Surface::AsSurface(params.target); auto* surface = exo::Surface::AsSurface(params.target);
...@@ -156,8 +155,7 @@ void ArcCustomTabViewClassic::OnWindowHierarchyChanged( ...@@ -156,8 +155,7 @@ void ArcCustomTabViewClassic::OnWindowHierarchyChanged(
} }
} }
void ArcCustomTabViewClassic::OnWindowBoundsChanged( void ArcCustomTabView::OnWindowBoundsChanged(aura::Window* window,
aura::Window* window,
const gfx::Rect& old_bounds, const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds, const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) { ui::PropertyChangeReason reason) {
...@@ -167,7 +165,7 @@ void ArcCustomTabViewClassic::OnWindowBoundsChanged( ...@@ -167,7 +165,7 @@ void ArcCustomTabViewClassic::OnWindowBoundsChanged(
} }
} }
void ArcCustomTabViewClassic::OnWindowPropertyChanged(aura::Window* window, void ArcCustomTabView::OnWindowPropertyChanged(aura::Window* window,
const void* key, const void* key,
intptr_t old) { intptr_t old) {
if (observed_surfaces_.contains(window)) { if (observed_surfaces_.contains(window)) {
...@@ -178,7 +176,7 @@ void ArcCustomTabViewClassic::OnWindowPropertyChanged(aura::Window* window, ...@@ -178,7 +176,7 @@ void ArcCustomTabViewClassic::OnWindowPropertyChanged(aura::Window* window,
} }
} }
void ArcCustomTabViewClassic::OnWindowStackingChanged(aura::Window* window) { void ArcCustomTabView::OnWindowStackingChanged(aura::Window* window) {
if (window != host_->GetNativeViewContainer() || reorder_scheduled_) if (window != host_->GetNativeViewContainer() || reorder_scheduled_)
return; return;
reorder_scheduled_ = true; reorder_scheduled_ = true;
...@@ -188,11 +186,11 @@ void ArcCustomTabViewClassic::OnWindowStackingChanged(aura::Window* window) { ...@@ -188,11 +186,11 @@ void ArcCustomTabViewClassic::OnWindowStackingChanged(aura::Window* window) {
// window/layer ordering and causes weird graphical effects. // window/layer ordering and causes weird graphical effects.
// TODO(hashimoto): fix the views ordering and remove this handling. // TODO(hashimoto): fix the views ordering and remove this handling.
base::SequencedTaskRunnerHandle::Get()->PostTask( base::SequencedTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(&ArcCustomTabViewClassic::EnsureWindowOrders, FROM_HERE, base::BindOnce(&ArcCustomTabView::EnsureWindowOrders,
weak_ptr_factory_.GetWeakPtr())); weak_ptr_factory_.GetWeakPtr()));
} }
void ArcCustomTabViewClassic::OnWindowDestroying(aura::Window* window) { void ArcCustomTabView::OnWindowDestroying(aura::Window* window) {
if (observed_surfaces_.contains(window)) { if (observed_surfaces_.contains(window)) {
window->RemoveObserver(this); window->RemoveObserver(this);
observed_surfaces_.erase(window); observed_surfaces_.erase(window);
...@@ -207,20 +205,20 @@ void ArcCustomTabViewClassic::OnWindowDestroying(aura::Window* window) { ...@@ -207,20 +205,20 @@ void ArcCustomTabViewClassic::OnWindowDestroying(aura::Window* window) {
} }
} }
void ArcCustomTabViewClassic::EnsureWindowOrders() { void ArcCustomTabView::EnsureWindowOrders() {
reorder_scheduled_ = false; reorder_scheduled_ = false;
if (native_view_container_) if (native_view_container_)
native_view_container_->parent()->StackChildAtTop(native_view_container_); native_view_container_->parent()->StackChildAtTop(native_view_container_);
} }
void ArcCustomTabViewClassic::ConvertPointFromWindow(aura::Window* window, void ArcCustomTabView::ConvertPointFromWindow(aura::Window* window,
gfx::Point* point) { gfx::Point* point) {
aura::Window::ConvertPointToTarget(window, GetWidget()->GetNativeWindow(), aura::Window::ConvertPointToTarget(window, GetWidget()->GetNativeWindow(),
point); point);
views::View::ConvertPointFromWidget(parent(), point); views::View::ConvertPointFromWidget(parent(), point);
} }
exo::Surface* ArcCustomTabViewClassic::FindSurface() { exo::Surface* ArcCustomTabView::FindSurface() {
std::vector<exo::Surface*> surfaces; std::vector<exo::Surface*> surfaces;
EnumerateSurfaces(arc_app_window_, &surfaces); EnumerateSurfaces(arc_app_window_, &surfaces);
......
...@@ -25,15 +25,14 @@ namespace ash { ...@@ -25,15 +25,14 @@ namespace ash {
// A view-based implementation of ArcCustomTab which works in the classic // A view-based implementation of ArcCustomTab which works in the classic
// environment. // environment.
// TODO(hashimoto): rename this to ArcCustomTabView. class ArcCustomTabView : public ArcCustomTab,
class ArcCustomTabViewClassic : public ArcCustomTab,
public views::View, public views::View,
public aura::WindowObserver { public aura::WindowObserver {
public: public:
ArcCustomTabViewClassic(aura::Window* arc_app_window, ArcCustomTabView(aura::Window* arc_app_window,
int32_t surface_id, int32_t surface_id,
int32_t top_margin); int32_t top_margin);
~ArcCustomTabViewClassic() override; ~ArcCustomTabView() override;
private: private:
// ArcCustomTab: // ArcCustomTab:
...@@ -73,9 +72,9 @@ class ArcCustomTabViewClassic : public ArcCustomTab, ...@@ -73,9 +72,9 @@ class ArcCustomTabViewClassic : public ArcCustomTab,
bool reorder_scheduled_ = false; bool reorder_scheduled_ = false;
base::WeakPtrFactory<ArcCustomTabViewClassic> weak_ptr_factory_; base::WeakPtrFactory<ArcCustomTabView> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(ArcCustomTabViewClassic); DISALLOW_COPY_AND_ASSIGN(ArcCustomTabView);
}; };
} // namespace ash } // namespace ash
......
...@@ -104,7 +104,7 @@ std::string GetPathAndQuery(const GURL& url) { ...@@ -104,7 +104,7 @@ std::string GetPathAndQuery(const GURL& url) {
// Implementation of CustomTabSession interface. // Implementation of CustomTabSession interface.
class CustomTabSessionImpl : public arc::mojom::CustomTabSession { class CustomTabSessionImpl : public arc::mojom::CustomTabSession {
public: public:
static arc::mojom::CustomTabSessionPtr CreateForClassic( static arc::mojom::CustomTabSessionPtr Create(
Profile* profile, Profile* profile,
const GURL& url, const GURL& url,
std::unique_ptr<ash::ArcCustomTab> custom_tab) { std::unique_ptr<ash::ArcCustomTab> custom_tab) {
...@@ -458,8 +458,8 @@ void ChromeNewWindowClient::OpenArcCustomTab( ...@@ -458,8 +458,8 @@ void ChromeNewWindowClient::OpenArcCustomTab(
GURL url_to_open = ConvertArcUrlToExternalFileUrlIfNeeded(url); GURL url_to_open = ConvertArcUrlToExternalFileUrlIfNeeded(url);
Profile* profile = ProfileManager::GetActiveUserProfile(); Profile* profile = ProfileManager::GetActiveUserProfile();
auto custom_tab = ash::ArcCustomTab::Create(task_id, surface_id, top_margin); auto custom_tab = ash::ArcCustomTab::Create(task_id, surface_id, top_margin);
std::move(callback).Run(CustomTabSessionImpl::CreateForClassic( std::move(callback).Run(
profile, url, std::move(custom_tab))); CustomTabSessionImpl::Create(profile, url, std::move(custom_tab)));
} }
content::WebContents* ChromeNewWindowClient::OpenUrlImpl( content::WebContents* ChromeNewWindowClient::OpenUrlImpl(
......
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