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

Side by Side Diff: chrome/browser/extensions/api/dial/dial_registry.cc

Issue 11444020: DIAL extension API skeleton. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: abc.... Created 8 years 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) 2012 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/extensions/api/dial/dial_registry.h"
6
7 #include "chrome/browser/extensions/api/dial/dial_api.h"
8 #include "chrome/browser/extensions/api/dial/dial_device_data.h"
9 #include "chrome/common/extensions/api/dial.h"
10
11 namespace extensions {
12
13 DialRegistry::DialRegistry(Observer* dial_api)
14 : num_listeners_(0), discovering_(false), dial_api_(dial_api) { }
15
16 DialRegistry::~DialRegistry() {
17 DCHECK(thread_checker_.CalledOnValidThread());
18 }
19
20 void DialRegistry::OnListenerAdded() {
21 DCHECK(thread_checker_.CalledOnValidThread());
22 if (++num_listeners_ == 1) {
23 DVLOG(1) << "Listener added; starting periodic discovery.";
24 discovering_ = true;
25 }
26 }
27
28 void DialRegistry::OnListenerRemoved() {
29 DCHECK(thread_checker_.CalledOnValidThread());
30 if (--num_listeners_ == 0) {
31 DVLOG(1) << "Listeners removed; stopping periodic discovery.";
32 discovering_ = false;
33 }
34 }
35
36 bool DialRegistry::DiscoverNow() {
37 DCHECK(thread_checker_.CalledOnValidThread());
38 return discovering_;
39 }
40
41 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/dial/dial_registry.h ('k') | chrome/browser/extensions/event_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698