summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ash/system/web_notification/web_notification_tray.cc62
-rw-r--r--ash/system/web_notification/web_notification_tray.h22
-rw-r--r--chrome/browser/ui/views/message_center/web_notification_tray_win.cc44
-rw-r--r--chrome/browser/ui/views/message_center/web_notification_tray_win.h9
-rw-r--r--ui/message_center/message_center.gyp2
-rw-r--r--ui/message_center/message_center_tray.cc50
-rw-r--r--ui/message_center/message_center_tray.h19
-rw-r--r--ui/message_center/views/quiet_mode_bubble.cc122
-rw-r--r--ui/message_center/views/quiet_mode_bubble.h58
9 files changed, 103 insertions, 285 deletions
diff --git a/ash/system/web_notification/web_notification_tray.cc b/ash/system/web_notification/web_notification_tray.cc
index cfc1e1c..98f3770 100644
--- a/ash/system/web_notification/web_notification_tray.cc
+++ b/ash/system/web_notification/web_notification_tray.cc
@@ -25,10 +25,10 @@
#include "ui/message_center/views/message_center_bubble.h"
#include "ui/message_center/views/message_popup_bubble.h"
#include "ui/message_center/views/message_popup_collection.h"
-#include "ui/message_center/views/quiet_mode_bubble.h"
#include "ui/views/bubble/tray_bubble_view.h"
#include "ui/views/controls/button/image_button.h"
-#include "ui/views/widget/widget_observer.h"
+#include "ui/views/controls/menu/menu_model_adapter.h"
+#include "ui/views/controls/menu/menu_runner.h"
#if defined(OS_CHROMEOS)
@@ -107,9 +107,6 @@ WebNotificationTray::~WebNotificationTray() {
message_center_bubble_.reset();
popup_bubble_.reset();
popup_collection_.reset();
- if (quiet_mode_bubble() && quiet_mode_bubble()->GetBubbleWidget())
- quiet_mode_bubble()->GetBubbleWidget()->RemoveObserver(this);
- quiet_mode_bubble_.reset();
}
// Public methods.
@@ -217,7 +214,24 @@ bool WebNotificationTray::ShouldShowMessageCenter() {
status_area_widget()->ShouldShowWebNotifications();
}
-bool WebNotificationTray::ShouldShowQuietModeBubble(const ui::Event& event) {
+void WebNotificationTray::ShowQuietModeMenu() {
+ views::MenuModelAdapter menu_model_adapter(
+ message_center_tray_->CreateQuietModeMenu());
+ quiet_mode_menu_runner_.reset(
+ new views::MenuRunner(menu_model_adapter.CreateMenu()));
+ gfx::Point point;
+ views::View::ConvertPointToScreen(this, &point);
+ ignore_result(quiet_mode_menu_runner_->RunMenuAt(
+ GetWidget(),
+ NULL,
+ gfx::Rect(point, bounds().size()),
+ views::MenuItemView::BUBBLE_ABOVE,
+ views::MenuRunner::HAS_MNEMONICS));
+ quiet_mode_menu_runner_.reset();
+ GetShelfLayoutManager()->UpdateAutoHideState();
+}
+
+bool WebNotificationTray::ShouldShowQuietModeMenu(const ui::Event& event) {
// TODO(mukai): Add keyboard event handler.
if (!event.IsMouseEvent())
return false;
@@ -228,18 +242,6 @@ bool WebNotificationTray::ShouldShowQuietModeBubble(const ui::Event& event) {
return mouse_event->IsRightMouseButton();
}
-void WebNotificationTray::ShowQuietModeBubble() {
- aura::Window* parent = Shell::GetContainer(
- Shell::GetPrimaryRootWindow(),
- internal::kShellWindowId_SettingBubbleContainer);
- quiet_mode_bubble_.reset(new message_center::QuietModeBubble(
- button_,
- parent,
- message_center_tray_->message_center()->notification_list()));
- quiet_mode_bubble()->GetBubbleWidget()->StackAtTop();
- quiet_mode_bubble()->GetBubbleWidget()->AddObserver(this);
-}
-
void WebNotificationTray::UpdateAfterLoginStatusChange(
user::LoginStatus login_status) {
if (message_center::IsRichNotificationEnabled()) {
@@ -264,7 +266,8 @@ void WebNotificationTray::UpdateAfterLoginStatusChange(
}
bool WebNotificationTray::ShouldBlockLauncherAutoHide() const {
- return IsMessageCenterBubbleVisible() || quiet_mode_bubble() != NULL;
+ return IsMessageCenterBubbleVisible() ||
+ (quiet_mode_menu_runner_.get() && quiet_mode_menu_runner_->IsRunning());
}
bool WebNotificationTray::IsMessageCenterBubbleVisible() const {
@@ -306,9 +309,6 @@ void WebNotificationTray::AnchorUpdated() {
message_center_bubble()->bubble_view()->UpdateBubble();
UpdateBubbleViewArrow(message_center_bubble()->bubble_view());
}
- // Quiet mode settings bubble has to be on top.
- if (quiet_mode_bubble() && quiet_mode_bubble()->GetBubbleWidget())
- quiet_mode_bubble()->GetBubbleWidget()->StackAtTop();
}
string16 WebNotificationTray::GetAccessibleNameForTray() {
@@ -328,11 +328,11 @@ void WebNotificationTray::HideBubbleWithView(
}
bool WebNotificationTray::PerformAction(const ui::Event& event) {
- if (!quiet_mode_bubble() && ShouldShowQuietModeBubble(event)) {
- ShowQuietModeBubble();
+ if (ShouldShowQuietModeMenu(event)) {
+ ShowQuietModeMenu();
return true;
}
- quiet_mode_bubble_.reset();
+
if (message_center_bubble())
message_center_tray_->HideMessageCenterBubble();
else
@@ -378,13 +378,6 @@ void WebNotificationTray::ButtonPressed(views::Button* sender,
PerformAction(event);
}
-void WebNotificationTray::OnWidgetDestroying(views::Widget* widget) {
- if (quiet_mode_bubble() && quiet_mode_bubble()->GetBubbleWidget() == widget) {
- widget->RemoveObserver(this);
- }
- quiet_mode_bubble_.reset();
-}
-
void WebNotificationTray::OnMessageCenterTrayChanged() {
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
message_center::MessageCenter* message_center =
@@ -424,10 +417,9 @@ void WebNotificationTray::OnMessageCenterTrayChanged() {
}
bool WebNotificationTray::ClickedOutsideBubble() {
- // Only hide the message center and quiet mode bubble.
- if (!message_center_bubble() && !quiet_mode_bubble())
+ // Only hide the message center.
+ if (!message_center_bubble())
return false;
- quiet_mode_bubble_.reset();
message_center_tray_->HideMessageCenterBubble();
return true;
}
diff --git a/ash/system/web_notification/web_notification_tray.h b/ash/system/web_notification/web_notification_tray.h
index 923d2cf..ed3e45d 100644
--- a/ash/system/web_notification/web_notification_tray.h
+++ b/ash/system/web_notification/web_notification_tray.h
@@ -14,7 +14,6 @@
#include "ui/message_center/message_center_tray_delegate.h"
#include "ui/views/bubble/tray_bubble_view.h"
#include "ui/views/controls/button/button.h"
-#include "ui/views/widget/widget_observer.h"
// Status area tray for showing browser and app notifications. This hosts
// a MessageCenter class which manages the notification list. This class
@@ -26,6 +25,7 @@
namespace views {
class ImageButton;
+class MenuRunner;
}
namespace message_center {
@@ -47,8 +47,7 @@ class ASH_EXPORT WebNotificationTray
: public internal::TrayBackgroundView,
public views::TrayBubbleView::Delegate,
public message_center::MessageCenterTrayDelegate,
- public views::ButtonListener,
- public views::WidgetObserver {
+ public views::ButtonListener {
public:
explicit WebNotificationTray(
internal::StatusAreaWidget* status_area_widget);
@@ -97,9 +96,6 @@ class ASH_EXPORT WebNotificationTray
virtual void ButtonPressed(views::Button* sender,
const ui::Event& event) OVERRIDE;
- // Overridden from WidgetObserver.
- virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE;
-
// Overridden from MessageCenterTrayDelegate.
virtual void OnMessageCenterTrayChanged() OVERRIDE;
virtual bool ShowMessageCenter() OVERRIDE;
@@ -122,11 +118,11 @@ class ASH_EXPORT WebNotificationTray
// the message center.
bool ShouldShowMessageCenter();
- // Returns true if it should show the quiet mode bubble.
- bool ShouldShowQuietModeBubble(const ui::Event& event);
+ // Returns true if it should show the quiet mode menu.
+ bool ShouldShowQuietModeMenu(const ui::Event& event);
- // Shows the quiet mode bubble.
- void ShowQuietModeBubble();
+ // Shows the quiet mode menu.
+ void ShowQuietModeMenu();
internal::WebNotificationBubbleWrapper* message_center_bubble() const {
return message_center_bubble_.get();
@@ -136,10 +132,6 @@ class ASH_EXPORT WebNotificationTray
return popup_bubble_.get();
}
- message_center::QuietModeBubble* quiet_mode_bubble() const {
- return quiet_mode_bubble_.get();
- }
-
// Testing accessors.
bool IsPopupVisible() const;
message_center::MessageCenterBubble* GetMessageCenterBubbleForTest();
@@ -149,7 +141,7 @@ class ASH_EXPORT WebNotificationTray
scoped_ptr<internal::WebNotificationBubbleWrapper> message_center_bubble_;
scoped_ptr<internal::WebNotificationBubbleWrapper> popup_bubble_;
scoped_ptr<message_center::MessagePopupCollection> popup_collection_;
- scoped_ptr<message_center::QuietModeBubble> quiet_mode_bubble_;
+ scoped_ptr<views::MenuRunner> quiet_mode_menu_runner_;
views::ImageButton* button_;
bool show_message_center_on_unlock_;
diff --git a/chrome/browser/ui/views/message_center/web_notification_tray_win.cc b/chrome/browser/ui/views/message_center/web_notification_tray_win.cc
index 2d06fa4..d2f77c6 100644
--- a/chrome/browser/ui/views/message_center/web_notification_tray_win.cc
+++ b/chrome/browser/ui/views/message_center/web_notification_tray_win.cc
@@ -30,11 +30,6 @@
namespace {
-// Menu commands
-const int kToggleQuietMode = 0;
-const int kEnableQuietModeHour = 1;
-const int kEnableQuietModeDay = 2;
-
// Tray constants
const int kScreenEdgePadding = 2;
@@ -251,46 +246,9 @@ void WebNotificationTrayWin::HideBubbleWithView(
}
}
-bool WebNotificationTrayWin::IsCommandIdChecked(int command_id) const {
- if (command_id != kToggleQuietMode)
- return false;
- return message_center_tray_->message_center()->quiet_mode();
-}
-
-bool WebNotificationTrayWin::IsCommandIdEnabled(int command_id) const {
- return true;
-}
-
-bool WebNotificationTrayWin::GetAcceleratorForCommandId(
- int command_id,
- ui::Accelerator* accelerator) {
- return false;
-}
-
-void WebNotificationTrayWin::ExecuteCommand(int command_id) {
- if (command_id == kToggleQuietMode) {
- bool in_quiet_mode = message_center()->quiet_mode();
- message_center()->notification_list()->SetQuietMode(!in_quiet_mode);
- return;
- }
- base::TimeDelta expires_in = command_id == kEnableQuietModeDay ?
- base::TimeDelta::FromDays(1):
- base::TimeDelta::FromHours(1);
- message_center()->notification_list()->EnterQuietModeWithExpire(expires_in);
-}
-
void WebNotificationTrayWin::AddQuietModeMenu(StatusIcon* status_icon) {
DCHECK(status_icon);
- ui::SimpleMenuModel* menu = new ui::SimpleMenuModel(this);
-
- menu->AddCheckItem(kToggleQuietMode,
- l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_QUIET_MODE));
- menu->AddItem(kEnableQuietModeHour,
- l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_QUIET_MODE_1HOUR));
- menu->AddItem(kEnableQuietModeDay,
- l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_QUIET_MODE_1DAY));
-
- status_icon->SetContextMenu(menu);
+ status_icon->SetContextMenu(message_center_tray_->CreateQuietModeMenu());
}
message_center::MessageCenterBubble*
diff --git a/chrome/browser/ui/views/message_center/web_notification_tray_win.h b/chrome/browser/ui/views/message_center/web_notification_tray_win.h
index 5d874c3..1fc397c 100644
--- a/chrome/browser/ui/views/message_center/web_notification_tray_win.h
+++ b/chrome/browser/ui/views/message_center/web_notification_tray_win.h
@@ -35,7 +35,6 @@ class NotificationBubbleWrapperWin;
// tray icon on click.
class WebNotificationTrayWin
: public message_center::MessageCenterTrayDelegate,
- public ui::SimpleMenuModel::Delegate,
public StatusIconObserver {
public:
WebNotificationTrayWin();
@@ -67,14 +66,6 @@ class WebNotificationTrayWin
void UpdateStatusIcon();
void HideBubbleWithView(const views::TrayBubbleView* bubble_view);
- // SimpleMenuModel::Delegate implementation.
- virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
- virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
- virtual bool GetAcceleratorForCommandId(
- int command_id,
- ui::Accelerator* accelerator) OVERRIDE;
- virtual void ExecuteCommand(int command_id) OVERRIDE;
-
private:
FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayWinTest, WebNotifications);
FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayWinTest,
diff --git a/ui/message_center/message_center.gyp b/ui/message_center/message_center.gyp
index 7b39a6a..04847d1 100644
--- a/ui/message_center/message_center.gyp
+++ b/ui/message_center/message_center.gyp
@@ -62,8 +62,6 @@
'views/notifier_settings_view.h',
'views/notification_view.cc',
'views/notification_view.h',
- 'views/quiet_mode_bubble.cc',
- 'views/quiet_mode_bubble.h',
],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [ 4267, ],
diff --git a/ui/message_center/message_center_tray.cc b/ui/message_center/message_center_tray.cc
index 81c3bcd..bf02437 100644
--- a/ui/message_center/message_center_tray.cc
+++ b/ui/message_center/message_center_tray.cc
@@ -6,9 +6,19 @@
#include "base/observer_list.h"
#include "base/utf_string_conversions.h"
+#include "grit/ui_strings.h"
+#include "ui/base/l10n/l10n_util.h"
#include "ui/message_center/message_center_tray_delegate.h"
namespace message_center {
+namespace {
+
+// Menu commands
+const int kToggleQuietMode = 0;
+const int kEnableQuietModeHour = 1;
+const int kEnableQuietModeDay = 2;
+
+}
MessageCenterTray::MessageCenterTray(
MessageCenterTrayDelegate* delegate,
@@ -84,6 +94,18 @@ bool MessageCenterTray::HidePopupBubble() {
return true;
}
+ui::MenuModel* MessageCenterTray::CreateQuietModeMenu() {
+ ui::SimpleMenuModel* menu = new ui::SimpleMenuModel(this);
+
+ menu->AddCheckItem(kToggleQuietMode,
+ l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_QUIET_MODE));
+ menu->AddItem(kEnableQuietModeHour,
+ l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_QUIET_MODE_1HOUR));
+ menu->AddItem(kEnableQuietModeDay,
+ l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_QUIET_MODE_1DAY));
+ return menu;
+}
+
void MessageCenterTray::OnMessageCenterChanged(bool new_notification) {
if (message_center_visible_) {
if (message_center_->NotificationCount() == 0)
@@ -104,6 +126,34 @@ void MessageCenterTray::OnMessageCenterChanged(bool new_notification) {
NotifyMessageCenterTrayChanged();
}
+bool MessageCenterTray::IsCommandIdChecked(int command_id) const {
+ if (command_id != kToggleQuietMode)
+ return false;
+ return message_center()->quiet_mode();
+}
+
+bool MessageCenterTray::IsCommandIdEnabled(int command_id) const {
+ return true;
+}
+
+bool MessageCenterTray::GetAcceleratorForCommandId(
+ int command_id,
+ ui::Accelerator* accelerator) {
+ return false;
+}
+
+void MessageCenterTray::ExecuteCommand(int command_id) {
+ if (command_id == kToggleQuietMode) {
+ bool in_quiet_mode = message_center()->quiet_mode();
+ message_center()->notification_list()->SetQuietMode(!in_quiet_mode);
+ return;
+ }
+ base::TimeDelta expires_in = command_id == kEnableQuietModeDay ?
+ base::TimeDelta::FromDays(1):
+ base::TimeDelta::FromHours(1);
+ message_center()->notification_list()->EnterQuietModeWithExpire(expires_in);
+}
+
void MessageCenterTray::NotifyMessageCenterTrayChanged() {
delegate_->OnMessageCenterTrayChanged();
}
diff --git a/ui/message_center/message_center_tray.h b/ui/message_center/message_center_tray.h
index 4d7f98a0..f40026f 100644
--- a/ui/message_center/message_center_tray.h
+++ b/ui/message_center/message_center_tray.h
@@ -6,6 +6,7 @@
#define UI_MESSAGE_CENTER_MESSAGE_CENTER_TRAY_H_
#include "base/observer_list.h"
+#include "ui/base/models/simple_menu_model.h"
#include "ui/message_center/message_center.h"
#include "ui/message_center/message_center_export.h"
#include "ui/message_center/message_center_tray_delegate.h"
@@ -24,7 +25,8 @@ MessageCenterTrayDelegate* CreateMessageCenterTray();
// bubbles. Tells the MessageCenterTrayHost when the tray is changed, as well
// as when bubbles are shown and hidden.
class MESSAGE_CENTER_EXPORT MessageCenterTray
- : public message_center::MessageCenter::Observer {
+ : public message_center::MessageCenter::Observer,
+ public ui::SimpleMenuModel::Delegate {
public:
MessageCenterTray(MessageCenterTrayDelegate* delegate,
message_center::MessageCenter* message_center);
@@ -46,14 +48,29 @@ class MESSAGE_CENTER_EXPORT MessageCenterTray
// Returns whether the popup was visible before.
bool HidePopupBubble();
+ // Creates the menu model for quiet mode and returns it. The caller must
+ // take the ownership of the return value.
+ ui::MenuModel* CreateQuietModeMenu();
+
bool message_center_visible() { return message_center_visible_; }
bool popups_visible() { return popups_visible_; }
MessageCenterTrayDelegate* delegate() { return delegate_; }
+ const message_center::MessageCenter* message_center() const {
+ return message_center_;
+ }
message_center::MessageCenter* message_center() { return message_center_; }
// Overridden from message_center::MessageCenter::Observer.
virtual void OnMessageCenterChanged(bool new_notification) OVERRIDE;
+ // Overridden from SimpleMenuModel::Delegate.
+ virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
+ virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
+ virtual bool GetAcceleratorForCommandId(
+ int command_id,
+ ui::Accelerator* accelerator) OVERRIDE;
+ virtual void ExecuteCommand(int command_id) OVERRIDE;
+
private:
void NotifyMessageCenterTrayChanged();
diff --git a/ui/message_center/views/quiet_mode_bubble.cc b/ui/message_center/views/quiet_mode_bubble.cc
deleted file mode 100644
index 36a63a9..0000000
--- a/ui/message_center/views/quiet_mode_bubble.cc
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright (c) 2012 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 "ui/message_center/views/quiet_mode_bubble.h"
-
-#include "base/time.h"
-#include "grit/ui_strings.h"
-#include "third_party/skia/include/core/SkColor.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/gfx/insets.h"
-#include "ui/message_center/notification_list.h"
-#include "ui/views/border.h"
-#include "ui/views/bubble/bubble_delegate.h"
-#include "ui/views/controls/button/text_button.h"
-#include "ui/views/layout/box_layout.h"
-#include "ui/views/view.h"
-#include "ui/views/widget/widget.h"
-
-namespace {
-
-const int kButtonVerticalMargin = 10;
-const int kButtonHorizontalMargin = 20;
-const SkColor kButtonNormalBackgroundColor = SK_ColorWHITE;
-const SkColor kButtonHoveredBackgroundColor = SkColorSetRGB(0xf5, 0xf5, 0xf5);
-
-class QuietModeButton : public views::TextButton {
- public:
- QuietModeButton(views::ButtonListener* listener, int message_id)
- : views::TextButton(listener, l10n_util::GetStringUTF16(message_id)) {
- set_border(views::Border::CreateEmptyBorder(
- kButtonVerticalMargin, kButtonHorizontalMargin,
- kButtonVerticalMargin, kButtonHorizontalMargin));
- set_alignment(views::TextButtonBase::ALIGN_LEFT);
- set_background(views::Background::CreateSolidBackground(
- kButtonNormalBackgroundColor));
- }
-
- protected:
- virtual void StateChanged() OVERRIDE {
- set_background(views::Background::CreateSolidBackground(
- (state() == views::CustomButton::STATE_HOVERED) ?
- kButtonHoveredBackgroundColor : kButtonNormalBackgroundColor));
- }
-};
-
-} // namespace
-
-namespace message_center {
-
-QuietModeBubble::QuietModeBubble(views::View* anchor_view,
- gfx::NativeView parent_window,
- NotificationList* notification_list)
- : notification_list_(notification_list) {
- DCHECK(notification_list_);
- bubble_ = new views::BubbleDelegateView(
- anchor_view, views::BubbleBorder::BOTTOM_RIGHT);
- bubble_->set_notify_enter_exit_on_child(true);
-
- if (views::View::get_use_acceleration_when_possible()) {
- bubble_->SetPaintToLayer(true);
- bubble_->SetFillsBoundsOpaquely(true);
- }
-
- bubble_->set_parent_window(parent_window);
- bubble_->set_margins(gfx::Insets());
- InitializeBubbleContents();
- views::BubbleDelegateView::CreateBubble(bubble_);
- bubble_->Show();
-}
-
-QuietModeBubble::~QuietModeBubble() {
- Close();
-}
-
-void QuietModeBubble::Close() {
- if (bubble_) {
- bubble_->GetWidget()->Close();
- bubble_ = NULL;
- quiet_mode_ = NULL;
- quiet_mode_1hour_ = NULL;
- quiet_mode_1day_ = NULL;
- }
-}
-
-views::Widget* QuietModeBubble::GetBubbleWidget() {
- return bubble_ ? bubble_->GetWidget() : NULL;
-}
-
-void QuietModeBubble::InitializeBubbleContents() {
- views::View* contents_view = bubble_->GetContentsView();
- contents_view->SetLayoutManager(
- new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1));
- // TODO(mukai): Determine the actual UI to denote "enter/exit" quiet mode.
- quiet_mode_ = new QuietModeButton(
- this, (notification_list_->quiet_mode()) ?
- IDS_MESSAGE_CENTER_QUIET_MODE_EXIT : IDS_MESSAGE_CENTER_QUIET_MODE);
- contents_view->AddChildView(quiet_mode_);
- quiet_mode_1hour_ = new QuietModeButton(
- this, IDS_MESSAGE_CENTER_QUIET_MODE_1HOUR);
- contents_view->AddChildView(quiet_mode_1hour_);
- quiet_mode_1day_ = new QuietModeButton(
- this, IDS_MESSAGE_CENTER_QUIET_MODE_1DAY);
- contents_view->AddChildView(quiet_mode_1day_);
-}
-
-void QuietModeBubble::ButtonPressed(views::Button* sender,
- const ui::Event& event) {
- DCHECK(sender == quiet_mode_ ||
- sender == quiet_mode_1hour_ || sender == quiet_mode_1day_);
- if (sender == quiet_mode_) {
- notification_list_->SetQuietMode(!notification_list_->quiet_mode());
- LOG(INFO) << notification_list_->quiet_mode();
- } else {
- base::TimeDelta expires_in = (sender == quiet_mode_1day_) ?
- base::TimeDelta::FromDays(1) : base::TimeDelta::FromHours(1);
- notification_list_->EnterQuietModeWithExpire(expires_in);
- }
- Close();
-}
-
-} // namespace message_center
diff --git a/ui/message_center/views/quiet_mode_bubble.h b/ui/message_center/views/quiet_mode_bubble.h
deleted file mode 100644
index 79c92c5..0000000
--- a/ui/message_center/views/quiet_mode_bubble.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (c) 2012 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.
-
-#ifndef UI_MESSAGE_CENTER_VIEWS_QUIET_MODE_BUBBLE_H_
-#define UI_MESSAGE_CENTER_VIEWS_QUIET_MODE_BUBBLE_H_
-
-#include "base/string16.h"
-#include "ui/gfx/native_widget_types.h"
-#include "ui/message_center/message_center_export.h"
-#include "ui/views/controls/button/button.h"
-
-namespace views {
-class BubbleDelegateView;
-class View;
-class Widget;
-}
-
-namespace message_center {
-class NotificationList;
-
-// The bubble for the quiet mode selection. Note that this isn't TrayBubbleView
-// or MessageBubbleBase because its UI is slightly different.
-class MESSAGE_CENTER_EXPORT QuietModeBubble : public views::ButtonListener {
- public:
- QuietModeBubble(views::View* anchor_view,
- gfx::NativeView parent_window,
- NotificationList* notification_list);
- virtual ~QuietModeBubble();
-
- // Close the quiet mode bubble.
- void Close();
-
- // Returns the widget for the bubble.
- views::Widget* GetBubbleWidget();
-
- private:
- // Initialize the contents of the bubble.
- void InitializeBubbleContents();
-
- // views::ButtonListener overrides:
- virtual void ButtonPressed(views::Button* sender,
- const ui::Event& event) OVERRIDE;
-
- NotificationList* notification_list_;
- views::BubbleDelegateView* bubble_;
-
- // Buttons. Used in ButtonPressed() to check which button is pressed.
- views::Button* quiet_mode_;
- views::Button* quiet_mode_1hour_;
- views::Button* quiet_mode_1day_;
-
- DISALLOW_COPY_AND_ASSIGN(QuietModeBubble);
-};
-
-} // namespace messge_center
-
-#endif // UI_MESSAGE_CENTER_VIEWS_QUIET_MODE_BUBBLE_H_