summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ash/system/system_notifier.cc2
-rw-r--r--ash/system/system_notifier.h1
-rw-r--r--chrome/app/chromeos_strings.grdp16
-rw-r--r--chrome/browser/about_flags.cc9
-rw-r--r--chrome/browser/chromeos/net/network_portal_detector_impl.cc1
-rw-r--r--chrome/browser/chromeos/net/network_portal_detector_impl.h4
-rw-r--r--chrome/browser/chromeos/net/network_portal_notification_controller.cc136
-rw-r--r--chrome/browser/chromeos/net/network_portal_notification_controller.h37
-rw-r--r--chrome/browser/chromeos/net/network_portal_notification_controller_unittest.cc199
-rw-r--r--chrome/chrome_browser_chromeos.gypi2
-rw-r--r--chrome/chrome_tests_unit.gypi1
-rw-r--r--chromeos/chromeos_switches.cc8
-rw-r--r--chromeos/chromeos_switches.h2
13 files changed, 418 insertions, 0 deletions
diff --git a/ash/system/system_notifier.cc b/ash/system/system_notifier.cc
index 4958937..e0bc939 100644
--- a/ash/system/system_notifier.cc
+++ b/ash/system/system_notifier.cc
@@ -29,6 +29,7 @@ const char* kAshSystemNotifiers[] = {
kNotifierMultiProfileFirstRun,
kNotifierNetwork,
kNotifierNetworkError,
+ kNotifierNetworkPortalDetector,
kNotifierScreenshot,
kNotifierScreenCapture,
kNotifierScreenShare,
@@ -59,6 +60,7 @@ const char kNotifierLocallyManagedUser[] = "ash.locally-managed-user";
const char kNotifierMultiProfileFirstRun[] = "ash.multi-profile.first-run";
const char kNotifierNetwork[] = "ash.network";
const char kNotifierNetworkError[] = "ash.network.error";
+const char kNotifierNetworkPortalDetector[] = "ash.network.portal-detector";
const char kNotifierScreenshot[] = "ash.screenshot";
const char kNotifierScreenCapture[] = "ash.screen-capture";
const char kNotifierScreenShare[] = "ash.screen-share";
diff --git a/ash/system/system_notifier.h b/ash/system/system_notifier.h
index df99eac..8aacb5a 100644
--- a/ash/system/system_notifier.h
+++ b/ash/system/system_notifier.h
@@ -22,6 +22,7 @@ ASH_EXPORT extern const char kNotifierLocallyManagedUser[];
ASH_EXPORT extern const char kNotifierMultiProfileFirstRun[];
ASH_EXPORT extern const char kNotifierNetwork[];
ASH_EXPORT extern const char kNotifierNetworkError[];
+ASH_EXPORT extern const char kNotifierNetworkPortalDetector[];
ASH_EXPORT extern const char kNotifierScreenshot[];
ASH_EXPORT extern const char kNotifierScreenCapture[];
ASH_EXPORT extern const char kNotifierScreenShare[];
diff --git a/chrome/app/chromeos_strings.grdp b/chrome/app/chromeos_strings.grdp
index d2de8bb..3d680b1 100644
--- a/chrome/app/chromeos_strings.grdp
+++ b/chrome/app/chromeos_strings.grdp
@@ -4967,4 +4967,20 @@ All users must sign out to continue.
Check charger
</message>
+ <!-- Network portal notification -->
+ <message name="IDS_FLAGS_NETWORK_PORTAL_NOTIFICATION_NAME" desc="Title for the flag to enable/disable notifications about captive portals.">
+ Notifications about captive portals
+ </message>
+ <message name="IDS_FLAGS_NETWORK_PORTAL_NOTIFICATION_DESCRIPTION" desc="Description for the flag to enable/disable notifications about captive portals.">
+ If enabled, notification is displayed when device is connected to a network behind captive portal.
+ </message>
+ <message name="IDS_PORTAL_DETECTION_NOTIFICATION_TITLE" desc="Title for the system notification that current network is behind captive portal">
+ Action required to connect
+ </message>
+ <message name="IDS_PORTAL_DETECTION_NOTIFICATION_MESSAGE" desc="Body of the system notification that current network is behind captive portal">
+ To use <ph name="NETWORK_ID">$1<ex>Public Wifi</ex></ph> you need to visit the network's login page.
+ </message>
+ <message name="IDS_PORTAL_DETECTION_NOTIFICATION_SIGNIN_BUTTON" desc="Label on the button on the system notification that current network is behind captive portal. When clicked, captive portal login page is opened.">
+ Go to login page
+ </message>
</grit-part>
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 12f529d..b76c6d1 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -1012,6 +1012,15 @@ const Experiment kExperiments[] = {
ash::switches::kAshEnableImmersiveFullscreenForAllWindows,
ash::switches::kAshEnableImmersiveFullscreenForBrowserOnly)
},
+ {
+ "network-portal-notification",
+ IDS_FLAGS_NETWORK_PORTAL_NOTIFICATION_NAME,
+ IDS_FLAGS_NETWORK_PORTAL_NOTIFICATION_DESCRIPTION,
+ kOsCrOS,
+ ENABLE_DISABLE_VALUE_TYPE(
+ chromeos::switches::kEnableNetworkPortalNotification,
+ chromeos::switches::kDisableNetworkPortalNotification)
+ },
#endif
{
"enable-download-resumption",
diff --git a/chrome/browser/chromeos/net/network_portal_detector_impl.cc b/chrome/browser/chromeos/net/network_portal_detector_impl.cc
index 86b2a6e..aeb2e01a 100644
--- a/chrome/browser/chromeos/net/network_portal_detector_impl.cc
+++ b/chrome/browser/chromeos/net/network_portal_detector_impl.cc
@@ -488,6 +488,7 @@ void NetworkPortalDetectorImpl::NotifyPortalDetectionCompleted(
const CaptivePortalState& state) {
FOR_EACH_OBSERVER(Observer, observers_,
OnPortalDetectionCompleted(network, state));
+ notification_controller_.OnPortalDetectionCompleted(network, state);
}
base::TimeTicks NetworkPortalDetectorImpl::GetCurrentTimeTicks() const {
diff --git a/chrome/browser/chromeos/net/network_portal_detector_impl.h b/chrome/browser/chromeos/net/network_portal_detector_impl.h
index 642c67e..11433b3 100644
--- a/chrome/browser/chromeos/net/network_portal_detector_impl.h
+++ b/chrome/browser/chromeos/net/network_portal_detector_impl.h
@@ -19,6 +19,7 @@
#include "base/time/time.h"
#include "chrome/browser/captive_portal/captive_portal_detector.h"
#include "chrome/browser/chromeos/net/network_portal_detector.h"
+#include "chrome/browser/chromeos/net/network_portal_notification_controller.h"
#include "chromeos/network/network_state_handler_observer.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -259,6 +260,9 @@ class NetworkPortalDetectorImpl
// True if |request_timeout_for_testing_| is initialized.
bool request_timeout_for_testing_initialized_;
+ // UI notification controller about captive portal state.
+ NetworkPortalNotificationController notification_controller_;
+
content::NotificationRegistrar registrar_;
DISALLOW_COPY_AND_ASSIGN(NetworkPortalDetectorImpl);
diff --git a/chrome/browser/chromeos/net/network_portal_notification_controller.cc b/chrome/browser/chromeos/net/network_portal_notification_controller.cc
new file mode 100644
index 0000000..c190fa1
--- /dev/null
+++ b/chrome/browser/chromeos/net/network_portal_notification_controller.cc
@@ -0,0 +1,136 @@
+// 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 "chrome/browser/chromeos/net/network_portal_notification_controller.h"
+
+#include "ash/system/system_notifier.h"
+#include "base/basictypes.h"
+#include "base/command_line.h"
+#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/message_loop/message_loop.h"
+#include "base/strings/string16.h"
+#include "base/strings/utf_string_conversions.h"
+#include "chrome/browser/captive_portal/captive_portal_detector.h"
+#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
+#include "chrome/browser/ui/singleton_tabs.h"
+#include "chromeos/chromeos_switches.h"
+#include "chromeos/network/network_state.h"
+#include "grit/generated_resources.h"
+#include "grit/theme_resources.h"
+#include "ui/base/l10n/l10n_util.h"
+#include "ui/base/resource/resource_bundle.h"
+#include "ui/message_center/message_center.h"
+#include "ui/message_center/notification.h"
+#include "ui/message_center/notification_types.h"
+#include "ui/message_center/notifier_settings.h"
+
+using message_center::Notification;
+
+namespace chromeos {
+
+namespace {
+
+bool IsPortalNotificationEnabled() {
+ return CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableNetworkPortalNotification);
+}
+
+
+void CloseNotification() {
+ message_center::MessageCenter::Get()->RemoveNotification(
+ NetworkPortalNotificationController::kNotificationId, false);
+}
+
+class NetworkPortalNotificationControllerDelegate
+ : public message_center::NotificationDelegate {
+ public:
+ NetworkPortalNotificationControllerDelegate() {}
+
+ // Overridden from message_center::NotificationDelegate:
+ virtual void Display() OVERRIDE {}
+ virtual void Error() OVERRIDE {}
+ virtual void Close(bool /* by_user */) OVERRIDE {}
+ virtual void Click() OVERRIDE {}
+ virtual void ButtonClick(int button_index) OVERRIDE;
+
+ private:
+ virtual ~NetworkPortalNotificationControllerDelegate() {}
+
+ DISALLOW_COPY_AND_ASSIGN(NetworkPortalNotificationControllerDelegate);
+};
+
+void NetworkPortalNotificationControllerDelegate::ButtonClick(
+ int button_index) {
+ if (!button_index)
+ return;
+ Profile* profile = ProfileManager::GetActiveUserProfile();
+ if (!profile)
+ return;
+ chrome::ScopedTabbedBrowserDisplayer displayer(profile,
+ chrome::HOST_DESKTOP_TYPE_ASH);
+ GURL url(captive_portal::CaptivePortalDetector::kDefaultURL);
+ chrome::ShowSingletonTab(displayer.browser(), url);
+
+ CloseNotification();
+}
+
+} // namespace
+
+const char NetworkPortalNotificationController::kNotificationId[] =
+ "chrome://net/network_portal_detector";
+
+NetworkPortalNotificationController::NetworkPortalNotificationController() {}
+
+NetworkPortalNotificationController::~NetworkPortalNotificationController() {}
+
+void NetworkPortalNotificationController::OnPortalDetectionCompleted(
+ const NetworkState* network,
+ const NetworkPortalDetector::CaptivePortalState& state) {
+ if (!IsPortalNotificationEnabled())
+ return;
+
+ if (!network ||
+ state.status != NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL) {
+ last_network_path_.clear();
+ CloseNotification();
+ return;
+ }
+
+ // Don't do anything if notification for |network| already was
+ // displayed.
+ if (network->path() == last_network_path_)
+ return;
+ last_network_path_ = network->path();
+
+ ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
+ gfx::Image& icon = bundle.GetImageNamed(IDR_PORTAL_DETECTION_ALERT);
+ message_center::NotifierId notifier_id(
+ message_center::NotifierId::SYSTEM_COMPONENT,
+ ash::system_notifier::kNotifierNetworkPortalDetector);
+
+ message_center::ButtonInfo signin_button(l10n_util::GetStringUTF16(
+ IDS_PORTAL_DETECTION_NOTIFICATION_SIGNIN_BUTTON));
+ signin_button.icon = bundle.GetImageNamed(IDR_PORTAL_DETECTION_GLOBE);
+ message_center::RichNotificationData data;
+ data.buttons.push_back(signin_button);
+
+ scoped_ptr<Notification> notification(new Notification(
+ message_center::NOTIFICATION_TYPE_SIMPLE,
+ kNotificationId,
+ l10n_util::GetStringUTF16(IDS_PORTAL_DETECTION_NOTIFICATION_TITLE),
+ l10n_util::GetStringFUTF16(IDS_PORTAL_DETECTION_NOTIFICATION_MESSAGE,
+ base::UTF8ToUTF16(network->name())),
+ icon,
+ base::string16() /* display_source */,
+ notifier_id,
+ data,
+ new NetworkPortalNotificationControllerDelegate()));
+ notification->SetSystemPriority();
+
+ message_center::MessageCenter::Get()->AddNotification(notification.Pass());
+}
+
+} // namespace chromeos
diff --git a/chrome/browser/chromeos/net/network_portal_notification_controller.h b/chrome/browser/chromeos/net/network_portal_notification_controller.h
new file mode 100644
index 0000000..6160858
--- /dev/null
+++ b/chrome/browser/chromeos/net/network_portal_notification_controller.h
@@ -0,0 +1,37 @@
+// 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 CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_NOTIFICATION_CONTROLLER_H_
+#define CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_NOTIFICATION_CONTROLLER_H_
+
+#include <string>
+
+#include "base/macros.h"
+#include "chrome/browser/chromeos/net/network_portal_detector.h"
+
+namespace chromeos {
+
+class NetworkState;
+
+class NetworkPortalNotificationController {
+ public:
+ static const char kNotificationId[];
+
+ NetworkPortalNotificationController();
+ virtual ~NetworkPortalNotificationController();
+
+ void OnPortalDetectionCompleted(
+ const NetworkState* network,
+ const NetworkPortalDetector::CaptivePortalState& state);
+
+ private:
+ // Last network path for which notification was displayed.
+ std::string last_network_path_;
+
+ DISALLOW_COPY_AND_ASSIGN(NetworkPortalNotificationController);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_NOTIFICATION_CONTROLLER_H_
diff --git a/chrome/browser/chromeos/net/network_portal_notification_controller_unittest.cc b/chrome/browser/chromeos/net/network_portal_notification_controller_unittest.cc
new file mode 100644
index 0000000..b502658
--- /dev/null
+++ b/chrome/browser/chromeos/net/network_portal_notification_controller_unittest.cc
@@ -0,0 +1,199 @@
+// 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 "base/command_line.h"
+#include "chrome/browser/chromeos/net/network_portal_notification_controller.h"
+#include "chromeos/chromeos_switches.h"
+#include "chromeos/network/network_state.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/message_center/message_center.h"
+#include "ui/message_center/message_center_observer.h"
+
+using message_center::MessageCenter;
+
+namespace chromeos {
+
+namespace {
+
+const char* kNotificationId =
+ NetworkPortalNotificationController::kNotificationId;
+
+bool HasNotification() {
+ return MessageCenter::Get()->HasNotification(kNotificationId);
+}
+
+class NotificationObserver : public message_center::MessageCenterObserver {
+ public:
+ NotificationObserver() : add_count_(0), remove_count_(0), update_count_(0) {}
+
+ // Overridden from message_center::MessageCenterObserver:
+ virtual void OnNotificationAdded(
+ const std::string& notification_id) OVERRIDE {
+ if (notification_id == kNotificationId)
+ ++add_count_;
+ }
+
+ virtual void OnNotificationRemoved(const std::string& notification_id,
+ bool /* by_user */) OVERRIDE {
+ if (notification_id == kNotificationId)
+ ++remove_count_;
+ }
+
+ virtual void OnNotificationUpdated(
+ const std::string& notification_id) OVERRIDE {
+ if (notification_id == kNotificationId)
+ ++update_count_;
+ }
+
+ unsigned add_count() const { return add_count_; }
+ unsigned remove_count() const { return remove_count_; }
+ unsigned update_count() const { return update_count_; }
+
+ private:
+ unsigned add_count_;
+ unsigned remove_count_;
+ unsigned update_count_;
+
+ DISALLOW_COPY_AND_ASSIGN(NotificationObserver);
+};
+
+} // namespace
+
+class NetworkPortalNotificationControllerTest : public testing::Test {
+ public:
+ NetworkPortalNotificationControllerTest() {}
+ virtual ~NetworkPortalNotificationControllerTest() {}
+
+ virtual void SetUp() OVERRIDE {
+ CommandLine* cl = CommandLine::ForCurrentProcess();
+ cl->AppendSwitch(switches::kEnableNetworkPortalNotification);
+ MessageCenter::Initialize();
+ MessageCenter::Get()->AddObserver(&observer_);
+ }
+
+ virtual void TearDown() OVERRIDE {
+ MessageCenter::Get()->RemoveObserver(&observer_);
+ MessageCenter::Shutdown();
+ }
+
+ protected:
+ void OnPortalDetectionCompleted(
+ const NetworkState* network,
+ const NetworkPortalDetector::CaptivePortalState& state) {
+ controller_.OnPortalDetectionCompleted(network, state);
+ }
+
+ NotificationObserver& observer() { return observer_; }
+
+ private:
+ NetworkPortalNotificationController controller_;
+ NotificationObserver observer_;
+
+ DISALLOW_COPY_AND_ASSIGN(NetworkPortalNotificationControllerTest);
+};
+
+TEST_F(NetworkPortalNotificationControllerTest, NetworkStateChanged) {
+ NetworkState wifi("wifi");
+ NetworkPortalDetector::CaptivePortalState wifi_state;
+
+ // Notification is not displayed for online state.
+ wifi_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE;
+ wifi_state.response_code = 204;
+ OnPortalDetectionCompleted(&wifi, wifi_state);
+ ASSERT_FALSE(HasNotification());
+
+ // Notification is displayed for portal state
+ wifi_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL;
+ wifi_state.response_code = 200;
+ OnPortalDetectionCompleted(&wifi, wifi_state);
+ ASSERT_TRUE(HasNotification());
+
+ // Notification is closed for online state.
+ wifi_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE;
+ wifi_state.response_code = 204;
+ OnPortalDetectionCompleted(&wifi, wifi_state);
+ ASSERT_FALSE(HasNotification());
+}
+
+TEST_F(NetworkPortalNotificationControllerTest, NetworkChanged) {
+ NetworkState wifi1("wifi1");
+ NetworkPortalDetector::CaptivePortalState wifi1_state;
+ wifi1_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL;
+ wifi1_state.response_code = 200;
+ OnPortalDetectionCompleted(&wifi1, wifi1_state);
+ ASSERT_TRUE(HasNotification());
+
+ MessageCenter::Get()->RemoveNotification(kNotificationId, true /* by_user */);
+ ASSERT_FALSE(HasNotification());
+
+ // User already closed notification about portal state for this network,
+ // so notification shouldn't be displayed second time.
+ OnPortalDetectionCompleted(&wifi1, wifi1_state);
+ ASSERT_FALSE(HasNotification());
+
+ NetworkState wifi2("wifi2");
+ NetworkPortalDetector::CaptivePortalState wifi2_state;
+ wifi2_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE;
+ wifi2_state.response_code = 204;
+
+ // Second network is in online state, so there shouldn't be any
+ // notifications.
+ OnPortalDetectionCompleted(&wifi2, wifi2_state);
+ ASSERT_FALSE(HasNotification());
+
+ // User switches back to the first network, so notification should
+ // be displayed.
+ OnPortalDetectionCompleted(&wifi1, wifi1_state);
+ ASSERT_TRUE(HasNotification());
+}
+
+TEST_F(NetworkPortalNotificationControllerTest, NotificationUpdated) {
+ NetworkPortalDetector::CaptivePortalState portal_state;
+ portal_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL;
+ portal_state.response_code = 200;
+
+ // First network is behind a captive portal, so notification should
+ // be displayed.
+ NetworkState wifi1("wifi1");
+ OnPortalDetectionCompleted(&wifi1, portal_state);
+ ASSERT_TRUE(HasNotification());
+ EXPECT_EQ(1u, observer().add_count());
+ EXPECT_EQ(0u, observer().remove_count());
+ EXPECT_EQ(0u, observer().update_count());
+
+ // Second network is also behind a captive portal, so notification
+ // should be updated.
+ NetworkState wifi2("wifi2");
+ OnPortalDetectionCompleted(&wifi2, portal_state);
+ ASSERT_TRUE(HasNotification());
+ EXPECT_EQ(1u, observer().add_count());
+ EXPECT_EQ(0u, observer().remove_count());
+ EXPECT_EQ(1u, observer().update_count());
+
+ // User closes the notification.
+ MessageCenter::Get()->RemoveNotification(kNotificationId, true /* by_user */);
+ ASSERT_FALSE(HasNotification());
+ EXPECT_EQ(1u, observer().add_count());
+ EXPECT_EQ(1u, observer().remove_count());
+ EXPECT_EQ(1u, observer().update_count());
+
+ // Portal detector notified that second network is still behind captive
+ // portal, but user already closed the notification, so there should
+ // not be any notifications.
+ OnPortalDetectionCompleted(&wifi2, portal_state);
+ ASSERT_FALSE(HasNotification());
+ EXPECT_EQ(1u, observer().add_count());
+ EXPECT_EQ(1u, observer().remove_count());
+ EXPECT_EQ(1u, observer().update_count());
+
+ // Network was switched (by shill or by user) to wifi1. Notification
+ // should be displayed.
+ OnPortalDetectionCompleted(&wifi1, portal_state);
+ ASSERT_TRUE(HasNotification());
+ EXPECT_EQ(2u, observer().add_count());
+ EXPECT_EQ(1u, observer().remove_count());
+ EXPECT_EQ(1u, observer().update_count());
+}
+
+} // namespace chromeos
diff --git a/chrome/chrome_browser_chromeos.gypi b/chrome/chrome_browser_chromeos.gypi
index 6aaa8d9..bc22354 100644
--- a/chrome/chrome_browser_chromeos.gypi
+++ b/chrome/chrome_browser_chromeos.gypi
@@ -663,6 +663,8 @@
'browser/chromeos/net/network_portal_detector_impl.h',
'browser/chromeos/net/network_portal_detector_test_impl.cc',
'browser/chromeos/net/network_portal_detector_test_impl.h',
+ 'browser/chromeos/net/network_portal_notification_controller.cc',
+ 'browser/chromeos/net/network_portal_notification_controller.h',
'browser/chromeos/net/onc_utils.cc',
'browser/chromeos/net/onc_utils.h',
'browser/chromeos/net/proxy_config_handler.cc',
diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi
index d6619dc..bb20573 100644
--- a/chrome/chrome_tests_unit.gypi
+++ b/chrome/chrome_tests_unit.gypi
@@ -737,6 +737,7 @@
'browser/chromeos/mobile_config_unittest.cc',
'browser/chromeos/net/cert_verify_proc_chromeos_unittest.cc',
'browser/chromeos/net/network_portal_detector_impl_unittest.cc',
+ 'browser/chromeos/net/network_portal_notification_controller_unittest.cc',
'browser/chromeos/net/onc_utils_unittest.cc',
'browser/chromeos/offline/offline_load_page_unittest.cc',
'browser/chromeos/options/network_property_ui_data_unittest.cc',
diff --git a/chromeos/chromeos_switches.cc b/chromeos/chromeos_switches.cc
index be26de1..028b30a 100644
--- a/chromeos/chromeos_switches.cc
+++ b/chromeos/chromeos_switches.cc
@@ -63,6 +63,10 @@ const char kDisableQuickofficeComponentApp[] =
// Disables volume adjust sound.
const char kDisableVolumeAdjustSound[] = "disable-volume-adjust-sound";
+// Disables notifications about captive portals in session.
+const char kDisableNetworkPortalNotification[] =
+ "disable-network-portal-notification";
+
// Disables fetching online CrOS EULA page, only static version is shown.
const char kDisableOnlineEULA[] = "disable-cros-online-eula";
@@ -85,6 +89,10 @@ const char kEnableBackgroundLoader[] = "enable-background-loader";
// Enables switching between different cellular carriers from the UI.
const char kEnableCarrierSwitching[] = "enable-carrier-switching";
+// Enables notifications about captive portals in session.
+const char kEnableNetworkPortalNotification[] =
+ "enable-network-portal-notification";
+
// Enable "interactive" mode for stub implemenations (e.g. NetworkStateHandler)
const char kEnableStubInteractive[] = "enable-stub-interactive";
diff --git a/chromeos/chromeos_switches.h b/chromeos/chromeos_switches.h
index 8523d78..722fde6 100644
--- a/chromeos/chromeos_switches.h
+++ b/chromeos/chromeos_switches.h
@@ -33,6 +33,7 @@ CHROMEOS_EXPORT extern const char kDisableEnterpriseUserReporting[];
CHROMEOS_EXPORT extern const char kDisableGeniusApp[];
CHROMEOS_EXPORT extern const char kDisableLocalAccounts[];
CHROMEOS_EXPORT extern const char kDisableLoginAnimations[];
+CHROMEOS_EXPORT extern const char kDisableNetworkPortalNotification[];
CHROMEOS_EXPORT extern const char kDisableNewChannelSwitcherUI[];
CHROMEOS_EXPORT extern const char kDisableNewKioskUI[];
CHROMEOS_EXPORT extern const char kDisableOOBEBlockingUpdate[];
@@ -44,6 +45,7 @@ CHROMEOS_EXPORT extern const char kEchoExtensionPath[];
CHROMEOS_EXPORT extern const char kEnableBackgroundLoader[];
CHROMEOS_EXPORT extern const char kEnableCarrierSwitching[];
CHROMEOS_EXPORT extern const char kEnableKioskMode[];
+CHROMEOS_EXPORT extern const char kEnableNetworkPortalNotification[];
CHROMEOS_EXPORT extern const char kEnableRequestTabletSite[];
CHROMEOS_EXPORT extern const char kEnableStubInteractive[];
CHROMEOS_EXPORT extern const char kEnableStubPortalledWifi[];