summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/api/api_resource.cc
blob: 19b7b9137b0c8eab80f631499378e82a4df4420e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/extensions/api/api_resource.h"
#include "chrome/browser/extensions/api/api_resource_event_notifier.h"

namespace extensions {

ApiResource::ApiResource(const std::string& owner_extension_id,
                         ApiResourceEventNotifier* event_notifier)
    : owner_extension_id_(owner_extension_id),
      event_notifier_(event_notifier) {

  CHECK(!owner_extension_id_.empty());
  if (event_notifier)
    CHECK(event_notifier->src_extension_id() == owner_extension_id_);

  // scoped_refptr<> constructor does the initial AddRef() for us on
  // event_notifier_.
}

ApiResource::~ApiResource() {
  // scoped_refptr<> constructor calls Release() for us on event_notifier_.
}

ApiResourceEventNotifier* ApiResource::event_notifier() const {
  return event_notifier_.get();
}

}