Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1058)

Unified Diff: chrome/browser/ui/views/frame/top_container_view.cc

Issue 13866026: Adds functionality to anchor widgets to the top-of-window views in immersive mode (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebased Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/frame/top_container_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/frame/top_container_view.cc
diff --git a/chrome/browser/ui/views/frame/top_container_view.cc b/chrome/browser/ui/views/frame/top_container_view.cc
index 8e4e6a3eb184da672d5fb96a8330cc09c2b5a295..d9768545fa2a16e414509574d472ca70250e50bd 100644
--- a/chrome/browser/ui/views/frame/top_container_view.cc
+++ b/chrome/browser/ui/views/frame/top_container_view.cc
@@ -15,6 +15,24 @@ TopContainerView::TopContainerView(BrowserView* browser_view)
TopContainerView::~TopContainerView() {
}
+gfx::Rect TopContainerView::GetTargetBoundsInScreen() const {
+ if (!parent())
+ return bounds();
+
+ // Compute transform relative to parent.
+ gfx::Transform transform;
+ if (layer())
+ transform = layer()->GetTargetTransform();
+ gfx::Transform translation;
+ translation.Translate(static_cast<float>(GetMirroredX()),
+ static_cast<float>(y()));
+ transform.ConcatTransform(translation);
+
+ gfx::Point origin(parent()->GetBoundsInScreen().origin());
+ transform.TransformPoint(origin);
+ return gfx::Rect(origin, size());
+}
+
gfx::Size TopContainerView::GetPreferredSize() {
// The view wants to be as wide as its parent and tall enough to fully show
// its last child view.
@@ -27,6 +45,13 @@ std::string TopContainerView::GetClassName() const {
return "TopContainerView";
}
+void TopContainerView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
+ ImmersiveModeController* immersive_controller =
+ browser_view_->immersive_mode_controller();
+ if (immersive_controller->IsEnabled())
+ immersive_controller->OnTopContainerBoundsChanged();
+}
+
void TopContainerView::PaintChildren(gfx::Canvas* canvas) {
if (browser_view_->immersive_mode_controller()->IsRevealed()) {
// Top-views depend on parts of the frame (themes, window buttons) being
« no previous file with comments | « chrome/browser/ui/views/frame/top_container_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698