| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/extension_function_dispatcher.h" | 5 #include "extensions/browser/extension_function_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/json/json_string_value_serializer.h" | 8 #include "base/json/json_string_value_serializer.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 weak_ptr_factory_.GetWeakPtr(), | 179 weak_ptr_factory_.GetWeakPtr(), |
| 180 request_id); | 180 request_id); |
| 181 } | 181 } |
| 182 | 182 |
| 183 private: | 183 private: |
| 184 void OnExtensionFunctionCompleted(int request_id, | 184 void OnExtensionFunctionCompleted(int request_id, |
| 185 ExtensionFunction::ResponseType type, | 185 ExtensionFunction::ResponseType type, |
| 186 const base::ListValue& results, | 186 const base::ListValue& results, |
| 187 const std::string& error, | 187 const std::string& error, |
| 188 functions::HistogramValue histogram_value) { | 188 functions::HistogramValue histogram_value) { |
| 189 base::Process process = base::Process::DeprecatedGetProcessFromHandle( | 189 base::Process process = |
| 190 render_view_host_->GetProcess()->GetHandle()); | 190 content::RenderProcessHost::run_renderer_in_process() |
| 191 ? base::Process::Current() |
| 192 : base::Process::DeprecatedGetProcessFromHandle( |
| 193 render_view_host_->GetProcess()->GetHandle()); |
| 191 CommonResponseCallback(render_view_host_, render_view_host_->GetRoutingID(), | 194 CommonResponseCallback(render_view_host_, render_view_host_->GetRoutingID(), |
| 192 process, request_id, type, results, error, | 195 process, request_id, type, results, error, |
| 193 histogram_value); | 196 histogram_value); |
| 194 } | 197 } |
| 195 | 198 |
| 196 base::WeakPtr<ExtensionFunctionDispatcher> dispatcher_; | 199 base::WeakPtr<ExtensionFunctionDispatcher> dispatcher_; |
| 197 content::RenderViewHost* render_view_host_; | 200 content::RenderViewHost* render_view_host_; |
| 198 base::WeakPtrFactory<UIThreadResponseCallbackWrapper> weak_ptr_factory_; | 201 base::WeakPtrFactory<UIThreadResponseCallbackWrapper> weak_ptr_factory_; |
| 199 | 202 |
| 200 DISALLOW_COPY_AND_ASSIGN(UIThreadResponseCallbackWrapper); | 203 DISALLOW_COPY_AND_ASSIGN(UIThreadResponseCallbackWrapper); |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 // static | 488 // static |
| 486 void ExtensionFunctionDispatcher::SendAccessDenied( | 489 void ExtensionFunctionDispatcher::SendAccessDenied( |
| 487 const ExtensionFunction::ResponseCallback& callback, | 490 const ExtensionFunction::ResponseCallback& callback, |
| 488 functions::HistogramValue histogram_value) { | 491 functions::HistogramValue histogram_value) { |
| 489 base::ListValue empty_list; | 492 base::ListValue empty_list; |
| 490 callback.Run(ExtensionFunction::FAILED, empty_list, | 493 callback.Run(ExtensionFunction::FAILED, empty_list, |
| 491 "Access to extension API denied.", histogram_value); | 494 "Access to extension API denied.", histogram_value); |
| 492 } | 495 } |
| 493 | 496 |
| 494 } // namespace extensions | 497 } // namespace extensions |
| OLD | NEW |