Commit 7d12a12d authored by Daniel Nicoara's avatar Daniel Nicoara Committed by Commit Bot

cast: webview: Remove layout manager

Webviews will be explicitly sized. No need to size them by parent size.
This will allow the embedding window to be sized based on the viewport
such that it allows us to clip contents.

Bug: b/143612326
Test: Manual
Change-Id: Ie3382c094e11b31b3515c7ef3ee76e55169b7a50
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1962980Reviewed-by: default avatarAlbert Chaulk <achaulk@chromium.org>
Commit-Queue: Daniel Nicoara <dnicoara@chromium.org>
Cr-Commit-Position: refs/heads/master@{#729503}
parent e09b46d9
...@@ -419,8 +419,6 @@ cast_source_set("browser") { ...@@ -419,8 +419,6 @@ cast_source_set("browser") {
"webview/webview_controller.h", "webview/webview_controller.h",
"webview/webview_grpc_service.cc", "webview/webview_grpc_service.cc",
"webview/webview_grpc_service.h", "webview/webview_grpc_service.h",
"webview/webview_layout_manager.cc",
"webview/webview_layout_manager.h",
"webview/webview_navigation_throttle.cc", "webview/webview_navigation_throttle.cc",
"webview/webview_navigation_throttle.h", "webview/webview_navigation_throttle.h",
"webview/webview_rpc_instance.cc", "webview/webview_rpc_instance.cc",
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chromecast/base/version.h" #include "chromecast/base/version.h"
#include "chromecast/browser/webview/proto/webview.pb.h" #include "chromecast/browser/webview/proto/webview.pb.h"
#include "chromecast/browser/webview/webview_layout_manager.h"
#include "chromecast/browser/webview/webview_navigation_throttle.h" #include "chromecast/browser/webview/webview_navigation_throttle.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
#include "content/public/browser/browsing_data_remover.h" #include "content/public/browser/browsing_data_remover.h"
...@@ -139,9 +138,7 @@ void WebContentController::ProcessRequest( ...@@ -139,9 +138,7 @@ void WebContentController::ProcessRequest(
void WebContentController::AttachTo(aura::Window* window, int window_id) { void WebContentController::AttachTo(aura::Window* window, int window_id) {
content::WebContents* contents = GetWebContents(); content::WebContents* contents = GetWebContents();
auto* contents_window = contents->GetNativeView(); auto* contents_window = contents->GetNativeView();
window->SetLayoutManager(new WebviewLayoutManager(window));
contents_window->set_id(window_id); contents_window->set_id(window_id);
contents_window->SetBounds(gfx::Rect(window->bounds().size()));
// The aura window is hidden to avoid being shown via the usual layer method, // The aura window is hidden to avoid being shown via the usual layer method,
// instead it is shows via a SurfaceDrawQuad by exo. // instead it is shows via a SurfaceDrawQuad by exo.
contents_window->Hide(); contents_window->Hide();
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "chromecast/base/version.h" #include "chromecast/base/version.h"
#include "chromecast/browser/cast_web_contents_impl.h" #include "chromecast/browser/cast_web_contents_impl.h"
#include "chromecast/browser/webview/proto/webview.pb.h" #include "chromecast/browser/webview/proto/webview.pb.h"
#include "chromecast/browser/webview/webview_layout_manager.h"
#include "chromecast/browser/webview/webview_navigation_throttle.h" #include "chromecast/browser/webview/webview_navigation_throttle.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
#include "content/public/browser/browsing_data_remover.h" #include "content/public/browser/browsing_data_remover.h"
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chromecast/browser/webview/webview_layout_manager.h"
#include "ui/aura/window.h"
namespace chromecast {
WebviewLayoutManager::WebviewLayoutManager(aura::Window* root) : root_(root) {}
WebviewLayoutManager::~WebviewLayoutManager() {}
void WebviewLayoutManager::OnWindowResized() {
for (aura::Window* child : root_->children())
SetChildBoundsDirect(child, gfx::Rect(root_->bounds().size()));
}
void WebviewLayoutManager::OnWindowAddedToLayout(aura::Window* child) {}
void WebviewLayoutManager::OnWillRemoveWindowFromLayout(aura::Window* child) {}
void WebviewLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) {}
void WebviewLayoutManager::OnChildWindowVisibilityChanged(aura::Window* child,
bool visible) {}
void WebviewLayoutManager::SetChildBounds(aura::Window* child,
const gfx::Rect& requested_bounds) {
SetChildBoundsDirect(child, requested_bounds);
}
} // namespace chromecast
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMECAST_BROWSER_WEBVIEW_WEBVIEW_LAYOUT_MANAGER_H_
#define CHROMECAST_BROWSER_WEBVIEW_WEBVIEW_LAYOUT_MANAGER_H_
#include "base/macros.h"
#include "ui/aura/layout_manager.h"
namespace chromecast {
// Resizes the provided window to be the parent window's size.
class WebviewLayoutManager : public aura::LayoutManager {
public:
WebviewLayoutManager(aura::Window* root);
~WebviewLayoutManager() override;
void OnWindowResized() override;
void OnWindowAddedToLayout(aura::Window* child) override;
void OnWillRemoveWindowFromLayout(aura::Window* child) override;
void OnWindowRemovedFromLayout(aura::Window* child) override;
void OnChildWindowVisibilityChanged(aura::Window* child,
bool visible) override;
void SetChildBounds(aura::Window* child,
const gfx::Rect& requested_bounds) override;
private:
aura::Window* root_;
DISALLOW_COPY_AND_ASSIGN(WebviewLayoutManager);
};
} // namespace chromecast
#endif // CHROMECAST_BROWSER_WEBVIEW_WEBVIEW_LAYOUT_MANAGER_H_
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