summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjuyik <juyik@chromium.org>2014-08-26 16:01:04 -0700
committerCommit bot <commit-bot@chromium.org>2014-08-26 23:11:20 +0000
commita7be519752f930df9510761bb578204ed79fc20c (patch)
tree039353dccf3026fe6b7827da2f7044440a13bb1d
parent83a042eb432e9a994c6202440b0a1630b4ebecbe (diff)
downloadchromium_src-a7be519752f930df9510761bb578204ed79fc20c.zip
chromium_src-a7be519752f930df9510761bb578204ed79fc20c.tar.gz
chromium_src-a7be519752f930df9510761bb578204ed79fc20c.tar.bz2
Make message center always scroll up upon notification removal.
Add a switch to enable it. This feature would fix the problem when a large notification moves downwards, it is partially obstructed. asvitkine: Please review histograms.xml BUG= Review URL: https://codereview.chromium.org/493303002 Cr-Commit-Position: refs/heads/master@{#292017}
-rw-r--r--chrome/app/generated_resources.grd8
-rw-r--r--chrome/browser/about_flags.cc12
-rw-r--r--tools/metrics/histograms/histograms.xml2
-rw-r--r--ui/message_center/BUILD.gn2
-rw-r--r--ui/message_center/message_center.gyp2
-rw-r--r--ui/message_center/message_center_switches.cc15
-rw-r--r--ui/message_center/message_center_switches.h18
-rw-r--r--ui/message_center/views/message_center_view.cc6
8 files changed, 64 insertions, 1 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 2ac3000..32cc37e 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -14697,6 +14697,14 @@ Do you accept?
<message name="IDS_FLAGS_ENABLE_EXPERIMENTAL_HOTWORDING_DESCRIPTION" desc="Description of about:flags option for hotword detection.">
Enables experimental 'Ok Google' hotword detection features, such as using the built-in extension. The hotword extension from the Chrome Web Store will no longer be used.
</message>
+
+ <!-- Message center strings -->
+ <message name="IDS_FLAGS_ENABLE_MESSAGE_CENTER_ALWAYS_SCROLL_UP_UPON_REMOVAL_NAME" desc="Name of about:flags option for message center always scroll up experiment.">
+ Enable experiments that message center always scroll up upon notification removal.
+ </message>
+ <message name="IDS_FLAGS_ENABLE_MESSAGE_CENTER_ALWAYS_SCROLL_UP_UPON_REMOVAL_DESCRIPTION" desc="Description of about:flags option for message center always scroll up experiment.">
+ Enables experiment that message center always scroll up when a notification is removed.
+ </message>
</messages>
</release>
</grit>
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index e03e238..ce9dfaf 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -46,6 +46,8 @@
#include "chrome/common/chrome_version_info.h"
#include "components/data_reduction_proxy/common/data_reduction_proxy_switches.h"
#include "components/omnibox/omnibox_switches.h"
+#else
+#include "ui/message_center/message_center_switches.h"
#endif
#if defined(USE_ASH)
@@ -1907,6 +1909,16 @@ const Experiment kExperiments[] = {
kOsAll,
MULTI_VALUE_TYPE(kAutofillSyncCredentialChoices)
},
+#if !defined(OS_ANDROID)
+ {
+ "enable-message-center-always-scroll-up-upon-notification-removal",
+ IDS_FLAGS_ENABLE_MESSAGE_CENTER_ALWAYS_SCROLL_UP_UPON_REMOVAL_NAME,
+ IDS_FLAGS_ENABLE_MESSAGE_CENTER_ALWAYS_SCROLL_UP_UPON_REMOVAL_DESCRIPTION,
+ kOsDesktop,
+ SINGLE_VALUE_TYPE(
+ switches::kEnableMessageCenterAlwaysScrollUpUponNotificationRemoval)
+ },
+#endif
// NOTE: Adding new command-line switches requires adding corresponding
// entries to enum "LoginCustomFlags" in histograms.xml. See note in
// histograms.xml and don't forget to run AboutFlagsHistogramTest unit test.
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index 278c7ee..335ca07 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -43954,6 +43954,8 @@ To add a new entry, add it with any value and run test to compute valid value.
<int value="1821723343" label="disable-saml-signin"/>
<int value="1844110073" label="enable-app-view"/>
<int value="1855524566" label="allow-insecure-websocket-from-https-origin"/>
+ <int value="1861251313"
+ label="enable-message-center-always-scroll-up-upon-notification-removal"/>
<int value="1900529524" label="disable-touch-drag-drop"/>
<int value="1906942630" label="enable-easy-unlock"/>
<int value="1930901873" label="disable-sync-app-list"/>
diff --git a/ui/message_center/BUILD.gn b/ui/message_center/BUILD.gn
index 03a6d10..bca5793 100644
--- a/ui/message_center/BUILD.gn
+++ b/ui/message_center/BUILD.gn
@@ -54,6 +54,8 @@ component("message_center") {
"message_center_tray.h",
"message_center_tray_delegate.h",
"message_center_types.h",
+ "message_center_switches.h",
+ "message_center_switches.cc",
"notification.cc",
"notification.h",
"notification_blocker.cc",
diff --git a/ui/message_center/message_center.gyp b/ui/message_center/message_center.gyp
index d163ee4..c1ece6a 100644
--- a/ui/message_center/message_center.gyp
+++ b/ui/message_center/message_center.gyp
@@ -57,6 +57,8 @@
'message_center_observer.h',
'message_center_style.cc',
'message_center_style.h',
+ 'message_center_switches.cc',
+ 'message_center_switches.h',
'message_center_tray.cc',
'message_center_tray.h',
'message_center_tray_delegate.h',
diff --git a/ui/message_center/message_center_switches.cc b/ui/message_center/message_center_switches.cc
new file mode 100644
index 0000000..4f82c1a
--- /dev/null
+++ b/ui/message_center/message_center_switches.cc
@@ -0,0 +1,15 @@
+// Copyright 2014 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/message_center_switches.h"
+
+namespace switches {
+
+// Enables message center to always move other notifications upwards when a
+// notification is removed, no matter whether the message center is displayed
+// top down or not.
+const char kEnableMessageCenterAlwaysScrollUpUponNotificationRemoval[] =
+ "enable-message-center-always-scroll-up-upon-notification-removal";
+
+} // namespace switches
diff --git a/ui/message_center/message_center_switches.h b/ui/message_center/message_center_switches.h
new file mode 100644
index 0000000..be4692e
--- /dev/null
+++ b/ui/message_center/message_center_switches.h
@@ -0,0 +1,18 @@
+// Copyright 2014 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_MESSAGE_CENTER_SWITCHES_H_
+#define UI_MESSAGE_CENTER_MESSAGE_CENTER_SWITCHES_H_
+
+#include "base/compiler_specific.h"
+#include "ui/message_center/message_center_export.h"
+
+namespace switches {
+
+MESSAGE_CENTER_EXPORT extern const char
+ kEnableMessageCenterAlwaysScrollUpUponNotificationRemoval[];
+
+} // namespace switches
+
+#endif // UI_MESSAGE_CENTER_MESSAGE_CENTER_SWITCHES_H_
diff --git a/ui/message_center/views/message_center_view.cc b/ui/message_center/views/message_center_view.cc
index 2716b39..5b3ee28 100644
--- a/ui/message_center/views/message_center_view.cc
+++ b/ui/message_center/views/message_center_view.cc
@@ -7,6 +7,7 @@
#include <list>
#include <map>
+#include "base/command_line.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/stl_util.h"
@@ -19,6 +20,7 @@
#include "ui/gfx/size.h"
#include "ui/message_center/message_center.h"
#include "ui/message_center/message_center_style.h"
+#include "ui/message_center/message_center_switches.h"
#include "ui/message_center/message_center_tray.h"
#include "ui/message_center/message_center_types.h"
#include "ui/message_center/views/message_center_button_bar.h"
@@ -418,7 +420,9 @@ void MessageListView::DoUpdateIfPossible() {
return;
}
- if (top_down_)
+ if (top_down_ ||
+ CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableMessageCenterAlwaysScrollUpUponNotificationRemoval))
AnimateNotificationsBelowTarget();
else
AnimateNotificationsAboveTarget();