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/plugin/chrome_plugin_host.h" | 5 #include "chrome/plugin/chrome_plugin_host.h" |
6 | 6 |
| 7 #include "base/command_line.h" |
7 #include "base/file_util.h" | 8 #include "base/file_util.h" |
8 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
9 #include "chrome/common/chrome_constants.h" | 10 #include "chrome/common/chrome_constants.h" |
10 #include "chrome/common/chrome_plugin_lib.h" | 11 #include "chrome/common/chrome_plugin_lib.h" |
11 #include "chrome/common/chrome_plugin_util.h" | 12 #include "chrome/common/chrome_plugin_util.h" |
| 13 #include "chrome/common/chrome_switches.h" |
12 #include "chrome/plugin/plugin_process.h" | 14 #include "chrome/plugin/plugin_process.h" |
13 #include "chrome/plugin/plugin_thread.h" | 15 #include "chrome/plugin/plugin_thread.h" |
14 #include "chrome/plugin/webplugin_proxy.h" | 16 #include "chrome/plugin/webplugin_proxy.h" |
15 #include "net/base/data_url.h" | 17 #include "net/base/data_url.h" |
16 #include "webkit/glue/plugins/plugin_instance.h" | 18 #include "webkit/glue/plugins/plugin_instance.h" |
17 #include "webkit/glue/resource_loader_bridge.h" | 19 #include "webkit/glue/resource_loader_bridge.h" |
18 #include "webkit/glue/resource_type.h" | 20 #include "webkit/glue/resource_type.h" |
19 #include "webkit/glue/webkit_glue.h" | 21 #include "webkit/glue/webkit_glue.h" |
20 | 22 |
21 namespace { | 23 namespace { |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 int STDCALL CPB_GetBrowsingContextInfo( | 329 int STDCALL CPB_GetBrowsingContextInfo( |
328 CPID id, CPBrowsingContext context, CPBrowsingContextInfoType type, | 330 CPID id, CPBrowsingContext context, CPBrowsingContextInfoType type, |
329 void* buf, uint32 buf_size) { | 331 void* buf, uint32 buf_size) { |
330 CHECK(ChromePluginLib::IsPluginThread()); | 332 CHECK(ChromePluginLib::IsPluginThread()); |
331 | 333 |
332 switch (type) { | 334 switch (type) { |
333 case CPBROWSINGCONTEXT_DATA_DIR_PTR: { | 335 case CPBROWSINGCONTEXT_DATA_DIR_PTR: { |
334 if (buf_size < sizeof(char*)) | 336 if (buf_size < sizeof(char*)) |
335 return sizeof(char*); | 337 return sizeof(char*); |
336 | 338 |
337 std::wstring wretval; | 339 std::wstring wretval = CommandLine::ForCurrentProcess()-> |
338 PluginThread::GetPluginThread()->Send( | 340 GetSwitchValue(switches::kPluginDataDir); |
339 new PluginProcessHostMsg_GetPluginDataDir(&wretval)); | 341 DCHECK(!wretval.empty()); |
340 file_util::AppendToPath(&wretval, chrome::kChromePluginDataDirname); | 342 file_util::AppendToPath(&wretval, chrome::kChromePluginDataDirname); |
341 *static_cast<char**>(buf) = CPB_StringDup(CPB_Alloc, WideToUTF8(wretval)); | 343 *static_cast<char**>(buf) = CPB_StringDup(CPB_Alloc, WideToUTF8(wretval)); |
342 return CPERR_SUCCESS; | 344 return CPERR_SUCCESS; |
343 } | 345 } |
344 case CPBROWSINGCONTEXT_UI_LOCALE_PTR: { | 346 case CPBROWSINGCONTEXT_UI_LOCALE_PTR: { |
345 if (buf_size < sizeof(char*)) | 347 if (buf_size < sizeof(char*)) |
346 return sizeof(char*); | 348 return sizeof(char*); |
347 | 349 |
348 std::wstring wretval = webkit_glue::GetWebKitLocale(); | 350 std::wstring wretval = webkit_glue::GetWebKitLocale(); |
349 *static_cast<char**>(buf) = CPB_StringDup(CPB_Alloc, WideToUTF8(wretval)); | 351 *static_cast<char**>(buf) = CPB_StringDup(CPB_Alloc, WideToUTF8(wretval)); |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 response_funcs.size = sizeof(response_funcs); | 606 response_funcs.size = sizeof(response_funcs); |
605 response_funcs.received_redirect = CPRR_ReceivedRedirect; | 607 response_funcs.received_redirect = CPRR_ReceivedRedirect; |
606 response_funcs.start_completed = CPRR_StartCompleted; | 608 response_funcs.start_completed = CPRR_StartCompleted; |
607 response_funcs.read_completed = CPRR_ReadCompleted; | 609 response_funcs.read_completed = CPRR_ReadCompleted; |
608 response_funcs.upload_progress = CPRR_UploadProgress; | 610 response_funcs.upload_progress = CPRR_UploadProgress; |
609 } | 611 } |
610 | 612 |
611 return &browser_funcs; | 613 return &browser_funcs; |
612 } | 614 } |
613 | 615 |
OLD | NEW |