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

Side by Side Diff: chrome/browser/extensions/api/api_resource.cc

Issue 10919201: Make sure that a given app/extension requests only its own resources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Improve tests; fix merge conflicts. Created 8 years, 3 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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/api_resource.h ('k') | chrome/browser/extensions/api/api_resource_event_notifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698