Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(558)

Unified Diff: extensions/browser/extension_function.cc

Issue 280393003: Blobs: Catching browser-process created Blobs in extension code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clear out some stray includes Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: extensions/browser/extension_function.cc
diff --git a/extensions/browser/extension_function.cc b/extensions/browser/extension_function.cc
index 3d6754c1b1d160082c1e10defb94617a7acaaa46..526f5fdfe894035f49468ec6bd660a1c2905eda3 100644
--- a/extensions/browser/extension_function.cc
+++ b/extensions/browser/extension_function.cc
@@ -350,18 +350,39 @@ void UIThreadExtensionFunction::SendResponse(bool success) {
delegate_->OnSendResponse(this, success, bad_message_);
else
SendResponseImpl(success);
+
+ if (!transferred_blob_uuids_.empty()) {
+ DCHECK(!delegate_) << "Blob transfer not supported with test delegate.";
+ GetIPCSender()->Send(new ExtensionMsg_TransferBlobs(
+ GetRoutingID(), transferred_blob_uuids_));
michaeln 2014/05/23 00:12:34 What's the purpose if the routeid here?
tommycli 2014/05/23 16:27:44 Previously needed it due to it being a WebContents
+ }
+}
+
+void UIThreadExtensionFunction::SetTransferredBlobUUIDs(
+ const std::vector<std::string>& blob_uuids) {
+ DCHECK(transferred_blob_uuids_.empty()); // Should only be called once.
+ transferred_blob_uuids_ = blob_uuids;
}
void UIThreadExtensionFunction::WriteToConsole(
content::ConsoleMessageLevel level,
const std::string& message) {
- if (render_view_host_) {
- render_view_host_->Send(new ExtensionMsg_AddMessageToConsole(
- render_view_host_->GetRoutingID(), level, message));
- } else {
- render_frame_host_->Send(new ExtensionMsg_AddMessageToConsole(
- render_frame_host_->GetRoutingID(), level, message));
- }
+ GetIPCSender()->Send(new ExtensionMsg_AddMessageToConsole(
+ GetRoutingID(), level, message));
+}
+
+IPC::Sender* UIThreadExtensionFunction::GetIPCSender() {
+ if (render_view_host_)
+ return render_view_host_;
+ else
+ return render_frame_host_;
+}
+
+int UIThreadExtensionFunction::GetRoutingID() {
+ if (render_view_host_)
+ return render_view_host_->GetRoutingID();
+ else
+ return render_frame_host_->GetRoutingID();
}
IOThreadExtensionFunction::IOThreadExtensionFunction()

Powered by Google App Engine
This is Rietveld 408576698