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

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

Issue 11636050: Eliminate ApiResourceEventNotifier. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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_function.h" 5 #include "chrome/browser/extensions/api/api_function.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chrome/browser/extensions/api/api_resource_event_notifier.h"
9 #include "chrome/browser/extensions/extension_system.h" 8 #include "chrome/browser/extensions/extension_system.h"
10 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
11 10
12 using content::BrowserThread; 11 using content::BrowserThread;
13 12
14 namespace extensions { 13 namespace extensions {
15 14
16 ApiFunction::ApiFunction() { 15 ApiFunction::ApiFunction() {
17 } 16 }
18 17
19 ApiFunction::~ApiFunction() { 18 ApiFunction::~ApiFunction() {
20 } 19 }
21 20
22 int ApiFunction::ExtractSrcId(const DictionaryValue* options) {
23 int src_id = -1;
24 if (options) {
25 if (options->HasKey(kSrcIdKey))
26 EXTENSION_FUNCTION_VALIDATE(options->GetInteger(kSrcIdKey, &src_id));
27 }
28 return src_id;
29 }
30
31 ApiResourceEventNotifier* ApiFunction::CreateEventNotifier(int src_id) {
32 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
33 return new ApiResourceEventNotifier(
34 extensions::ExtensionSystem::Get(profile())->event_router(), profile(),
35 extension_id(), src_id, source_url());
36 }
37
38 // AsyncApiFunction 21 // AsyncApiFunction
39 AsyncApiFunction::AsyncApiFunction() 22 AsyncApiFunction::AsyncApiFunction()
40 : work_thread_id_(BrowserThread::IO) { 23 : work_thread_id_(BrowserThread::IO) {
41 } 24 }
42 25
43 AsyncApiFunction::~AsyncApiFunction() { 26 AsyncApiFunction::~AsyncApiFunction() {
44 } 27 }
45 28
46 bool AsyncApiFunction::RunImpl() { 29 bool AsyncApiFunction::RunImpl() {
47 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 30 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 "specify a different thread or derive from a different class."; 70 "specify a different thread or derive from a different class.";
88 AsyncWorkStart(); 71 AsyncWorkStart();
89 } 72 }
90 73
91 void AsyncApiFunction::RespondOnUIThread() { 74 void AsyncApiFunction::RespondOnUIThread() {
92 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 75 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
93 SendResponse(Respond()); 76 SendResponse(Respond());
94 } 77 }
95 78
96 } // namespace extensions 79 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/api_function.h ('k') | chrome/browser/extensions/api/api_resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698