| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 BrowserThread::DeleteOnUIThread::Destruct(this); | 446 BrowserThread::DeleteOnUIThread::Destruct(this); |
| 447 } | 447 } |
| 448 | 448 |
| 449 content::RenderViewHost* | 449 content::RenderViewHost* |
| 450 UIThreadExtensionFunction::render_view_host_do_not_use() const { | 450 UIThreadExtensionFunction::render_view_host_do_not_use() const { |
| 451 return render_frame_host_ ? render_frame_host_->GetRenderViewHost() : nullptr; | 451 return render_frame_host_ ? render_frame_host_->GetRenderViewHost() : nullptr; |
| 452 } | 452 } |
| 453 | 453 |
| 454 void UIThreadExtensionFunction::SetRenderFrameHost( | 454 void UIThreadExtensionFunction::SetRenderFrameHost( |
| 455 content::RenderFrameHost* render_frame_host) { | 455 content::RenderFrameHost* render_frame_host) { |
| 456 // An extension function from Service Worker does not have a RenderFrameHost. |
| 457 if (!render_frame_host) |
| 458 return; |
| 456 DCHECK_NE(render_frame_host_ == nullptr, render_frame_host == nullptr); | 459 DCHECK_NE(render_frame_host_ == nullptr, render_frame_host == nullptr); |
| 457 render_frame_host_ = render_frame_host; | 460 render_frame_host_ = render_frame_host; |
| 458 tracker_.reset( | 461 tracker_.reset( |
| 459 render_frame_host ? new RenderFrameHostTracker(this) : nullptr); | 462 render_frame_host ? new RenderFrameHostTracker(this) : nullptr); |
| 460 } | 463 } |
| 461 | 464 |
| 462 content::WebContents* UIThreadExtensionFunction::GetAssociatedWebContents() { | 465 content::WebContents* UIThreadExtensionFunction::GetAssociatedWebContents() { |
| 463 content::WebContents* web_contents = NULL; | 466 content::WebContents* web_contents = NULL; |
| 464 if (dispatcher()) | 467 if (dispatcher()) |
| 465 web_contents = dispatcher()->GetAssociatedWebContents(); | 468 web_contents = dispatcher()->GetAssociatedWebContents(); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 ExtensionFunction::ResponseAction SyncIOThreadExtensionFunction::Run() { | 572 ExtensionFunction::ResponseAction SyncIOThreadExtensionFunction::Run() { |
| 570 return RespondNow(RunSync() ? ArgumentList(std::move(results_)) | 573 return RespondNow(RunSync() ? ArgumentList(std::move(results_)) |
| 571 : Error(error_)); | 574 : Error(error_)); |
| 572 } | 575 } |
| 573 | 576 |
| 574 // static | 577 // static |
| 575 bool SyncIOThreadExtensionFunction::ValidationFailure( | 578 bool SyncIOThreadExtensionFunction::ValidationFailure( |
| 576 SyncIOThreadExtensionFunction* function) { | 579 SyncIOThreadExtensionFunction* function) { |
| 577 return false; | 580 return false; |
| 578 } | 581 } |
| OLD | NEW |