Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: chrome/browser/chromeos/net/network_portal_notification_controller.cc

Issue 242483003: Move CaptivePortalDetector to src/components/captive_portal (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move CaptivePortalDetector to a component Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/net/network_portal_notification_controller.h" 5 #include "chrome/browser/chromeos/net/network_portal_notification_controller.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/system/system_notifier.h" 8 #include "ash/system/system_notifier.h"
9 #include "ash/system/tray/system_tray_notifier.h" 9 #include "ash/system/tray/system_tray_notifier.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
15 #include "base/metrics/histogram.h" 15 #include "base/metrics/histogram.h"
16 #include "base/strings/string16.h" 16 #include "base/strings/string16.h"
17 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
18 #include "chrome/browser/captive_portal/captive_portal_detector.h"
19 #include "chrome/browser/profiles/profile_manager.h" 18 #include "chrome/browser/profiles/profile_manager.h"
20 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" 19 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
21 #include "chrome/browser/ui/singleton_tabs.h" 20 #include "chrome/browser/ui/singleton_tabs.h"
22 #include "chromeos/chromeos_switches.h" 21 #include "chromeos/chromeos_switches.h"
23 #include "chromeos/network/network_state.h" 22 #include "chromeos/network/network_state.h"
23 #include "components/captive_portal/captive_portal_detector.h"
24 #include "grit/generated_resources.h" 24 #include "grit/generated_resources.h"
25 #include "grit/theme_resources.h" 25 #include "grit/theme_resources.h"
26 #include "ui/base/l10n/l10n_util.h" 26 #include "ui/base/l10n/l10n_util.h"
27 #include "ui/base/resource/resource_bundle.h" 27 #include "ui/base/resource/resource_bundle.h"
28 #include "ui/message_center/message_center.h" 28 #include "ui/message_center/message_center.h"
29 #include "ui/message_center/notification.h" 29 #include "ui/message_center/notification.h"
30 #include "ui/message_center/notification_types.h" 30 #include "ui/message_center/notification_types.h"
31 #include "ui/message_center/notifier_settings.h" 31 #include "ui/message_center/notifier_settings.h"
32 32
33 using message_center::Notification; 33 using message_center::Notification;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 NetworkPortalNotificationController::~NetworkPortalNotificationController() {} 130 NetworkPortalNotificationController::~NetworkPortalNotificationController() {}
131 131
132 void NetworkPortalNotificationController::OnPortalDetectionCompleted( 132 void NetworkPortalNotificationController::OnPortalDetectionCompleted(
133 const NetworkState* network, 133 const NetworkState* network,
134 const NetworkPortalDetector::CaptivePortalState& state) { 134 const NetworkPortalDetector::CaptivePortalState& state) {
135 if (!IsPortalNotificationEnabled()) 135 if (!IsPortalNotificationEnabled())
136 return; 136 return;
137 137
138 if (!network || 138 if (!network ||
139 state.status != NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL) { 139 state.status != captive_portal::CAPTIVE_PORTAL_STATUS_PORTAL) {
140 last_network_path_.clear(); 140 last_network_path_.clear();
141 CloseNotification(); 141 CloseNotification();
142 return; 142 return;
143 } 143 }
144 144
145 // Don't do anything if notification for |network| already was 145 // Don't do anything if notification for |network| already was
146 // displayed. 146 // displayed.
147 if (network->path() == last_network_path_) 147 if (network->path() == last_network_path_)
148 return; 148 return;
149 last_network_path_ = network->path(); 149 last_network_path_ = network->path();
(...skipping 20 matching lines...) Expand all
170 if (ash::Shell::HasInstance()) { 170 if (ash::Shell::HasInstance()) {
171 ash::Shell::GetInstance() 171 ash::Shell::GetInstance()
172 ->system_tray_notifier() 172 ->system_tray_notifier()
173 ->NotifyOnCaptivePortalDetected(network->path()); 173 ->NotifyOnCaptivePortalDetected(network->path());
174 } 174 }
175 175
176 message_center::MessageCenter::Get()->AddNotification(notification.Pass()); 176 message_center::MessageCenter::Get()->AddNotification(notification.Pass());
177 } 177 }
178 178
179 } // namespace chromeos 179 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698