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

Side by Side Diff: chrome/browser/local_discovery/privet_notifications.cc

Issue 687183004: Remove the OnError method from notification delegates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/local_discovery/privet_notifications.h" 5 #include "chrome/browser/local_discovery/privet_notifications.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 : profile_(profile) { 363 : profile_(profile) {
364 } 364 }
365 365
366 PrivetNotificationDelegate::~PrivetNotificationDelegate() { 366 PrivetNotificationDelegate::~PrivetNotificationDelegate() {
367 } 367 }
368 368
369 std::string PrivetNotificationDelegate::id() const { 369 std::string PrivetNotificationDelegate::id() const {
370 return kPrivetNotificationID; 370 return kPrivetNotificationID;
371 } 371 }
372 372
373 void PrivetNotificationDelegate::Error() {
374 LOG(ERROR) << "Error displaying privet notification";
375 }
376
377 void PrivetNotificationDelegate::ButtonClick(int button_index) { 373 void PrivetNotificationDelegate::ButtonClick(int button_index) {
378 if (button_index == 0) { 374 if (button_index == 0) {
379 ReportPrivetUmaEvent(PRIVET_NOTIFICATION_CLICKED); 375 ReportPrivetUmaEvent(PRIVET_NOTIFICATION_CLICKED);
380 OpenTab(GURL(kPrivetNotificationOriginUrl)); 376 OpenTab(GURL(kPrivetNotificationOriginUrl));
381 } else if (button_index == 1) { 377 } else if (button_index == 1) {
382 ReportPrivetUmaEvent(PRIVET_DISABLE_NOTIFICATIONS_CLICKED); 378 ReportPrivetUmaEvent(PRIVET_DISABLE_NOTIFICATIONS_CLICKED);
383 DisableNotifications(); 379 DisableNotifications();
384 } 380 }
385 } 381 }
386 382
387 void PrivetNotificationDelegate::OpenTab(const GURL& url) { 383 void PrivetNotificationDelegate::OpenTab(const GURL& url) {
388 Profile* profile_obj = Profile::FromBrowserContext(profile_); 384 Profile* profile_obj = Profile::FromBrowserContext(profile_);
389 385
390 chrome::NavigateParams params(profile_obj, 386 chrome::NavigateParams params(profile_obj,
391 url, 387 url,
392 ui::PAGE_TRANSITION_AUTO_TOPLEVEL); 388 ui::PAGE_TRANSITION_AUTO_TOPLEVEL);
393 params.disposition = NEW_FOREGROUND_TAB; 389 params.disposition = NEW_FOREGROUND_TAB;
394 chrome::Navigate(&params); 390 chrome::Navigate(&params);
395 } 391 }
396 392
397 void PrivetNotificationDelegate::DisableNotifications() { 393 void PrivetNotificationDelegate::DisableNotifications() {
398 Profile* profile_obj = Profile::FromBrowserContext(profile_); 394 Profile* profile_obj = Profile::FromBrowserContext(profile_);
399 395
400 profile_obj->GetPrefs()->SetBoolean( 396 profile_obj->GetPrefs()->SetBoolean(
401 prefs::kLocalDiscoveryNotificationsEnabled, 397 prefs::kLocalDiscoveryNotificationsEnabled,
402 false); 398 false);
403 } 399 }
404 400
405 } // namespace local_discovery 401 } // namespace local_discovery
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698