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

Side by Side Diff: content/browser/intents/intent_injector.cc

Issue 10810053: Enables internal filesystem types via Isolated filesystems (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 if (source_intent_->data_type == webkit_glue::WebIntentData::BLOB) { 85 if (source_intent_->data_type == webkit_glue::WebIntentData::BLOB) {
86 // Grant read permission on the blob file to the delivered context. 86 // Grant read permission on the blob file to the delivered context.
87 const int child_id = render_view_host->GetProcess()->GetID(); 87 const int child_id = render_view_host->GetProcess()->GetID();
88 ChildProcessSecurityPolicy* policy = 88 ChildProcessSecurityPolicy* policy =
89 ChildProcessSecurityPolicy::GetInstance(); 89 ChildProcessSecurityPolicy::GetInstance();
90 if (!policy->CanReadFile(child_id, source_intent_->blob_file)) 90 if (!policy->CanReadFile(child_id, source_intent_->blob_file))
91 policy->GrantReadFile(child_id, source_intent_->blob_file); 91 policy->GrantReadFile(child_id, source_intent_->blob_file);
92 } else if (source_intent_->data_type == 92 } else if (source_intent_->data_type ==
93 webkit_glue::WebIntentData::FILESYSTEM) { 93 webkit_glue::WebIntentData::FILESYSTEM) {
94 const int child_id = render_view_host->GetProcess()->GetID(); 94 const int child_id = render_view_host->GetProcess()->GetID();
95 std::vector<fileapi::IsolatedContext::FileInfo> files; 95 FilePath path;
96 const bool valid = 96 const bool valid =
97 fileapi::IsolatedContext::GetInstance()->GetRegisteredFileInfo( 97 fileapi::IsolatedContext::GetInstance()->GetRegisteredPath(
98 source_intent_->filesystem_id, &files); 98 source_intent_->filesystem_id, &path);
99 DCHECK(valid); 99 DCHECK(valid);
100 DCHECK_EQ(1U, files.size());
101 ChildProcessSecurityPolicy* policy = 100 ChildProcessSecurityPolicy* policy =
102 ChildProcessSecurityPolicy::GetInstance(); 101 ChildProcessSecurityPolicy::GetInstance();
103 if (!policy->CanReadFile(child_id, files[0].path)) 102 if (!policy->CanReadFile(child_id, path))
104 policy->GrantReadFile(child_id, files[0].path); 103 policy->GrantReadFile(child_id, path);
105 policy->GrantReadFileSystem(child_id, source_intent_->filesystem_id); 104 policy->GrantReadFileSystem(child_id, source_intent_->filesystem_id);
106 } 105 }
107 106
108 render_view_host->Send(new IntentsMsg_SetWebIntentData( 107 render_view_host->Send(new IntentsMsg_SetWebIntentData(
109 render_view_host->GetRoutingID(), *(source_intent_.get()))); 108 render_view_host->GetRoutingID(), *(source_intent_.get())));
110 } 109 }
111 110
112 bool IntentInjector::OnMessageReceived(const IPC::Message& message) { 111 bool IntentInjector::OnMessageReceived(const IPC::Message& message) {
113 bool handled = true; 112 bool handled = true;
114 IPC_BEGIN_MESSAGE_MAP(IntentInjector, message) 113 IPC_BEGIN_MESSAGE_MAP(IntentInjector, message)
115 IPC_MESSAGE_HANDLER(IntentsHostMsg_WebIntentReply, OnReply); 114 IPC_MESSAGE_HANDLER(IntentsHostMsg_WebIntentReply, OnReply);
116 IPC_MESSAGE_UNHANDLED(handled = false) 115 IPC_MESSAGE_UNHANDLED(handled = false)
117 IPC_END_MESSAGE_MAP() 116 IPC_END_MESSAGE_MAP()
118 return handled; 117 return handled;
119 } 118 }
120 119
121 void IntentInjector::OnReply(webkit_glue::WebIntentReplyType reply_type, 120 void IntentInjector::OnReply(webkit_glue::WebIntentReplyType reply_type,
122 const string16& data) { 121 const string16& data) {
123 if (!intents_dispatcher_) 122 if (!intents_dispatcher_)
124 return; 123 return;
125 124
126 // Ensure SendReplyMessage is only called once. 125 // Ensure SendReplyMessage is only called once.
127 WebIntentsDispatcher* intents_dispatcher = intents_dispatcher_; 126 WebIntentsDispatcher* intents_dispatcher = intents_dispatcher_;
128 intents_dispatcher_ = NULL; 127 intents_dispatcher_ = NULL;
129 intents_dispatcher->SendReplyMessage(reply_type, data); 128 intents_dispatcher->SendReplyMessage(reply_type, data);
130 } 129 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698