Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/intents/intent_injector.h" | 5 #include "content/browser/intents/intent_injector.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 75 if (source_intent_.get() == NULL || !web_contents()->GetRenderViewHost()) | 75 if (source_intent_.get() == NULL || !web_contents()->GetRenderViewHost()) |
| 76 return; | 76 return; |
| 77 | 77 |
| 78 // Only deliver the intent to the renderer if it has the same origin | 78 // Only deliver the intent to the renderer if it has the same origin |
| 79 // as the initial delivery target. | 79 // as the initial delivery target. |
| 80 if (initial_url_.GetOrigin() != | 80 if (initial_url_.GetOrigin() != |
| 81 render_view_host->GetSiteInstance()->GetSiteURL().GetOrigin()) { | 81 render_view_host->GetSiteInstance()->GetSiteURL().GetOrigin()) { |
| 82 return; | 82 return; |
| 83 } | 83 } |
| 84 | 84 |
| 85 if (source_intent_->data_type == webkit_glue::WebIntentData::BLOB) { | 85 if (source_intent_->data_type == webkit_glue::WebIntentData::BLOB || |
|
Steve McKay
2012/10/15 19:31:10
The checks are crystal clear, why you are doing th
Greg Billock
2012/10/15 21:01:43
The new WebIntentsHost will grow to accomodate thi
| |
| 86 (source_intent_->data_type == webkit_glue::WebIntentData::MIME_TYPE && | |
| 87 !source_intent_->blob_file.empty())) { | |
| 86 // Grant read permission on the blob file to the delivered context. | 88 // Grant read permission on the blob file to the delivered context. |
| 87 const int child_id = render_view_host->GetProcess()->GetID(); | 89 const int child_id = render_view_host->GetProcess()->GetID(); |
| 88 ChildProcessSecurityPolicy* policy = | 90 ChildProcessSecurityPolicy* policy = |
| 89 ChildProcessSecurityPolicy::GetInstance(); | 91 ChildProcessSecurityPolicy::GetInstance(); |
| 90 if (!policy->CanReadFile(child_id, source_intent_->blob_file)) | 92 if (!policy->CanReadFile(child_id, source_intent_->blob_file)) |
| 91 policy->GrantReadFile(child_id, source_intent_->blob_file); | 93 policy->GrantReadFile(child_id, source_intent_->blob_file); |
| 92 } else if (source_intent_->data_type == | 94 } else if (source_intent_->data_type == |
| 93 webkit_glue::WebIntentData::FILESYSTEM) { | 95 webkit_glue::WebIntentData::FILESYSTEM) { |
| 94 const int child_id = render_view_host->GetProcess()->GetID(); | 96 const int child_id = render_view_host->GetProcess()->GetID(); |
| 95 FilePath path; | 97 FilePath path; |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 120 void IntentInjector::OnReply(webkit_glue::WebIntentReplyType reply_type, | 122 void IntentInjector::OnReply(webkit_glue::WebIntentReplyType reply_type, |
| 121 const string16& data) { | 123 const string16& data) { |
| 122 if (!intents_dispatcher_) | 124 if (!intents_dispatcher_) |
| 123 return; | 125 return; |
| 124 | 126 |
| 125 // Ensure SendReplyMessage is only called once. | 127 // Ensure SendReplyMessage is only called once. |
| 126 WebIntentsDispatcher* intents_dispatcher = intents_dispatcher_; | 128 WebIntentsDispatcher* intents_dispatcher = intents_dispatcher_; |
| 127 intents_dispatcher_ = NULL; | 129 intents_dispatcher_ = NULL; |
| 128 intents_dispatcher->SendReplyMessage(reply_type, data); | 130 intents_dispatcher->SendReplyMessage(reply_type, data); |
| 129 } | 131 } |
| OLD | NEW |