| 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 "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/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 CHECK(ChromePluginLib::IsPluginThread()); | 429 CHECK(ChromePluginLib::IsPluginThread()); |
| 430 | 430 |
| 431 switch (type) { | 431 switch (type) { |
| 432 case CPBROWSINGCONTEXT_DATA_DIR_PTR: { | 432 case CPBROWSINGCONTEXT_DATA_DIR_PTR: { |
| 433 if (buf_size < sizeof(char*)) | 433 if (buf_size < sizeof(char*)) |
| 434 return sizeof(char*); | 434 return sizeof(char*); |
| 435 | 435 |
| 436 FilePath path = CommandLine::ForCurrentProcess()-> | 436 FilePath path = CommandLine::ForCurrentProcess()-> |
| 437 GetSwitchValuePath(switches::kPluginDataDir); | 437 GetSwitchValuePath(switches::kPluginDataDir); |
| 438 DCHECK(!path.empty()); | 438 DCHECK(!path.empty()); |
| 439 std::string retval = WideToUTF8( | 439 // TODO(evan): this is wrong. We can't stuff a path through a UTF-8 string. |
| 440 path.Append(chrome::kChromePluginDataDirname).ToWStringHack()); | 440 // But this code is only used by Gears, which will be removed eventually. |
| 441 std::string retval = UTF16ToUTF8( |
| 442 path.Append(chrome::kChromePluginDataDirname).LossyDisplayName()); |
| 441 *static_cast<char**>(buf) = CPB_StringDup(CPB_Alloc, retval); | 443 *static_cast<char**>(buf) = CPB_StringDup(CPB_Alloc, retval); |
| 442 | 444 |
| 443 return CPERR_SUCCESS; | 445 return CPERR_SUCCESS; |
| 444 } | 446 } |
| 445 case CPBROWSINGCONTEXT_UI_LOCALE_PTR: { | 447 case CPBROWSINGCONTEXT_UI_LOCALE_PTR: { |
| 446 if (buf_size < sizeof(char*)) | 448 if (buf_size < sizeof(char*)) |
| 447 return sizeof(char*); | 449 return sizeof(char*); |
| 448 | 450 |
| 449 std::string retval = webkit_glue::GetWebKitLocale(); | 451 std::string retval = webkit_glue::GetWebKitLocale(); |
| 450 *static_cast<char**>(buf) = CPB_StringDup(CPB_Alloc, retval); | 452 *static_cast<char**>(buf) = CPB_StringDup(CPB_Alloc, retval); |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 | 723 |
| 722 response_funcs.size = sizeof(response_funcs); | 724 response_funcs.size = sizeof(response_funcs); |
| 723 response_funcs.received_redirect = CPRR_ReceivedRedirect; | 725 response_funcs.received_redirect = CPRR_ReceivedRedirect; |
| 724 response_funcs.start_completed = CPRR_StartCompleted; | 726 response_funcs.start_completed = CPRR_StartCompleted; |
| 725 response_funcs.read_completed = CPRR_ReadCompleted; | 727 response_funcs.read_completed = CPRR_ReadCompleted; |
| 726 response_funcs.upload_progress = CPRR_UploadProgress; | 728 response_funcs.upload_progress = CPRR_UploadProgress; |
| 727 } | 729 } |
| 728 | 730 |
| 729 return &browser_funcs; | 731 return &browser_funcs; |
| 730 } | 732 } |
| OLD | NEW |