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 "content/public/browser/notification_source.h" | 8 #include "content/public/browser/notification_source.h" |
9 #include "content/public/browser/notification_types.h" | 9 #include "content/public/browser/notification_types.h" |
10 #include "content/public/browser/render_frame_host.h" | 10 #include "content/public/browser/render_frame_host.h" |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 } | 368 } |
369 | 369 |
370 void UIThreadExtensionFunction::SetRenderFrameHost( | 370 void UIThreadExtensionFunction::SetRenderFrameHost( |
371 content::RenderFrameHost* render_frame_host) { | 371 content::RenderFrameHost* render_frame_host) { |
372 DCHECK(!render_view_host_); | 372 DCHECK(!render_view_host_); |
373 render_frame_host_ = render_frame_host; | 373 render_frame_host_ = render_frame_host; |
374 tracker_.reset(render_frame_host ? new RenderHostTracker(this) : NULL); | 374 tracker_.reset(render_frame_host ? new RenderHostTracker(this) : NULL); |
375 } | 375 } |
376 | 376 |
377 content::WebContents* UIThreadExtensionFunction::GetAssociatedWebContents() { | 377 content::WebContents* UIThreadExtensionFunction::GetAssociatedWebContents() { |
378 content::WebContents* web_contents = NULL; | 378 return dispatcher() ? dispatcher()->delegate()->GetAssociatedWebContents() |
379 if (dispatcher()) | 379 : NULL; |
380 web_contents = dispatcher()->delegate()->GetAssociatedWebContents(); | 380 } |
381 | 381 |
382 return web_contents; | 382 content::WebContents* UIThreadExtensionFunction::GetVisibleWebContents() { |
| 383 return dispatcher() ? dispatcher()->delegate()->GetVisibleWebContents() |
| 384 : NULL; |
383 } | 385 } |
384 | 386 |
385 void UIThreadExtensionFunction::SendResponse(bool success) { | 387 void UIThreadExtensionFunction::SendResponse(bool success) { |
386 if (delegate_) | 388 if (delegate_) |
387 delegate_->OnSendResponse(this, success, bad_message_); | 389 delegate_->OnSendResponse(this, success, bad_message_); |
388 else | 390 else |
389 SendResponseImpl(success); | 391 SendResponseImpl(success); |
390 | 392 |
391 if (!transferred_blob_uuids_.empty()) { | 393 if (!transferred_blob_uuids_.empty()) { |
392 DCHECK(!delegate_) << "Blob transfer not supported with test delegate."; | 394 DCHECK(!delegate_) << "Blob transfer not supported with test delegate."; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 | 483 |
482 ExtensionFunction::ResponseAction SyncIOThreadExtensionFunction::Run() { | 484 ExtensionFunction::ResponseAction SyncIOThreadExtensionFunction::Run() { |
483 return RespondNow(RunSync() ? ArgumentList(results_.Pass()) : Error(error_)); | 485 return RespondNow(RunSync() ? ArgumentList(results_.Pass()) : Error(error_)); |
484 } | 486 } |
485 | 487 |
486 // static | 488 // static |
487 bool SyncIOThreadExtensionFunction::ValidationFailure( | 489 bool SyncIOThreadExtensionFunction::ValidationFailure( |
488 SyncIOThreadExtensionFunction* function) { | 490 SyncIOThreadExtensionFunction* function) { |
489 return false; | 491 return false; |
490 } | 492 } |
OLD | NEW |