OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 switch (type) { | 454 switch (type) { |
455 case CPBROWSINGCONTEXT_DATA_DIR_PTR: { | 455 case CPBROWSINGCONTEXT_DATA_DIR_PTR: { |
456 if (buf_size < sizeof(char*)) | 456 if (buf_size < sizeof(char*)) |
457 return sizeof(char*); | 457 return sizeof(char*); |
458 | 458 |
459 // TODO(mpcomplete): http://b/1143021 - When we support multiple profiles, | 459 // TODO(mpcomplete): http://b/1143021 - When we support multiple profiles, |
460 // fetch the data dir from the context. | 460 // fetch the data dir from the context. |
461 PluginService* service = PluginService::GetInstance(); | 461 PluginService* service = PluginService::GetInstance(); |
462 if (!service) | 462 if (!service) |
463 return CPERR_FAILURE; | 463 return CPERR_FAILURE; |
464 std::wstring wretval = service->GetChromePluginDataDir().ToWStringHack(); | 464 FilePath path = service->GetChromePluginDataDir(); |
465 file_util::AppendToPath(&wretval, chrome::kChromePluginDataDirname); | 465 std::string retval = WideToUTF8( |
466 *static_cast<char**>(buf) = CPB_StringDup(CPB_Alloc, WideToUTF8(wretval)); | 466 path.Append(chrome::kChromePluginDataDirname).ToWStringHack()); |
| 467 *static_cast<char**>(buf) = CPB_StringDup(CPB_Alloc, retval); |
467 return CPERR_SUCCESS; | 468 return CPERR_SUCCESS; |
468 } | 469 } |
469 case CPBROWSINGCONTEXT_UI_LOCALE_PTR: { | 470 case CPBROWSINGCONTEXT_UI_LOCALE_PTR: { |
470 if (buf_size < sizeof(char*)) | 471 if (buf_size < sizeof(char*)) |
471 return sizeof(char*); | 472 return sizeof(char*); |
472 | 473 |
473 PluginService* service = PluginService::GetInstance(); | 474 PluginService* service = PluginService::GetInstance(); |
474 if (!service) | 475 if (!service) |
475 return CPERR_FAILURE; | 476 return CPERR_FAILURE; |
476 const std::wstring& wretval = service->GetUILocale(); | 477 const std::wstring& wretval = service->GetUILocale(); |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 CPBrowsingContext context) { | 816 CPBrowsingContext context) { |
816 // Sadly if we try and pass context through, we seem to break cl's little | 817 // Sadly if we try and pass context through, we seem to break cl's little |
817 // brain trying to compile the Tuple3 ctor. This cast works. | 818 // brain trying to compile the Tuple3 ctor. This cast works. |
818 int32 context_as_int32 = static_cast<int32>(context); | 819 int32 context_as_int32 = static_cast<int32>(context); |
819 // Plugins can only be accessed on the IO thread. | 820 // Plugins can only be accessed on the IO thread. |
820 ChromeThread::PostTask( | 821 ChromeThread::PostTask( |
821 ChromeThread::IO, FROM_HERE, | 822 ChromeThread::IO, FROM_HERE, |
822 NewRunnableFunction(PluginCommandHandler::HandleCommand, | 823 NewRunnableFunction(PluginCommandHandler::HandleCommand, |
823 command, data, context_as_int32)); | 824 command, data, context_as_int32)); |
824 } | 825 } |
OLD | NEW |