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

Side by Side Diff: chrome/browser/chromeos/status/data_promo_notification.cc

Issue 1106173003: Uma stats for Data Saver prompt (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « no previous file | tools/metrics/actions/actions.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/status/data_promo_notification.h" 5 #include "chrome/browser/chromeos/status/data_promo_notification.h"
6 6
7 #include "ash/system/system_notifier.h" 7 #include "ash/system/system_notifier.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/prefs/pref_registry_simple.h" 9 #include "base/prefs/pref_registry_simple.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 10 matching lines...) Expand all
21 #include "chrome/common/extensions/extension_constants.h" 21 #include "chrome/common/extensions/extension_constants.h"
22 #include "chrome/common/pref_names.h" 22 #include "chrome/common/pref_names.h"
23 #include "chrome/grit/generated_resources.h" 23 #include "chrome/grit/generated_resources.h"
24 #include "chromeos/chromeos_switches.h" 24 #include "chromeos/chromeos_switches.h"
25 #include "chromeos/login/login_state.h" 25 #include "chromeos/login/login_state.h"
26 #include "chromeos/network/device_state.h" 26 #include "chromeos/network/device_state.h"
27 #include "chromeos/network/network_connection_handler.h" 27 #include "chromeos/network/network_connection_handler.h"
28 #include "chromeos/network/network_event_log.h" 28 #include "chromeos/network/network_event_log.h"
29 #include "chromeos/network/network_state.h" 29 #include "chromeos/network/network_state.h"
30 #include "chromeos/network/network_state_handler.h" 30 #include "chromeos/network/network_state_handler.h"
31 #include "content/public/browser/user_metrics.h"
31 #include "extensions/browser/extension_registry.h" 32 #include "extensions/browser/extension_registry.h"
32 #include "grit/ui_chromeos_resources.h" 33 #include "grit/ui_chromeos_resources.h"
33 #include "third_party/cros_system_api/dbus/service_constants.h" 34 #include "third_party/cros_system_api/dbus/service_constants.h"
34 #include "ui/base/l10n/l10n_util.h" 35 #include "ui/base/l10n/l10n_util.h"
35 #include "ui/base/resource/resource_bundle.h" 36 #include "ui/base/resource/resource_bundle.h"
36 #include "ui/chromeos/network/network_connect.h" 37 #include "ui/chromeos/network/network_connect.h"
37 #include "ui/chromeos/network/network_state_notifier.h" 38 #include "ui/chromeos/network/network_state_notifier.h"
38 #include "ui/message_center/message_center.h" 39 #include "ui/message_center/message_center.h"
39 #include "ui/message_center/notification.h" 40 #include "ui/message_center/notification.h"
40 #include "ui/views/view.h" 41 #include "ui/views/view.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 } 165 }
165 return deal; 166 return deal;
166 } 167 }
167 168
168 void NotificationClicked(const std::string& service_path, 169 void NotificationClicked(const std::string& service_path,
169 const std::string& info_url) { 170 const std::string& info_url) {
170 if (!info_url.empty()) { 171 if (!info_url.empty()) {
171 chrome::ScopedTabbedBrowserDisplayer displayer( 172 chrome::ScopedTabbedBrowserDisplayer displayer(
172 ProfileManager::GetPrimaryUserProfile(), chrome::HOST_DESKTOP_TYPE_ASH); 173 ProfileManager::GetPrimaryUserProfile(), chrome::HOST_DESKTOP_TYPE_ASH);
173 chrome::ShowSingletonTab(displayer.browser(), GURL(info_url)); 174 chrome::ShowSingletonTab(displayer.browser(), GURL(info_url));
175 if (info_url == kDataSaverExtensionUrl)
176 content::RecordAction(base::UserMetricsAction("DataSaverPrompt_Clicked"));
174 } else { 177 } else {
175 ui::NetworkConnect::Get()->ShowNetworkSettingsForPath(service_path); 178 ui::NetworkConnect::Get()->ShowNetworkSettingsForPath(service_path);
176 } 179 }
177 } 180 }
178 181
179 } // namespace 182 } // namespace
180 183
181 //////////////////////////////////////////////////////////////////////////////// 184 ////////////////////////////////////////////////////////////////////////////////
182 // DataPromoNotification 185 // DataPromoNotification
183 186
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 base::string16 message = l10n_util::GetStringUTF16(IDS_3G_DATASAVER_MESSAGE); 304 base::string16 message = l10n_util::GetStringUTF16(IDS_3G_DATASAVER_MESSAGE);
302 const gfx::Image& icon = 305 const gfx::Image& icon =
303 ui::ResourceBundle::GetSharedInstance().GetImageNamed( 306 ui::ResourceBundle::GetSharedInstance().GetImageNamed(
304 IDR_AURA_UBER_TRAY_NOTIFICATION_DATASAVER); 307 IDR_AURA_UBER_TRAY_NOTIFICATION_DATASAVER);
305 308
306 message_center::MessageCenter::Get()->AddNotification( 309 message_center::MessageCenter::Get()->AddNotification(
307 message_center::Notification::CreateSystemNotification( 310 message_center::Notification::CreateSystemNotification(
308 kDataSaverNotificationId, title, message, icon, 311 kDataSaverNotificationId, title, message, icon,
309 ui::NetworkStateNotifier::kNotifierNetwork, 312 ui::NetworkStateNotifier::kNotifierNetwork,
310 base::Bind(&NotificationClicked, "", kDataSaverExtensionUrl))); 313 base::Bind(&NotificationClicked, "", kDataSaverExtensionUrl)));
314 content::RecordAction(base::UserMetricsAction("DataSaverPrompt_Shown"));
311 315
312 if (DataSaverSwitchDemoMode()) { 316 if (DataSaverSwitchDemoMode()) {
313 SetDataSaverPromptsShown(0); // demo mode resets times shown counts. 317 SetDataSaverPromptsShown(0); // demo mode resets times shown counts.
314 SetShow3gPromoNotification(true); 318 SetShow3gPromoNotification(true);
315 } else { 319 } else {
316 SetDataSaverPromptsShown(times_shown + 1); 320 SetDataSaverPromptsShown(times_shown + 1);
317 } 321 }
318 322
319 return true; 323 return true;
320 } 324 }
321 325
322 } // namespace chromeos 326 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/actions/actions.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698