summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-21 03:15:22 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-21 03:15:22 +0000
commitc82366ff60db9e8995bdf1c3d2f7598c0c81d38c (patch)
treed536917564c55d40873fe8f67fbfd1ac090587cd
parent34de05eb66c7d65c1df44b99658b4e4dd4aa7ca4 (diff)
downloadchromium_src-c82366ff60db9e8995bdf1c3d2f7598c0c81d38c.zip
chromium_src-c82366ff60db9e8995bdf1c3d2f7598c0c81d38c.tar.gz
chromium_src-c82366ff60db9e8995bdf1c3d2f7598c0c81d38c.tar.bz2
Make notification panel vertically resizable.
Dismiss all non sticky when the panel is closed. BUG=chromium-os:4771, chromium-os:3847 TEST=added new TestCloseDissmissAllNonSticky test Review URL: http://codereview.chromium.org/3029006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53148 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/frame/panel_browser_view.cc5
-rw-r--r--chrome/browser/chromeos/frame/panel_controller.cc4
-rw-r--r--chrome/browser/chromeos/frame/panel_controller.h4
-rw-r--r--chrome/browser/chromeos/notifications/notification_browsertest.cc23
-rw-r--r--chrome/browser/chromeos/notifications/notification_panel.cc19
5 files changed, 49 insertions, 6 deletions
diff --git a/chrome/browser/chromeos/frame/panel_browser_view.cc b/chrome/browser/chromeos/frame/panel_browser_view.cc
index 0dda082..0d72579 100644
--- a/chrome/browser/chromeos/frame/panel_browser_view.cc
+++ b/chrome/browser/chromeos/frame/panel_browser_view.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/chromeos/frame/panel_browser_view.h"
#include "chrome/browser/chromeos/frame/panel_controller.h"
+#include "third_party/cros/chromeos_wm_ipc_enums.h"
#include "views/window/window.h"
namespace chromeos {
@@ -36,7 +37,9 @@ void PanelBrowserView::Init() {
void PanelBrowserView::Show() {
panel_controller_.reset(new PanelController(this, GetNativeHandle()));
- panel_controller_->Init(true /* focus when opened */, bounds(), creator_xid_);
+ panel_controller_->Init(
+ true /* focus when opened */, bounds(), creator_xid_,
+ WM_IPC_PANEL_USER_RESIZE_HORIZONTALLY_AND_VERTICALLY);
BrowserView::Show();
}
diff --git a/chrome/browser/chromeos/frame/panel_controller.cc b/chrome/browser/chromeos/frame/panel_controller.cc
index 4eafa12..3446b38 100644
--- a/chrome/browser/chromeos/frame/panel_controller.cc
+++ b/chrome/browser/chromeos/frame/panel_controller.cc
@@ -90,7 +90,8 @@ PanelController::PanelController(Delegate* delegate,
void PanelController::Init(bool initial_focus,
const gfx::Rect& window_bounds,
- XID creator_xid) {
+ XID creator_xid,
+ WmIpcPanelUserResizeType resize_type) {
gfx::Rect title_bounds(
0, 0, window_bounds.width(), kTitleHeight);
@@ -110,6 +111,7 @@ void PanelController::Init(bool initial_focus,
type_params.push_back(expanded_ ? 1 : 0);
type_params.push_back(initial_focus ? 1 : 0);
type_params.push_back(creator_xid);
+ type_params.push_back(resize_type);
WmIpc::instance()->SetWindowType(
GTK_WIDGET(panel_),
WM_IPC_WINDOW_CHROME_PANEL_CONTENT,
diff --git a/chrome/browser/chromeos/frame/panel_controller.h b/chrome/browser/chromeos/frame/panel_controller.h
index 63b1898..32be295 100644
--- a/chrome/browser/chromeos/frame/panel_controller.h
+++ b/chrome/browser/chromeos/frame/panel_controller.h
@@ -9,6 +9,7 @@
#include "app/x11_util.h"
#include "views/controls/button/button.h"
+#include "third_party/cros/chromeos_wm_ipc_enums.h"
class BrowserView;
class SkBitmap;
@@ -52,7 +53,8 @@ class PanelController {
// Initializes the panel controller with the initial state of the focus and
// the window bounds.
- void Init(bool initial_focus, const gfx::Rect& init_bounds, XID creator_xid);
+ void Init(bool initial_focus, const gfx::Rect& init_bounds, XID creator_xid,
+ WmIpcPanelUserResizeType resize_type);
bool TitleMousePressed(const views::MouseEvent& event);
void TitleMouseReleased(const views::MouseEvent& event, bool canceled);
diff --git a/chrome/browser/chromeos/notifications/notification_browsertest.cc b/chrome/browser/chromeos/notifications/notification_browsertest.cc
index 304b5d2..a1e1152 100644
--- a/chrome/browser/chromeos/notifications/notification_browsertest.cc
+++ b/chrome/browser/chromeos/notifications/notification_browsertest.cc
@@ -523,4 +523,27 @@ IN_PROC_BROWSER_TEST_F(NotificationTest, TestActivateDeactivate) {
EXPECT_FALSE(tester->IsActive(view2));
}
+IN_PROC_BROWSER_TEST_F(NotificationTest, TestCloseDismissAllNonSticky) {
+ BalloonCollectionImpl* collection = GetBalloonCollectionImpl();
+ NotificationPanel* panel = GetNotificationPanel();
+ NotificationPanelTester* tester = panel->GetTester();
+ Profile* profile = browser()->profile();
+
+ collection->Add(NewMockNotification("1"), profile);
+ collection->AddSystemNotification(
+ NewMockNotification("2"), profile, true, false);
+ collection->Add(NewMockNotification("3"), profile);
+
+ ui_test_utils::RunAllPendingInMessageLoop();
+ EXPECT_EQ(NotificationPanel::STICKY_AND_NEW, tester->state());
+ EXPECT_EQ(3, tester->GetNotificationCount());
+ EXPECT_EQ(1, tester->GetStickyNotificationCount());
+
+ // Hide
+ panel->Hide();
+ ui_test_utils::RunAllPendingInMessageLoop();
+ EXPECT_EQ(1, tester->GetNotificationCount());
+ EXPECT_EQ(1, tester->GetStickyNotificationCount());
+}
+
} // namespace chromeos
diff --git a/chrome/browser/chromeos/notifications/notification_panel.cc b/chrome/browser/chromeos/notifications/notification_panel.cc
index 96b00b9..0f53f9f 100644
--- a/chrome/browser/chromeos/notifications/notification_panel.cc
+++ b/chrome/browser/chromeos/notifications/notification_panel.cc
@@ -12,6 +12,7 @@
#include "chrome/browser/chromeos/notifications/balloon_view.h"
#include "gfx/canvas.h"
#include "grit/generated_resources.h"
+#include "third_party/cros/chromeos_wm_ipc_enums.h"
#include "views/background.h"
#include "views/controls/native/native_view_host.h"
#include "views/controls/scroll_view.h"
@@ -227,6 +228,14 @@ class BalloonSubContainer : public views::View {
}
}
+ void DismissAll() {
+ for (int i = GetChildViewCount() - 1; i >= 0; --i) {
+ BalloonViewImpl* view =
+ static_cast<BalloonViewImpl*>(GetChildViewAt(i));
+ view->Close(true);
+ }
+ }
+
BalloonViewImpl* FindBalloonView(const Notification& notification) {
for (int i = GetChildViewCount() - 1; i >= 0; --i) {
BalloonViewImpl* view =
@@ -380,6 +389,10 @@ class BalloonContainer : public views::View {
non_sticky_container_->MakeAllStale();
}
+ void DismissAllNonSticky() {
+ non_sticky_container_->DismissAll();
+ }
+
BalloonViewImpl* FindBalloonView(const Notification& notification) {
BalloonViewImpl* view = sticky_container_->FindBalloonView(notification);
return view ? view : non_sticky_container_->FindBalloonView(notification);
@@ -458,7 +471,8 @@ void NotificationPanel::Show() {
panel_controller_.reset(
new PanelController(this, GTK_WINDOW(panel_widget_->GetNativeView())));
panel_controller_->Init(false /* don't focus when opened */,
- gfx::Rect(0, 0, kBalloonMinWidth, 1), 0);
+ gfx::Rect(0, 0, kBalloonMinWidth, 1), 0,
+ WM_IPC_PANEL_USER_RESIZE_VERTICALLY);
registrar_.Add(this, NotificationType::PANEL_STATE_CHANGED,
Source<PanelController>(panel_controller_.get()));
}
@@ -466,6 +480,7 @@ void NotificationPanel::Show() {
}
void NotificationPanel::Hide() {
+ balloon_container_->DismissAllNonSticky();
if (panel_widget_) {
container_host_->GetRootView()->RemoveChildView(balloon_container_.get());
@@ -638,7 +653,6 @@ void NotificationPanel::OnMouseLeave() {
void NotificationPanel::OnMouseMotion(const gfx::Point& point) {
SetActiveView(balloon_container_->FindBalloonView(point));
-
SET_STATE(KEEP_SIZE);
}
@@ -705,7 +719,6 @@ void NotificationPanel::UpdatePanel(bool update_container_size) {
break;
}
case CLOSED:
- balloon_container_->MakeAllStale();
Hide();
break;
case MINIMIZED: