| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extension_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 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" | 12 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" |
| 13 #include "chrome/common/extensions/extension_messages.h" | 13 #include "chrome/common/extensions/extension_messages.h" |
| 14 #include "content/browser/renderer_host/render_process_host.h" | 14 #include "content/browser/renderer_host/render_process_host.h" |
| 15 #include "content/browser/renderer_host/render_view_host.h" | 15 #include "content/browser/renderer_host/render_view_host.h" |
| 16 #include "content/browser/user_metrics.h" | 16 #include "content/browser/user_metrics.h" |
| 17 #include "content/common/content_notification_types.h" |
| 17 #include "content/common/notification_source.h" | 18 #include "content/common/notification_source.h" |
| 18 #include "content/common/notification_type.h" | |
| 19 #include "content/common/result_codes.h" | 19 #include "content/common/result_codes.h" |
| 20 | 20 |
| 21 // static | 21 // static |
| 22 void ExtensionFunctionDeleteTraits::Destruct(const ExtensionFunction* x) { | 22 void ExtensionFunctionDeleteTraits::Destruct(const ExtensionFunction* x) { |
| 23 x->Destruct(); | 23 x->Destruct(); |
| 24 } | 24 } |
| 25 | 25 |
| 26 UIThreadExtensionFunction::RenderViewHostTracker::RenderViewHostTracker( | 26 UIThreadExtensionFunction::RenderViewHostTracker::RenderViewHostTracker( |
| 27 UIThreadExtensionFunction* function) | 27 UIThreadExtensionFunction* function) |
| 28 : function_(function) { | 28 : function_(function) { |
| 29 registrar_.Add(this, | 29 registrar_.Add(this, |
| 30 NotificationType::RENDER_VIEW_HOST_DELETED, | 30 content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, |
| 31 Source<RenderViewHost>(function->render_view_host())); | 31 Source<RenderViewHost>(function->render_view_host())); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void UIThreadExtensionFunction::RenderViewHostTracker::Observe( | 34 void UIThreadExtensionFunction::RenderViewHostTracker::Observe( |
| 35 NotificationType type, | 35 int type, |
| 36 const NotificationSource& source, | 36 const NotificationSource& source, |
| 37 const NotificationDetails& details) { | 37 const NotificationDetails& details) { |
| 38 CHECK(type == NotificationType::RENDER_VIEW_HOST_DELETED); | 38 CHECK(type == content::NOTIFICATION_RENDER_VIEW_HOST_DELETED); |
| 39 CHECK(Source<RenderViewHost>(source).ptr() == | 39 CHECK(Source<RenderViewHost>(source).ptr() == |
| 40 function_->render_view_host()); | 40 function_->render_view_host()); |
| 41 function_->SetRenderViewHost(NULL); | 41 function_->SetRenderViewHost(NULL); |
| 42 } | 42 } |
| 43 | 43 |
| 44 ExtensionFunction::ExtensionFunction() | 44 ExtensionFunction::ExtensionFunction() |
| 45 : request_id_(-1), | 45 : request_id_(-1), |
| 46 profile_id_(Profile::kInvalidProfileId), | 46 profile_id_(Profile::kInvalidProfileId), |
| 47 has_callback_(false), | 47 has_callback_(false), |
| 48 include_incognito_(false), | 48 include_incognito_(false), |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 193 |
| 194 SyncIOThreadExtensionFunction::SyncIOThreadExtensionFunction() { | 194 SyncIOThreadExtensionFunction::SyncIOThreadExtensionFunction() { |
| 195 } | 195 } |
| 196 | 196 |
| 197 SyncIOThreadExtensionFunction::~SyncIOThreadExtensionFunction() { | 197 SyncIOThreadExtensionFunction::~SyncIOThreadExtensionFunction() { |
| 198 } | 198 } |
| 199 | 199 |
| 200 void SyncIOThreadExtensionFunction::Run() { | 200 void SyncIOThreadExtensionFunction::Run() { |
| 201 SendResponse(RunImpl()); | 201 SendResponse(RunImpl()); |
| 202 } | 202 } |
| OLD | NEW |