| 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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 BrowserThread::DeleteOnUIThread::Destruct(this); | 436 BrowserThread::DeleteOnUIThread::Destruct(this); |
| 437 } | 437 } |
| 438 | 438 |
| 439 content::RenderViewHost* | 439 content::RenderViewHost* |
| 440 UIThreadExtensionFunction::render_view_host_do_not_use() const { | 440 UIThreadExtensionFunction::render_view_host_do_not_use() const { |
| 441 return render_frame_host_ ? render_frame_host_->GetRenderViewHost() : nullptr; | 441 return render_frame_host_ ? render_frame_host_->GetRenderViewHost() : nullptr; |
| 442 } | 442 } |
| 443 | 443 |
| 444 void UIThreadExtensionFunction::SetRenderFrameHost( | 444 void UIThreadExtensionFunction::SetRenderFrameHost( |
| 445 content::RenderFrameHost* render_frame_host) { | 445 content::RenderFrameHost* render_frame_host) { |
| 446 // An extension function from Service Worker does not have a RenderFrameHost. |
| 447 if (!render_frame_host) |
| 448 return; |
| 446 DCHECK_NE(render_frame_host_ == nullptr, render_frame_host == nullptr); | 449 DCHECK_NE(render_frame_host_ == nullptr, render_frame_host == nullptr); |
| 447 render_frame_host_ = render_frame_host; | 450 render_frame_host_ = render_frame_host; |
| 448 tracker_.reset( | 451 tracker_.reset( |
| 449 render_frame_host ? new RenderFrameHostTracker(this) : nullptr); | 452 render_frame_host ? new RenderFrameHostTracker(this) : nullptr); |
| 450 } | 453 } |
| 451 | 454 |
| 452 content::WebContents* UIThreadExtensionFunction::GetAssociatedWebContents() { | 455 content::WebContents* UIThreadExtensionFunction::GetAssociatedWebContents() { |
| 453 content::WebContents* web_contents = NULL; | 456 content::WebContents* web_contents = NULL; |
| 454 if (dispatcher()) | 457 if (dispatcher()) |
| 455 web_contents = dispatcher()->GetAssociatedWebContents(); | 458 web_contents = dispatcher()->GetAssociatedWebContents(); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 ExtensionFunction::ResponseAction SyncIOThreadExtensionFunction::Run() { | 562 ExtensionFunction::ResponseAction SyncIOThreadExtensionFunction::Run() { |
| 560 return RespondNow(RunSync() ? ArgumentList(std::move(results_)) | 563 return RespondNow(RunSync() ? ArgumentList(std::move(results_)) |
| 561 : Error(error_)); | 564 : Error(error_)); |
| 562 } | 565 } |
| 563 | 566 |
| 564 // static | 567 // static |
| 565 bool SyncIOThreadExtensionFunction::ValidationFailure( | 568 bool SyncIOThreadExtensionFunction::ValidationFailure( |
| 566 SyncIOThreadExtensionFunction* function) { | 569 SyncIOThreadExtensionFunction* function) { |
| 567 return false; | 570 return false; |
| 568 } | 571 } |
| OLD | NEW |