| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.h" | 5 #include "extensions/browser/extension_function.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
| 10 #include "content/public/browser/notification_source.h" | 10 #include "content/public/browser/notification_source.h" |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 void UIThreadExtensionFunction::SetRenderFrameHost( | 457 void UIThreadExtensionFunction::SetRenderFrameHost( |
| 458 content::RenderFrameHost* render_frame_host) { | 458 content::RenderFrameHost* render_frame_host) { |
| 459 DCHECK(!render_view_host_); | 459 DCHECK(!render_view_host_); |
| 460 render_frame_host_ = render_frame_host; | 460 render_frame_host_ = render_frame_host; |
| 461 tracker_.reset(render_frame_host ? new RenderHostTracker(this) : NULL); | 461 tracker_.reset(render_frame_host ? new RenderHostTracker(this) : NULL); |
| 462 } | 462 } |
| 463 | 463 |
| 464 content::WebContents* UIThreadExtensionFunction::GetAssociatedWebContents() { | 464 content::WebContents* UIThreadExtensionFunction::GetAssociatedWebContents() { |
| 465 content::WebContents* web_contents = NULL; | 465 content::WebContents* web_contents = NULL; |
| 466 if (dispatcher()) | 466 if (dispatcher()) |
| 467 web_contents = dispatcher()->delegate()->GetAssociatedWebContents(); | 467 web_contents = dispatcher()->GetAssociatedWebContents(); |
| 468 | 468 |
| 469 return web_contents; | 469 return web_contents; |
| 470 } | 470 } |
| 471 | 471 |
| 472 content::WebContents* UIThreadExtensionFunction::GetSenderWebContents() { | 472 content::WebContents* UIThreadExtensionFunction::GetSenderWebContents() { |
| 473 return render_view_host_ ? | 473 return render_view_host_ ? |
| 474 content::WebContents::FromRenderViewHost(render_view_host_) : nullptr; | 474 content::WebContents::FromRenderViewHost(render_view_host_) : nullptr; |
| 475 } | 475 } |
| 476 | 476 |
| 477 void UIThreadExtensionFunction::SendResponse(bool success) { | 477 void UIThreadExtensionFunction::SendResponse(bool success) { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 | 581 |
| 582 ExtensionFunction::ResponseAction SyncIOThreadExtensionFunction::Run() { | 582 ExtensionFunction::ResponseAction SyncIOThreadExtensionFunction::Run() { |
| 583 return RespondNow(RunSync() ? ArgumentList(results_.Pass()) : Error(error_)); | 583 return RespondNow(RunSync() ? ArgumentList(results_.Pass()) : Error(error_)); |
| 584 } | 584 } |
| 585 | 585 |
| 586 // static | 586 // static |
| 587 bool SyncIOThreadExtensionFunction::ValidationFailure( | 587 bool SyncIOThreadExtensionFunction::ValidationFailure( |
| 588 SyncIOThreadExtensionFunction* function) { | 588 SyncIOThreadExtensionFunction* function) { |
| 589 return false; | 589 return false; |
| 590 } | 590 } |
| OLD | NEW |