Commit 35ac419d authored by Albert Chaulk's avatar Albert Chaulk Committed by Commit Bot

Remove WebviewLayoutManager

In order to allow cropping to occur the webviews will now be explicitly
sized by the client and not implicitly sized by the exo surface size.

Bug: b/143612326
Test: None
Change-Id: I8383ac520f48fb247a53fbf35189c9d5a133a87f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1976825Reviewed-by: default avatarAlex Sakhartchouk <alexst@chromium.org>
Commit-Queue: Albert Chaulk <achaulk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#726714}
parent 952dcb20
......@@ -419,8 +419,6 @@ cast_source_set("browser") {
"webview/webview_controller.h",
"webview/webview_grpc_service.cc",
"webview/webview_grpc_service.h",
"webview/webview_layout_manager.cc",
"webview/webview_layout_manager.h",
"webview/webview_navigation_throttle.cc",
"webview/webview_navigation_throttle.h",
"webview/webview_rpc_instance.cc",
......
......@@ -8,7 +8,6 @@
#include "base/strings/utf_string_conversions.h"
#include "chromecast/base/version.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 "content/public/browser/browser_context.h"
#include "content/public/browser/browsing_data_remover.h"
......@@ -139,9 +138,11 @@ void WebContentController::ProcessRequest(
void WebContentController::AttachTo(aura::Window* window, int window_id) {
content::WebContents* contents = GetWebContents();
auto* contents_window = contents->GetNativeView();
window->SetLayoutManager(new WebviewLayoutManager(window));
contents_window->set_id(window_id);
contents_window->SetBounds(gfx::Rect(window->bounds().size()));
// Set the initial webview size as we depend on the client to do further
// sizing.
contents_window->SetBounds(gfx::Rect(window->bounds().size()));
// The aura window is hidden to avoid being shown via the usual layer method,
// instead it is shows via a SurfaceDrawQuad by exo.
contents_window->Hide();
......
......@@ -12,7 +12,6 @@
#include "chromecast/base/version.h"
#include "chromecast/browser/cast_web_contents_impl.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 "content/public/browser/browser_context.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