| 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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 void UIThreadExtensionFunction::SetRenderFrameHost( | 456 void UIThreadExtensionFunction::SetRenderFrameHost( |
| 457 content::RenderFrameHost* render_frame_host) { | 457 content::RenderFrameHost* render_frame_host) { |
| 458 DCHECK(!render_view_host_); | 458 DCHECK(!render_view_host_); |
| 459 render_frame_host_ = render_frame_host; | 459 render_frame_host_ = render_frame_host; |
| 460 tracker_.reset(render_frame_host ? new RenderHostTracker(this) : NULL); | 460 tracker_.reset(render_frame_host ? new RenderHostTracker(this) : NULL); |
| 461 } | 461 } |
| 462 | 462 |
| 463 content::WebContents* UIThreadExtensionFunction::GetAssociatedWebContents() { | 463 content::WebContents* UIThreadExtensionFunction::GetAssociatedWebContents() { |
| 464 content::WebContents* web_contents = NULL; | 464 content::WebContents* web_contents = NULL; |
| 465 if (dispatcher()) | 465 if (dispatcher()) |
| 466 web_contents = dispatcher()->delegate()->GetAssociatedWebContents(); | 466 web_contents = dispatcher()->GetAssociatedWebContents(); |
| 467 | 467 |
| 468 return web_contents; | 468 return web_contents; |
| 469 } | 469 } |
| 470 | 470 |
| 471 content::WebContents* UIThreadExtensionFunction::GetSenderWebContents() { | 471 content::WebContents* UIThreadExtensionFunction::GetSenderWebContents() { |
| 472 return render_view_host_ ? | 472 return render_view_host_ ? |
| 473 content::WebContents::FromRenderViewHost(render_view_host_) : nullptr; | 473 content::WebContents::FromRenderViewHost(render_view_host_) : nullptr; |
| 474 } | 474 } |
| 475 | 475 |
| 476 void UIThreadExtensionFunction::SendResponse(bool success) { | 476 void UIThreadExtensionFunction::SendResponse(bool success) { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 | 580 |
| 581 ExtensionFunction::ResponseAction SyncIOThreadExtensionFunction::Run() { | 581 ExtensionFunction::ResponseAction SyncIOThreadExtensionFunction::Run() { |
| 582 return RespondNow(RunSync() ? ArgumentList(results_.Pass()) : Error(error_)); | 582 return RespondNow(RunSync() ? ArgumentList(results_.Pass()) : Error(error_)); |
| 583 } | 583 } |
| 584 | 584 |
| 585 // static | 585 // static |
| 586 bool SyncIOThreadExtensionFunction::ValidationFailure( | 586 bool SyncIOThreadExtensionFunction::ValidationFailure( |
| 587 SyncIOThreadExtensionFunction* function) { | 587 SyncIOThreadExtensionFunction* function) { |
| 588 return false; | 588 return false; |
| 589 } | 589 } |
| OLD | NEW |