| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 render_view_host_(render_view_host), | 156 render_view_host_(render_view_host), |
| 157 weak_ptr_factory_(this) { | 157 weak_ptr_factory_(this) { |
| 158 } | 158 } |
| 159 | 159 |
| 160 virtual ~UIThreadResponseCallbackWrapper() { | 160 virtual ~UIThreadResponseCallbackWrapper() { |
| 161 } | 161 } |
| 162 | 162 |
| 163 // content::WebContentsObserver overrides. | 163 // content::WebContentsObserver overrides. |
| 164 virtual void RenderViewDeleted( | 164 virtual void RenderViewDeleted( |
| 165 RenderViewHost* render_view_host) OVERRIDE { | 165 RenderViewHost* render_view_host) OVERRIDE { |
| 166 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 166 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 167 if (render_view_host != render_view_host_) | 167 if (render_view_host != render_view_host_) |
| 168 return; | 168 return; |
| 169 | 169 |
| 170 if (dispatcher_.get()) { | 170 if (dispatcher_.get()) { |
| 171 dispatcher_->ui_thread_response_callback_wrappers_ | 171 dispatcher_->ui_thread_response_callback_wrappers_ |
| 172 .erase(render_view_host); | 172 .erase(render_view_host); |
| 173 } | 173 } |
| 174 | 174 |
| 175 delete this; | 175 delete this; |
| 176 } | 176 } |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 return function; | 510 return function; |
| 511 } | 511 } |
| 512 | 512 |
| 513 // static | 513 // static |
| 514 void ExtensionFunctionDispatcher::SendAccessDenied( | 514 void ExtensionFunctionDispatcher::SendAccessDenied( |
| 515 const ExtensionFunction::ResponseCallback& callback) { | 515 const ExtensionFunction::ResponseCallback& callback) { |
| 516 base::ListValue empty_list; | 516 base::ListValue empty_list; |
| 517 callback.Run(ExtensionFunction::FAILED, empty_list, | 517 callback.Run(ExtensionFunction::FAILED, empty_list, |
| 518 "Access to extension API denied."); | 518 "Access to extension API denied."); |
| 519 } | 519 } |
| OLD | NEW |