Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / apps / ui / web_contents_sizer.cc
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
3 // found in the LICENSE file.
4
5 #include "apps/ui/web_contents_sizer.h"
6
7 #include "content/public/browser/web_contents.h"
8
9 #if defined(USE_AURA)
10 #include "ui/aura/window.h"
11 #elif defined(OS_ANDROID)
12 #include "content/public/browser/render_widget_host_view.h"
13 #endif
14
15 namespace apps {
16
17 void ResizeWebContents(content::WebContents* web_contents,
18                        const gfx::Size& new_size) {
19 #if defined(USE_AURA)
20   aura::Window* window = web_contents->GetNativeView();
21   window->SetBounds(gfx::Rect(window->bounds().origin(), new_size));
22 #elif defined(OS_ANDROID)
23   content::RenderWidgetHostView* view = web_contents->GetRenderWidgetHostView();
24   if (view)
25     view->SetSize(new_size);
26 #endif
27 }
28
29 }  // namespace apps