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

Unified Diff: apps/ui/web_contents_sizer.mm

Issue 209023003: Remove references to WebContentsView::SizeContents from chrome/ and app/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Alphabetization. Created 6 years, 9 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
Index: apps/ui/web_contents_sizer.mm
diff --git a/apps/ui/web_contents_sizer.mm b/apps/ui/web_contents_sizer.mm
new file mode 100644
index 0000000000000000000000000000000000000000..e73f1ffe4735f19ce2ff5c997c239085bf6f413f
--- /dev/null
+++ b/apps/ui/web_contents_sizer.mm
@@ -0,0 +1,26 @@
+// 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"
+#include "content/public/browser/web_contents_view.h"
+
+namespace apps {
+
+void ResizeWebContents(content::WebContents* web_contents,
+ const gfx::Size& new_size) {
+ gfx::NativeView view = web_contents->GetView()->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

Powered by Google App Engine
This is Rietveld 408576698