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

Side by Side Diff: chrome/browser/ui/cocoa/notifications/balloon_view_host_mac.mm

Issue 231213003: notification balloons: Remove views and cocoa implementations of BalloonCollection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 "chrome/browser/ui/cocoa/notifications/balloon_view_host_mac.h"
6
7 #import <Cocoa/Cocoa.h>
8
9 #include "content/public/browser/render_view_host.h"
10 #include "content/public/browser/web_contents.h"
11 #include "content/public/browser/web_contents_view.h"
12
13 BalloonViewHost::BalloonViewHost(Balloon* balloon)
14 : BalloonHost(balloon) {
15 }
16
17 BalloonViewHost::~BalloonViewHost() {
18 Shutdown();
19 }
20
21 void BalloonViewHost::UpdateActualSize(const gfx::Size& new_size) {
22 // Update the size of the web contents view.
23 // The view's new top left corner should be identical to the view's old top
24 // left corner.
25 NSView* web_contents_view = web_contents_->GetView()->GetNativeView();
26 NSRect old_wcv_frame = [web_contents_view frame];
27 CGFloat new_x = old_wcv_frame.origin.x;
28 CGFloat new_y =
29 old_wcv_frame.origin.y + (old_wcv_frame.size.height - new_size.height());
30 NSRect new_wcv_frame =
31 NSMakeRect(new_x, new_y, new_size.width(), new_size.height());
32 [web_contents_view setFrame:new_wcv_frame];
33
34 // Update the size of the balloon view.
35 NSView* view = native_view();
36 NSRect frame = [view frame];
37 frame.size.width = new_size.width();
38 frame.size.height = new_size.height();
39
40 [view setFrame:frame];
41 [view setNeedsDisplay:YES];
42 }
43
44 gfx::NativeView BalloonViewHost::native_view() const {
45 return web_contents_->GetView()->GetContentNativeView();
46 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/notifications/balloon_view_host_mac.h ('k') | chrome/browser/ui/views/notifications/OWNERS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698