summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/notifications/balloon_view_bridge.mm
blob: 9edf9522078e92d9d3567bef5e9b6a3cfc9b053a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright (c) 2010 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 "chrome/browser/cocoa/notifications/balloon_view_bridge.h"

#import <Cocoa/Cocoa.h>

BalloonViewBridge::BalloonViewBridge() :
    controller_(NULL) {
}

BalloonViewBridge::~BalloonViewBridge() {
}

void BalloonViewBridge::Close(bool by_user) {
  [controller_ closeBalloon:by_user];
}

gfx::Size BalloonViewBridge::GetSize() const {
  if (controller_)
    return gfx::Size([controller_ desiredTotalWidth],
                     [controller_ desiredTotalHeight]);
  else
    return gfx::Size();
}

void BalloonViewBridge::RepositionToBalloon() {
  [controller_ repositionToBalloon];
}

void BalloonViewBridge::Show(Balloon* balloon) {
  controller_ = [[BalloonController alloc] initWithBalloon:balloon];
  [controller_ showWindow:nil];
}

BalloonHost* BalloonViewBridge::GetHost() const {
  return [controller_ getHost];
}