OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/chrome_plugin_host.h" | 5 #include "chrome/browser/chrome_plugin_host.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/gfx/png_encoder.h" |
11 #include "base/histogram.h" | 12 #include "base/histogram.h" |
12 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
13 #include "base/path_service.h" | 14 #include "base/path_service.h" |
14 #include "base/perftimer.h" | 15 #include "base/perftimer.h" |
15 #include "base/singleton.h" | 16 #include "base/singleton.h" |
16 #include "base/string_util.h" | 17 #include "base/string_util.h" |
17 #include "net/base/cookie_monster.h" | |
18 #include "net/url_request/url_request_error_job.h" | |
19 #include "chrome/browser/browser_list.h" | 18 #include "chrome/browser/browser_list.h" |
20 #include "chrome/browser/chrome_plugin_browsing_context.h" | 19 #include "chrome/browser/chrome_plugin_browsing_context.h" |
21 #include "chrome/browser/chrome_thread.h" | 20 #include "chrome/browser/chrome_thread.h" |
22 #include "chrome/browser/dom_ui/html_dialog_contents.h" | 21 #include "chrome/browser/dom_ui/html_dialog_contents.h" |
23 #include "chrome/browser/gears_integration.h" | 22 #include "chrome/browser/gears_integration.h" |
24 #include "chrome/browser/net/dns_master.h" | 23 #include "chrome/browser/net/dns_master.h" |
25 #include "chrome/browser/plugin_process_host.h" | 24 #include "chrome/browser/plugin_process_host.h" |
26 #include "chrome/browser/plugin_service.h" | 25 #include "chrome/browser/plugin_service.h" |
27 #include "chrome/browser/profile.h" | 26 #include "chrome/browser/profile.h" |
28 #include "chrome/browser/renderer_host/render_process_host.h" | 27 #include "chrome/browser/renderer_host/render_process_host.h" |
29 #include "chrome/common/chrome_constants.h" | 28 #include "chrome/common/chrome_constants.h" |
30 #include "chrome/common/chrome_counters.h" | 29 #include "chrome/common/chrome_counters.h" |
31 #include "chrome/common/chrome_paths.h" | 30 #include "chrome/common/chrome_paths.h" |
32 #include "chrome/common/chrome_plugin_lib.h" | 31 #include "chrome/common/chrome_plugin_lib.h" |
33 #include "chrome/common/chrome_plugin_util.h" | 32 #include "chrome/common/chrome_plugin_util.h" |
34 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
35 #include "chrome/common/gears_api.h" | 34 #include "chrome/common/gears_api.h" |
36 #include "chrome/common/notification_service.h" | 35 #include "chrome/common/notification_service.h" |
37 #include "chrome/common/net/url_request_intercept_job.h" | 36 #include "chrome/common/net/url_request_intercept_job.h" |
38 #include "chrome/common/plugin_messages.h" | 37 #include "chrome/common/plugin_messages.h" |
39 #include "chrome/common/render_messages.h" | 38 #include "chrome/common/render_messages.h" |
40 | |
41 #include "base/gfx/png_encoder.h" | |
42 #include "base/logging.h" | |
43 #include "base/string_util.h" | |
44 #include "googleurl/src/gurl.h" | |
45 #include "net/base/base64.h" | 39 #include "net/base/base64.h" |
| 40 #include "net/base/cookie_monster.h" |
| 41 #include "net/url_request/url_request_context.h" |
| 42 #include "net/url_request/url_request_error_job.h" |
46 #include "skia/include/SkBitmap.h" | 43 #include "skia/include/SkBitmap.h" |
47 | 44 |
48 using base::TimeDelta; | 45 using base::TimeDelta; |
49 | 46 |
50 // This class manages the interception of network requests. It queries the | 47 // This class manages the interception of network requests. It queries the |
51 // plugin on every request, and creates an intercept job if the plugin can | 48 // plugin on every request, and creates an intercept job if the plugin can |
52 // intercept the request. | 49 // intercept the request. |
53 // NOTE: All methods must be called on the IO thread. | 50 // NOTE: All methods must be called on the IO thread. |
54 class PluginRequestInterceptor | 51 class PluginRequestInterceptor |
55 : public PluginHelper, public URLRequest::Interceptor { | 52 : public PluginHelper, public URLRequest::Interceptor { |
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 void CPHandleCommand(int command, CPCommandInterface* data, | 799 void CPHandleCommand(int command, CPCommandInterface* data, |
803 CPBrowsingContext context) { | 800 CPBrowsingContext context) { |
804 // Sadly if we try and pass context through, we seem to break cl's little | 801 // Sadly if we try and pass context through, we seem to break cl's little |
805 // brain trying to compile the Tuple3 ctor. This cast works. | 802 // brain trying to compile the Tuple3 ctor. This cast works. |
806 int32 context_as_int32 = static_cast<int32>(context); | 803 int32 context_as_int32 = static_cast<int32>(context); |
807 // Plugins can only be accessed on the IO thread. | 804 // Plugins can only be accessed on the IO thread. |
808 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, | 805 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, |
809 NewRunnableFunction(PluginCommandHandler::HandleCommand, | 806 NewRunnableFunction(PluginCommandHandler::HandleCommand, |
810 command, data, context_as_int32)); | 807 command, data, context_as_int32)); |
811 } | 808 } |
OLD | NEW |