OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/extension_function.h" | 5 #include "chrome/browser/extensions/extension_function.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 9 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
10 #include "chrome/browser/extensions/extensions_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 | 12 |
13 ExtensionFunction::ExtensionFunction() | 13 ExtensionFunction::ExtensionFunction() |
14 : request_id_(-1), | 14 : request_id_(-1), |
15 profile_(NULL), | 15 profile_(NULL), |
16 has_callback_(false), | 16 has_callback_(false), |
17 include_incognito_(false), | 17 include_incognito_(false), |
18 user_gesture_(false) { | 18 user_gesture_(false) { |
19 } | 19 } |
20 | 20 |
21 ExtensionFunction::~ExtensionFunction() { | 21 ExtensionFunction::~ExtensionFunction() { |
22 } | 22 } |
23 | 23 |
24 const Extension* ExtensionFunction::GetExtension() { | 24 const Extension* ExtensionFunction::GetExtension() { |
25 ExtensionsService* service = profile_->GetExtensionsService(); | 25 ExtensionService* service = profile_->GetExtensionService(); |
26 DCHECK(service); | 26 DCHECK(service); |
27 return service->GetExtensionById(extension_id_, false); | 27 return service->GetExtensionById(extension_id_, false); |
28 } | 28 } |
29 | 29 |
30 Browser* ExtensionFunction::GetCurrentBrowser() { | 30 Browser* ExtensionFunction::GetCurrentBrowser() { |
31 return dispatcher()->GetCurrentBrowser(include_incognito_); | 31 return dispatcher()->GetCurrentBrowser(include_incognito_); |
32 } | 32 } |
33 | 33 |
34 AsyncExtensionFunction::AsyncExtensionFunction() | 34 AsyncExtensionFunction::AsyncExtensionFunction() |
35 : args_(NULL), bad_message_(false) { | 35 : args_(NULL), bad_message_(false) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 SyncExtensionFunction::SyncExtensionFunction() { | 78 SyncExtensionFunction::SyncExtensionFunction() { |
79 } | 79 } |
80 | 80 |
81 SyncExtensionFunction::~SyncExtensionFunction() { | 81 SyncExtensionFunction::~SyncExtensionFunction() { |
82 } | 82 } |
83 | 83 |
84 void SyncExtensionFunction::Run() { | 84 void SyncExtensionFunction::Run() { |
85 SendResponse(RunImpl()); | 85 SendResponse(RunImpl()); |
86 } | 86 } |
OLD | NEW |