Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(455)

Side by Side Diff: chrome/browser/chrome_plugin_host.cc

Issue 6246036: FilePath: Remove most of ToWStringHack, adding a LossyDisplayName() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/browser/chrome_plugin_host.h" 5 #include "chrome/browser/chrome_plugin_host.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 case CPBROWSINGCONTEXT_DATA_DIR_PTR: { 457 case CPBROWSINGCONTEXT_DATA_DIR_PTR: {
458 if (buf_size < sizeof(char*)) 458 if (buf_size < sizeof(char*))
459 return sizeof(char*); 459 return sizeof(char*);
460 460
461 // TODO(mpcomplete): http://b/1143021 - When we support multiple profiles, 461 // TODO(mpcomplete): http://b/1143021 - When we support multiple profiles,
462 // fetch the data dir from the context. 462 // fetch the data dir from the context.
463 PluginService* service = PluginService::GetInstance(); 463 PluginService* service = PluginService::GetInstance();
464 if (!service) 464 if (!service)
465 return CPERR_FAILURE; 465 return CPERR_FAILURE;
466 FilePath path = service->GetChromePluginDataDir(); 466 FilePath path = service->GetChromePluginDataDir();
467 std::string retval = WideToUTF8( 467 // TODO(evan): this is wrong. We can't stuff a path through a UTF-8 string.
468 path.Append(chrome::kChromePluginDataDirname).ToWStringHack()); 468 // But this code is only used by Gears, which will be removed eventually.
469 std::string retval = UTF16ToUTF8(
470 path.Append(chrome::kChromePluginDataDirname).LossyDisplayName());
Evan Martin 2011/02/01 22:31:24 In retrospect, as a way of asserting this is Windo
Mark Mentovai 2011/02/01 22:42:44 Evan Martin wrote:
Avi (use Gerrit) 2011/02/01 22:46:25 That sounds good.
469 *static_cast<char**>(buf) = CPB_StringDup(CPB_Alloc, retval); 471 *static_cast<char**>(buf) = CPB_StringDup(CPB_Alloc, retval);
470 return CPERR_SUCCESS; 472 return CPERR_SUCCESS;
471 } 473 }
472 case CPBROWSINGCONTEXT_UI_LOCALE_PTR: { 474 case CPBROWSINGCONTEXT_UI_LOCALE_PTR: {
473 if (buf_size < sizeof(char*)) 475 if (buf_size < sizeof(char*))
474 return sizeof(char*); 476 return sizeof(char*);
475 477
476 PluginService* service = PluginService::GetInstance(); 478 PluginService* service = PluginService::GetInstance();
477 if (!service) 479 if (!service)
478 return CPERR_FAILURE; 480 return CPERR_FAILURE;
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 CPBrowsingContext context) { 829 CPBrowsingContext context) {
828 // Sadly if we try and pass context through, we seem to break cl's little 830 // Sadly if we try and pass context through, we seem to break cl's little
829 // brain trying to compile the Tuple3 ctor. This cast works. 831 // brain trying to compile the Tuple3 ctor. This cast works.
830 int32 context_as_int32 = static_cast<int32>(context); 832 int32 context_as_int32 = static_cast<int32>(context);
831 // Plugins can only be accessed on the IO thread. 833 // Plugins can only be accessed on the IO thread.
832 BrowserThread::PostTask( 834 BrowserThread::PostTask(
833 BrowserThread::IO, FROM_HERE, 835 BrowserThread::IO, FROM_HERE,
834 NewRunnableFunction(PluginCommandHandler::HandleCommand, 836 NewRunnableFunction(PluginCommandHandler::HandleCommand,
835 command, data, context_as_int32)); 837 command, data, context_as_int32));
836 } 838 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698