Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/web_contents_sizer.h" | 5 #include "chrome/browser/ui/web_contents_sizer.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "content/public/browser/web_contents.h" | 8 #include "content/public/browser/web_contents.h" |
| 9 | 9 |
| 10 #if defined(USE_AURA) | 10 #if defined(USE_AURA) |
| 11 #include "ui/aura/window.h" | 11 #include "ui/aura/window.h" |
| 12 #elif defined(OS_ANDROID) | 12 #elif defined(OS_ANDROID) |
| 13 #include "content/public/browser/render_widget_host_view.h" | 13 #include "content/public/browser/render_widget_host_view.h" |
| 14 #endif | 14 #endif |
| 15 | 15 |
| 16 void ResizeWebContents(content::WebContents* web_contents, | 16 void ResizeWebContents(content::WebContents* web_contents, |
| 17 const gfx::Rect& new_bounds) { | 17 const gfx::Rect& new_bounds) { |
| 18 #if defined(USE_AURA) | 18 #if defined(USE_AURA) |
| 19 // TODO(miu): This is a layering violation, since only the RWHV should know | |
|
sky
2017/02/16 00:29:02
I don't understand this comment (or the one in the
miu
2017/02/17 00:09:02
A few reasons:
1. We're in the platform-agnostic
sky
2017/02/17 16:53:07
Could point on the first 1. This code should reall
miu
2017/02/17 23:50:59
Sounds like we agree with the change. I was about
| |
| 20 // whether the resize operation is valid and, if so, execute it. | |
| 21 // http://crbug.com/73362 | |
| 19 aura::Window* window = web_contents->GetNativeView(); | 22 aura::Window* window = web_contents->GetNativeView(); |
| 20 window->SetBounds(gfx::Rect(window->bounds().origin(), new_bounds.size())); | 23 window->SetBounds(gfx::Rect(window->bounds().origin(), new_bounds.size())); |
| 21 #elif defined(OS_ANDROID) | 24 #elif defined(OS_ANDROID) |
| 22 content::RenderWidgetHostView* view = web_contents->GetRenderWidgetHostView(); | 25 content::RenderWidgetHostView* view = web_contents->GetRenderWidgetHostView(); |
| 23 if (view) | 26 if (view) |
| 24 view->SetBounds(new_bounds); | 27 view->RequestTopLevelBoundsInScreen(new_bounds); |
| 25 #endif | 28 #endif |
| 26 } | 29 } |
| OLD | NEW |