summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chromeos/notifications/balloon_collection_impl.cc4
-rw-r--r--chrome/browser/chromeos/notifications/balloon_collection_impl.h4
-rw-r--r--chrome/browser/chromeos/notifications/notification_panel.cc22
-rw-r--r--chrome/browser/notifications/balloon_host.h2
-rw-r--r--chrome/browser/views/notifications/balloon_view_host.cc1
5 files changed, 11 insertions, 22 deletions
diff --git a/chrome/browser/chromeos/notifications/balloon_collection_impl.cc b/chrome/browser/chromeos/notifications/balloon_collection_impl.cc
index 19932ec..732edbc 100644
--- a/chrome/browser/chromeos/notifications/balloon_collection_impl.cc
+++ b/chrome/browser/chromeos/notifications/balloon_collection_impl.cc
@@ -46,9 +46,6 @@ class NotificationMatcher {
namespace chromeos {
-const int BalloonCollectionImpl::kBalloonWidth = 300;
-const int BalloonCollectionImpl::kBalloonMinHeight = 24;
-
BalloonCollectionImpl::BalloonCollectionImpl()
: notification_ui_(new NotificationPanel()) {
registrar_.Add(this, NotificationType::BROWSER_CLOSED,
@@ -162,7 +159,6 @@ Balloon* BalloonCollectionImpl::MakeBalloon(const Notification& notification,
Profile* profile) {
Balloon* new_balloon = new Balloon(notification, profile, this);
new_balloon->set_view(new chromeos::BalloonViewImpl(false, true));
- new_balloon->set_content_size(gfx::Size(kBalloonWidth, kBalloonMinHeight));
return new_balloon;
}
diff --git a/chrome/browser/chromeos/notifications/balloon_collection_impl.h b/chrome/browser/chromeos/notifications/balloon_collection_impl.h
index 6547561..a7c2051 100644
--- a/chrome/browser/chromeos/notifications/balloon_collection_impl.h
+++ b/chrome/browser/chromeos/notifications/balloon_collection_impl.h
@@ -84,10 +84,6 @@ class BalloonCollectionImpl : public BalloonCollection,
return notification_ui_.get();
}
- // The width and the minimum hight of a balloon.
- static const int kBalloonWidth;
- static const int kBalloonMinHeight;
-
protected:
// Creates a new balloon. Overridable by unit tests. The caller is
// responsible for freeing the pointer returned.
diff --git a/chrome/browser/chromeos/notifications/notification_panel.cc b/chrome/browser/chromeos/notifications/notification_panel.cc
index ec3b66f..b055510 100644
--- a/chrome/browser/chromeos/notifications/notification_panel.cc
+++ b/chrome/browser/chromeos/notifications/notification_panel.cc
@@ -19,7 +19,10 @@
#define SET_STATE(state) SetState(state, __PRETTY_FUNCTION__)
namespace {
-// Maximum size of balloon's height.
+// Minimum and maximum size of balloon content.
+const int kBalloonMinWidth = 300;
+const int kBalloonMaxWidth = 300;
+const int kBalloonMinHeight = 24;
const int kBalloonMaxHeight = 120;
// Maximum height of the notification panel.
@@ -186,7 +189,7 @@ namespace chromeos {
class BalloonContainer : public views::View {
public:
- explicit BalloonContainer(int margin)
+ BalloonContainer(int margin)
: margin_(margin),
sticky_container_(new BalloonSubContainer(margin)),
non_sticky_container_(new BalloonSubContainer(margin)) {
@@ -332,9 +335,7 @@ NotificationPanel::NotificationPanel()
: balloon_container_(NULL),
state_(CLOSED),
task_factory_(this),
- min_bounds_(0, 0,
- BalloonCollectionImpl::kBalloonWidth,
- BalloonCollectionImpl::kBalloonMinHeight),
+ min_bounds_(0, 0, kBalloonMinWidth, kBalloonMinHeight),
stale_timeout_(1000 * kStaleTimeoutInSeconds) {
Init();
}
@@ -363,9 +364,7 @@ void NotificationPanel::Show() {
panel_controller_.reset(
new PanelController(this,
GTK_WINDOW(panel_widget_->GetNativeView()),
- gfx::Rect(0, 0,
- BalloonCollectionImpl::kBalloonWidth,
- 1)));
+ gfx::Rect(0, 0, kBalloonMinWidth, 1)));
registrar_.Add(this, NotificationType::PANEL_STATE_CHANGED,
Source<PanelController>(panel_controller_.get()));
}
@@ -432,8 +431,9 @@ void NotificationPanel::ResizeNotification(
Balloon* balloon, const gfx::Size& size) {
// restrict to the min & max sizes
gfx::Size real_size(
- BalloonCollectionImpl::kBalloonWidth,
- std::max(BalloonCollectionImpl::kBalloonMinHeight,
+ std::max(kBalloonMinWidth,
+ std::min(kBalloonMaxWidth, size.width())),
+ std::max(kBalloonMinHeight,
std::min(kBalloonMaxHeight, size.height())));
balloon->set_content_size(real_size);
static_cast<BalloonViewImpl*>(balloon->view())->Layout();
@@ -532,7 +532,7 @@ void NotificationPanel::UpdatePanel(bool contents_changed) {
balloon_container_->UpdateBounds();
scroll_view_->Layout();
}
- switch (state_) {
+ switch(state_) {
case KEEP_SIZE: {
gfx::Rect min_bounds = GetPreferredBounds();
gfx::Rect panel_bounds;
diff --git a/chrome/browser/notifications/balloon_host.h b/chrome/browser/notifications/balloon_host.h
index 29f3d33..521d898 100644
--- a/chrome/browser/notifications/balloon_host.h
+++ b/chrome/browser/notifications/balloon_host.h
@@ -115,8 +115,6 @@ class BalloonHost : public RenderViewHostDelegate,
// Owned pointer to the host for the renderer process.
RenderViewHost* render_view_host_;
- const Balloon* balloon() const { return balloon_; }
-
private:
// Called to send an event that the balloon has been disconnected from
// a renderer (if should_notify_on_disconnect_ is true).
diff --git a/chrome/browser/views/notifications/balloon_view_host.cc b/chrome/browser/views/notifications/balloon_view_host.cc
index 3ca4656..b2c2a5c 100644
--- a/chrome/browser/views/notifications/balloon_view_host.cc
+++ b/chrome/browser/views/notifications/balloon_view_host.cc
@@ -75,7 +75,6 @@ void BalloonViewHost::InitRenderWidgetHostView() {
static_cast<RenderWidgetHostViewGtk*>(render_widget_host_view_);
view_gtk->InitAsChild();
native_host_->Attach(view_gtk->native_view());
- view_gtk->SetSize(balloon()->content_size());
#else
NOTIMPLEMENTED();
#endif