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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 BrowserThread::DeleteOnUIThread::Destruct(this); | 451 BrowserThread::DeleteOnUIThread::Destruct(this); |
452 } | 452 } |
453 | 453 |
454 content::RenderViewHost* | 454 content::RenderViewHost* |
455 UIThreadExtensionFunction::render_view_host_do_not_use() const { | 455 UIThreadExtensionFunction::render_view_host_do_not_use() const { |
456 return render_frame_host_ ? render_frame_host_->GetRenderViewHost() : nullptr; | 456 return render_frame_host_ ? render_frame_host_->GetRenderViewHost() : nullptr; |
457 } | 457 } |
458 | 458 |
459 void UIThreadExtensionFunction::SetRenderFrameHost( | 459 void UIThreadExtensionFunction::SetRenderFrameHost( |
460 content::RenderFrameHost* render_frame_host) { | 460 content::RenderFrameHost* render_frame_host) { |
| 461 // An extension function from Service Worker does not have a RenderFrameHost. |
| 462 if (!render_frame_host) |
| 463 return; |
461 DCHECK_NE(render_frame_host_ == nullptr, render_frame_host == nullptr); | 464 DCHECK_NE(render_frame_host_ == nullptr, render_frame_host == nullptr); |
462 render_frame_host_ = render_frame_host; | 465 render_frame_host_ = render_frame_host; |
463 tracker_.reset( | 466 tracker_.reset( |
464 render_frame_host ? new RenderFrameHostTracker(this) : nullptr); | 467 render_frame_host ? new RenderFrameHostTracker(this) : nullptr); |
465 } | 468 } |
466 | 469 |
467 content::WebContents* UIThreadExtensionFunction::GetAssociatedWebContents() { | 470 content::WebContents* UIThreadExtensionFunction::GetAssociatedWebContents() { |
468 content::WebContents* web_contents = NULL; | 471 content::WebContents* web_contents = NULL; |
469 if (dispatcher()) | 472 if (dispatcher()) |
470 web_contents = dispatcher()->GetAssociatedWebContents(); | 473 web_contents = dispatcher()->GetAssociatedWebContents(); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 ExtensionFunction::ResponseAction SyncIOThreadExtensionFunction::Run() { | 577 ExtensionFunction::ResponseAction SyncIOThreadExtensionFunction::Run() { |
575 return RespondNow(RunSync() ? ArgumentList(std::move(results_)) | 578 return RespondNow(RunSync() ? ArgumentList(std::move(results_)) |
576 : Error(error_)); | 579 : Error(error_)); |
577 } | 580 } |
578 | 581 |
579 // static | 582 // static |
580 bool SyncIOThreadExtensionFunction::ValidationFailure( | 583 bool SyncIOThreadExtensionFunction::ValidationFailure( |
581 SyncIOThreadExtensionFunction* function) { | 584 SyncIOThreadExtensionFunction* function) { |
582 return false; | 585 return false; |
583 } | 586 } |
OLD | NEW |