| OLD | NEW |
| 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/extensions/api/api_resource.h" | 5 #include "chrome/browser/extensions/api/api_resource.h" |
| 6 #include "chrome/browser/extensions/api/api_resource_event_notifier.h" | 6 #include "chrome/browser/extensions/api/api_resource_event_notifier.h" |
| 7 | 7 |
| 8 namespace extensions { | 8 namespace extensions { |
| 9 | 9 |
| 10 ApiResource::ApiResource(ApiResourceEventNotifier* event_notifier) | 10 ApiResource::ApiResource(const std::string& owner_extension_id, |
| 11 : event_notifier_(event_notifier) { | 11 ApiResourceEventNotifier* event_notifier) |
| 12 : owner_extension_id_(owner_extension_id), |
| 13 event_notifier_(event_notifier) { |
| 14 |
| 15 CHECK(!owner_extension_id_.empty()); |
| 16 if (event_notifier) |
| 17 CHECK(event_notifier->src_extension_id() == owner_extension_id_); |
| 18 |
| 12 // scoped_refptr<> constructor does the initial AddRef() for us on | 19 // scoped_refptr<> constructor does the initial AddRef() for us on |
| 13 // event_notifier_. | 20 // event_notifier_. |
| 14 } | 21 } |
| 15 | 22 |
| 16 ApiResource::~ApiResource() { | 23 ApiResource::~ApiResource() { |
| 17 // scoped_refptr<> constructor calls Release() for us on event_notifier_. | 24 // scoped_refptr<> constructor calls Release() for us on event_notifier_. |
| 18 } | 25 } |
| 19 | 26 |
| 20 ApiResourceEventNotifier* ApiResource::event_notifier() const { | 27 ApiResourceEventNotifier* ApiResource::event_notifier() const { |
| 21 return event_notifier_.get(); | 28 return event_notifier_.get(); |
| 22 } | 29 } |
| 23 | 30 |
| 24 } | 31 } |
| OLD | NEW |