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

Side by Side Diff: chrome/browser/metrics/variations/eula_accepted_notifier_chromeos.cc

Issue 16129004: Consolidate EulaAcceptedNotifier implementations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 6 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
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/metrics/variations/eula_accepted_notifier_chromeos.h"
6
7 #include "base/logging.h"
8 #include "chrome/browser/chromeos/login/startup_utils.h"
9 #include "chrome/common/chrome_notification_types.h"
10 #include "content/public/browser/notification_service.h"
11
12 EulaAcceptedNotifierChromeos::EulaAcceptedNotifierChromeos() {
13 }
14
15 EulaAcceptedNotifierChromeos::~EulaAcceptedNotifierChromeos() {
16 }
17
18 bool EulaAcceptedNotifierChromeos::IsEulaAccepted() {
19 if (chromeos::StartupUtils::IsEulaAccepted())
20 return true;
21
22 // Register for the notification, if this is the first time.
23 if (registrar_.IsEmpty()) {
24 // Note that this must listen on AllSources due to the difficulty in knowing
25 // when the WizardController instance is created, and to avoid over-coupling
26 // the Chrome OS code with the VariationsService by directly attaching as an
27 // observer. This is OK because WizardController is essentially a singleton.
28 registrar_.Add(this, chrome::NOTIFICATION_WIZARD_EULA_ACCEPTED,
29 content::NotificationService::AllSources());
30 }
31 return false;
32 }
33
34 void EulaAcceptedNotifierChromeos::Observe(
35 int type,
36 const content::NotificationSource& source,
37 const content::NotificationDetails& details) {
38 DCHECK_EQ(chrome::NOTIFICATION_WIZARD_EULA_ACCEPTED, type);
39 // This should only ever be received once. Remove it after this call.
40 DCHECK(!registrar_.IsEmpty());
41 registrar_.Remove(this, chrome::NOTIFICATION_WIZARD_EULA_ACCEPTED,
42 content::NotificationService::AllSources());
43
44 NotifyObserver();
45 }
46
47 // static
48 EulaAcceptedNotifier* EulaAcceptedNotifier::Create() {
49 #if defined(GOOGLE_CHROME_BUILD)
50 return new EulaAcceptedNotifierChromeos;
51 #else
52 return NULL;
53 #endif
54 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698