| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/cocoa/notifications/balloon_controller.h" | 5 #include "chrome/browser/cocoa/notifications/balloon_controller.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #import "base/cocoa_protocols_mac.h" | 9 #import "base/cocoa_protocols_mac.h" |
| 10 #import "base/scoped_nsobject.h" | 10 #import "base/scoped_nsobject.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 DCHECK(balloon_); | 87 DCHECK(balloon_); |
| 88 [self close]; | 88 [self close]; |
| 89 if (htmlContents_.get()) | 89 if (htmlContents_.get()) |
| 90 htmlContents_->Shutdown(); | 90 htmlContents_->Shutdown(); |
| 91 balloon_->OnClose(byUser); | 91 balloon_->OnClose(byUser); |
| 92 balloon_ = NULL; | 92 balloon_ = NULL; |
| 93 } | 93 } |
| 94 | 94 |
| 95 - (void)repositionToBalloon { | 95 - (void)repositionToBalloon { |
| 96 DCHECK(balloon_); | 96 DCHECK(balloon_); |
| 97 int x = balloon_->position().x(); | 97 int x = balloon_->GetPosition().x(); |
| 98 int y = balloon_->position().y(); | 98 int y = balloon_->GetPosition().y(); |
| 99 int w = [self desiredTotalWidth]; | 99 int w = [self desiredTotalWidth]; |
| 100 int h = [self desiredTotalHeight]; | 100 int h = [self desiredTotalHeight]; |
| 101 | 101 |
| 102 htmlContents_->UpdateActualSize(balloon_->content_size()); | 102 htmlContents_->UpdateActualSize(balloon_->content_size()); |
| 103 [[self window] setFrame:NSMakeRect(x, y, w, h) | 103 [[self window] setFrame:NSMakeRect(x, y, w, h) |
| 104 display:YES | 104 display:YES |
| 105 animate:YES]; | 105 animate:YES]; |
| 106 } | 106 } |
| 107 | 107 |
| 108 // Returns the total width the view should be to accommodate the balloon. | 108 // Returns the total width the view should be to accommodate the balloon. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 127 htmlContents_.reset(new BalloonViewHost(balloon_)); | 127 htmlContents_.reset(new BalloonViewHost(balloon_)); |
| 128 htmlContents_->Init(); | 128 htmlContents_->Init(); |
| 129 } | 129 } |
| 130 | 130 |
| 131 // NSWindowDelegate notification. | 131 // NSWindowDelegate notification. |
| 132 - (void)windowWillClose:(NSNotification*)notif { | 132 - (void)windowWillClose:(NSNotification*)notif { |
| 133 [self autorelease]; | 133 [self autorelease]; |
| 134 } | 134 } |
| 135 | 135 |
| 136 @end | 136 @end |
| OLD | NEW |