| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/renderer_host/render_message_filter.h" | 5 #include "content/browser/renderer_host/render_message_filter.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #include "net/base/mime_util.h" | 45 #include "net/base/mime_util.h" |
| 46 #include "net/http/http_cache.h" | 46 #include "net/http/http_cache.h" |
| 47 #include "net/url_request/url_request_context.h" | 47 #include "net/url_request/url_request_context.h" |
| 48 #include "net/url_request/url_request_context_getter.h" | 48 #include "net/url_request/url_request_context_getter.h" |
| 49 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNotificationPresen
ter.h" | 49 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNotificationPresen
ter.h" |
| 50 #include "webkit/glue/context_menu.h" | 50 #include "webkit/glue/context_menu.h" |
| 51 #include "webkit/glue/webcookie.h" | 51 #include "webkit/glue/webcookie.h" |
| 52 #include "webkit/glue/webkit_glue.h" | 52 #include "webkit/glue/webkit_glue.h" |
| 53 #include "webkit/plugins/npapi/plugin_group.h" | 53 #include "webkit/plugins/npapi/plugin_group.h" |
| 54 #include "webkit/plugins/npapi/webplugin.h" | 54 #include "webkit/plugins/npapi/webplugin.h" |
| 55 #include "webkit/plugins/plugin_constants.h" |
| 55 #include "webkit/plugins/webplugininfo.h" | 56 #include "webkit/plugins/webplugininfo.h" |
| 56 | 57 |
| 57 #if defined(OS_MACOSX) | 58 #if defined(OS_MACOSX) |
| 58 #include "content/common/mac/font_descriptor.h" | 59 #include "content/common/mac/font_descriptor.h" |
| 59 #include "content/common/mac/font_loader.h" | 60 #include "content/common/mac/font_loader.h" |
| 60 #endif | 61 #endif |
| 61 #if defined(OS_POSIX) | 62 #if defined(OS_POSIX) |
| 62 #include "base/file_descriptor_posix.h" | 63 #include "base/file_descriptor_posix.h" |
| 63 #endif | 64 #endif |
| 64 #if defined(OS_WIN) | 65 #if defined(OS_WIN) |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 185 |
| 185 virtual int ID() OVERRIDE { | 186 virtual int ID() OVERRIDE { |
| 186 return filter()->render_process_id(); | 187 return filter()->render_process_id(); |
| 187 } | 188 } |
| 188 | 189 |
| 189 virtual const content::ResourceContext& GetResourceContext() OVERRIDE { | 190 virtual const content::ResourceContext& GetResourceContext() OVERRIDE { |
| 190 return context_; | 191 return context_; |
| 191 } | 192 } |
| 192 | 193 |
| 193 virtual bool OffTheRecord() OVERRIDE { | 194 virtual bool OffTheRecord() OVERRIDE { |
| 194 return filter()->OffTheRecord(); | 195 if (filter()->OffTheRecord()) |
| 196 return true; |
| 197 if (content::GetContentClient()->browser()->AllowSaveLocalState(context_)) |
| 198 return false; |
| 199 |
| 200 // For now, only disallow storing data for Flash <http://crbug.com/97319>. |
| 201 for (size_t i = 0; i < info_.mime_types.size(); ++i) { |
| 202 if (info_.mime_types[i].mime_type == kFlashPluginSwfMimeType) |
| 203 return true; |
| 204 } |
| 205 return false; |
| 195 } | 206 } |
| 196 | 207 |
| 197 virtual void SetPluginInfo(const webkit::WebPluginInfo& info) OVERRIDE { | 208 virtual void SetPluginInfo(const webkit::WebPluginInfo& info) OVERRIDE { |
| 198 info_ = info; | 209 info_ = info; |
| 199 } | 210 } |
| 200 | 211 |
| 201 virtual void OnFoundPluginProcessHost(PluginProcessHost* host) OVERRIDE { | 212 virtual void OnFoundPluginProcessHost(PluginProcessHost* host) OVERRIDE { |
| 202 DCHECK(host); | 213 DCHECK(host); |
| 203 host_ = host; | 214 host_ = host; |
| 204 } | 215 } |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 IPC_END_MESSAGE_MAP_EX() | 378 IPC_END_MESSAGE_MAP_EX() |
| 368 | 379 |
| 369 return handled; | 380 return handled; |
| 370 } | 381 } |
| 371 | 382 |
| 372 void RenderMessageFilter::OnDestruct() const { | 383 void RenderMessageFilter::OnDestruct() const { |
| 373 BrowserThread::DeleteOnIOThread::Destruct(this); | 384 BrowserThread::DeleteOnIOThread::Destruct(this); |
| 374 } | 385 } |
| 375 | 386 |
| 376 bool RenderMessageFilter::OffTheRecord() const { | 387 bool RenderMessageFilter::OffTheRecord() const { |
| 377 return incognito_ || | 388 return incognito_; |
| 378 !content::GetContentClient()->browser()->AllowSaveLocalState( | |
| 379 resource_context_); | |
| 380 } | 389 } |
| 381 | 390 |
| 382 void RenderMessageFilter::OnMsgCreateWindow( | 391 void RenderMessageFilter::OnMsgCreateWindow( |
| 383 const ViewHostMsg_CreateWindow_Params& params, | 392 const ViewHostMsg_CreateWindow_Params& params, |
| 384 int* route_id, int64* cloned_session_storage_namespace_id) { | 393 int* route_id, int64* cloned_session_storage_namespace_id) { |
| 385 if (!content::GetContentClient()->browser()->CanCreateWindow( | 394 if (!content::GetContentClient()->browser()->CanCreateWindow( |
| 386 params.opener_url, params.window_container_type, resource_context_)) { | 395 params.opener_url, params.window_container_type, resource_context_)) { |
| 387 *route_id = MSG_ROUTING_NONE; | 396 *route_id = MSG_ROUTING_NONE; |
| 388 return; | 397 return; |
| 389 } | 398 } |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 ViewHostMsg_GetRawCookies::WriteReplyParams(reply_msg, cookies); | 854 ViewHostMsg_GetRawCookies::WriteReplyParams(reply_msg, cookies); |
| 846 Send(reply_msg); | 855 Send(reply_msg); |
| 847 } | 856 } |
| 848 | 857 |
| 849 void RenderMessageFilter::OnCompletedOpenChannelToNpapiPlugin( | 858 void RenderMessageFilter::OnCompletedOpenChannelToNpapiPlugin( |
| 850 OpenChannelToNpapiPluginCallback* client) { | 859 OpenChannelToNpapiPluginCallback* client) { |
| 851 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 860 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 852 DCHECK(ContainsKey(plugin_host_clients_, client)); | 861 DCHECK(ContainsKey(plugin_host_clients_, client)); |
| 853 plugin_host_clients_.erase(client); | 862 plugin_host_clients_.erase(client); |
| 854 } | 863 } |
| OLD | NEW |