Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / notifications / balloon_view_bridge.mm
blob802929c1bcde29c767a99e1afff7159c3c2bc3aa
1 // Copyright (c) 2010 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.
5 #include "chrome/browser/ui/cocoa/notifications/balloon_view_bridge.h"
7 #include "chrome/browser/ui/cocoa/notifications/balloon_controller.h"
8 #import "chrome/browser/ui/cocoa/notifications/balloon_view_host_mac.h"
9 #include "ui/gfx/size.h"
11 #import <Cocoa/Cocoa.h>
13 BalloonViewBridge::BalloonViewBridge() :
14     controller_(NULL) {
17 BalloonViewBridge::~BalloonViewBridge() {
20 void BalloonViewBridge::Close(bool by_user) {
21   [controller_ closeBalloon:by_user];
24 gfx::Size BalloonViewBridge::GetSize() const {
25   if (controller_)
26     return gfx::Size([controller_ desiredTotalWidth],
27                      [controller_ desiredTotalHeight]);
28   else
29     return gfx::Size();
32 void BalloonViewBridge::RepositionToBalloon() {
33   [controller_ repositionToBalloon];
36 void BalloonViewBridge::Show(Balloon* balloon) {
37   controller_ = [[BalloonController alloc] initWithBalloon:balloon];
38   [controller_ setShouldCascadeWindows:NO];
39   [controller_ showWindow:nil];
42 BalloonHost* BalloonViewBridge::GetHost() const {
43   return [controller_ getHost];
46 void BalloonViewBridge::Update() {
47   [controller_ updateContents];