summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorhashimoto <hashimoto@chromium.org>2014-08-26 20:33:57 -0700
committerCommit bot <commit-bot@chromium.org>2014-08-27 03:35:01 +0000
commitbf20fc68e55897d1caed421fe371d2ad83dd4e34 (patch)
treef08ebcb925d5445e018b028d36d595e582a5ce81 /apps
parent774dcda2d369584b2e964fa4971dda71cf819677 (diff)
downloadchromium_src-bf20fc68e55897d1caed421fe371d2ad83dd4e34.zip
chromium_src-bf20fc68e55897d1caed421fe371d2ad83dd4e34.tar.gz
chromium_src-bf20fc68e55897d1caed421fe371d2ad83dd4e34.tar.bz2
Add AppDelegate::ResizeWebContents
To stop directly depending on apps/window_size_sizer from AppWindow. BUG=403726 TBR=cbentzel@chromium.org for include/namespace fix in chrome/browser/prerender/prerender_contents.cc Review URL: https://codereview.chromium.org/503233003 Cr-Commit-Position: refs/heads/master@{#292091}
Diffstat (limited to 'apps')
-rw-r--r--apps/BUILD.gn9
-rw-r--r--apps/app_window.cc3
-rw-r--r--apps/apps.gypi12
-rw-r--r--apps/ui/web_contents_sizer.cc29
-rw-r--r--apps/ui/web_contents_sizer.h24
-rw-r--r--apps/ui/web_contents_sizer.mm25
6 files changed, 1 insertions, 101 deletions
diff --git a/apps/BUILD.gn b/apps/BUILD.gn
index 0a80d8c..5cc0849 100644
--- a/apps/BUILD.gn
+++ b/apps/BUILD.gn
@@ -40,7 +40,6 @@ static_library("apps") {
"switches.h",
"ui/apps_client.cc",
"ui/apps_client.h",
- "ui/web_contents_sizer.h",
]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
@@ -63,14 +62,6 @@ static_library("apps") {
sources = []
}
- # This needs to run after the extensions check above since we always want
- # this file in the project.
- if (is_mac) {
- sources += [ "ui/web_contents_sizer.mm" ]
- } else {
- sources += [ "ui/web_contents_sizer.cc" ]
- }
-
if (toolkit_views) {
sources += [
"ui/views/app_window_frame_view.cc",
diff --git a/apps/app_window.cc b/apps/app_window.cc
index 459e4c49..7fd02cd 100644
--- a/apps/app_window.cc
+++ b/apps/app_window.cc
@@ -10,7 +10,6 @@
#include "apps/app_window_registry.h"
#include "apps/ui/apps_client.h"
-#include "apps/ui/web_contents_sizer.h"
#include "base/command_line.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -347,7 +346,7 @@ void AppWindow::Init(const GURL& url,
gfx::Insets frame_insets = native_app_window_->GetFrameInsets();
gfx::Rect initial_bounds = new_params.GetInitialWindowBounds(frame_insets);
initial_bounds.Inset(frame_insets);
- apps::ResizeWebContents(web_contents, initial_bounds.size());
+ app_delegate_->ResizeWebContents(web_contents, initial_bounds.size());
}
}
diff --git a/apps/apps.gypi b/apps/apps.gypi
index 5337780..724799d 100644
--- a/apps/apps.gypi
+++ b/apps/apps.gypi
@@ -63,18 +63,8 @@
'ui/views/app_window_frame_view.h',
'ui/views/native_app_window_views.cc',
'ui/views/native_app_window_views.h',
- 'ui/web_contents_sizer.h',
],
'conditions': [
- ['OS=="mac"', {
- 'sources': [
- 'ui/web_contents_sizer.mm',
- ],
- }, { # OS!=mac
- 'sources': [
- 'ui/web_contents_sizer.cc',
- ],
- }],
['chromeos==1',
{
'dependencies': [
@@ -89,8 +79,6 @@
],
'sources/': [
['exclude', '.*'],
- ['include', 'ui/web_contents_sizer\.cc$'],
- ['include', 'ui/web_contents_sizer\.mm$'],
],
}
],
diff --git a/apps/ui/web_contents_sizer.cc b/apps/ui/web_contents_sizer.cc
deleted file mode 100644
index ab4e18a..0000000
--- a/apps/ui/web_contents_sizer.cc
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2014 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 "apps/ui/web_contents_sizer.h"
-
-#include "content/public/browser/web_contents.h"
-
-#if defined(USE_AURA)
-#include "ui/aura/window.h"
-#elif defined(OS_ANDROID)
-#include "content/public/browser/render_widget_host_view.h"
-#endif
-
-namespace apps {
-
-void ResizeWebContents(content::WebContents* web_contents,
- const gfx::Size& new_size) {
-#if defined(USE_AURA)
- aura::Window* window = web_contents->GetNativeView();
- window->SetBounds(gfx::Rect(window->bounds().origin(), new_size));
-#elif defined(OS_ANDROID)
- content::RenderWidgetHostView* view = web_contents->GetRenderWidgetHostView();
- if (view)
- view->SetSize(new_size);
-#endif
-}
-
-} // namespace apps
diff --git a/apps/ui/web_contents_sizer.h b/apps/ui/web_contents_sizer.h
deleted file mode 100644
index 9b5818e..0000000
--- a/apps/ui/web_contents_sizer.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2014 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 APPS_UI_WEB_CONTENTS_SIZER_H_
-#define APPS_UI_WEB_CONTENTS_SIZER_H_
-
-namespace content {
-class WebContents;
-}
-
-namespace gfx {
-class Size;
-}
-
-namespace apps {
-// A platform-agnostic function to resize a WebContents. The top-left corner of
-// the WebContents does not move during the resizing.
-void ResizeWebContents(content::WebContents* web_contents,
- const gfx::Size& size);
-
-} // namespace apps
-
-#endif // APPS_UI_WEB_CONTENTS_SIZER_H_
diff --git a/apps/ui/web_contents_sizer.mm b/apps/ui/web_contents_sizer.mm
deleted file mode 100644
index f57d75c7..0000000
--- a/apps/ui/web_contents_sizer.mm
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2014 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 "apps/ui/web_contents_sizer.h"
-
-#import <Cocoa/Cocoa.h>
-
-#include "content/public/browser/web_contents.h"
-
-namespace apps {
-
-void ResizeWebContents(content::WebContents* web_contents,
- const gfx::Size& new_size) {
- NSView* view = web_contents->GetNativeView();
- NSRect old_wcv_frame = [view frame];
- CGFloat new_x = old_wcv_frame.origin.x;
- CGFloat new_y =
- old_wcv_frame.origin.y + (old_wcv_frame.size.height - new_size.height());
- NSRect new_wcv_frame =
- NSMakeRect(new_x, new_y, new_size.width(), new_size.height());
- [view setFrame:new_wcv_frame];
-}
-
-} // namespace apps