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

Side by Side Diff: chrome/renderer/extensions/extension_process_bindings.cc

Issue 3057027: Convert wstring/wchar_t* in chrome/renderer to std::string/char* or string16. (Closed)
Patch Set: utf8 -> utf16 for things coming from resources Created 10 years, 4 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/renderer/extensions/extension_process_bindings.h" 5 #include "chrome/renderer/extensions/extension_process_bindings.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 // to the hosting view. At the moment we assume that there may only be 288 // to the hosting view. At the moment we assume that there may only be
289 // a single pop-up view for a given extension. By doing so, we can find 289 // a single pop-up view for a given extension. By doing so, we can find
290 // the pop-up view by simply searching for the only pop-up view present. 290 // the pop-up view by simply searching for the only pop-up view present.
291 // We also assume that if the current view is a pop-up, we can find the 291 // We also assume that if the current view is a pop-up, we can find the
292 // hosting view by searching for a TOOLSTRIP view. 292 // hosting view by searching for a TOOLSTRIP view.
293 if (args.Length() != 0) 293 if (args.Length() != 0)
294 return v8::Undefined(); 294 return v8::Undefined();
295 295
296 if (viewtype_to_find != ViewType::EXTENSION_POPUP && 296 if (viewtype_to_find != ViewType::EXTENSION_POPUP &&
297 viewtype_to_find != ViewType::EXTENSION_TOOLSTRIP) { 297 viewtype_to_find != ViewType::EXTENSION_TOOLSTRIP) {
298 NOTREACHED() << L"Requesting invalid view type."; 298 NOTREACHED() << "Requesting invalid view type.";
299 } 299 }
300 300
301 // Disallow searching for a host view if we are a popup view, and likewise 301 // Disallow searching for a host view if we are a popup view, and likewise
302 // if we are a toolstrip view. 302 // if we are a toolstrip view.
303 RenderView* render_view = bindings_utils::GetRenderViewForCurrentContext(); 303 RenderView* render_view = bindings_utils::GetRenderViewForCurrentContext();
304 if (!render_view || 304 if (!render_view ||
305 render_view->view_type() == viewtype_to_find) { 305 render_view->view_type() == viewtype_to_find) {
306 return v8::Undefined(); 306 return v8::Undefined();
307 } 307 }
308 308
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 ((data->Get(v8::Integer::New(4*t + 2))->Int32Value() & 0xFF) << 0)); 520 ((data->Get(v8::Integer::New(4*t + 2))->Int32Value() & 0xFF) << 0));
521 } 521 }
522 522
523 // Construct the Value object. 523 // Construct the Value object.
524 IPC::Message bitmap_pickle; 524 IPC::Message bitmap_pickle;
525 IPC::WriteParam(&bitmap_pickle, bitmap); 525 IPC::WriteParam(&bitmap_pickle, bitmap);
526 Value* bitmap_value = BinaryValue::CreateWithCopiedBuffer( 526 Value* bitmap_value = BinaryValue::CreateWithCopiedBuffer(
527 static_cast<const char*>(bitmap_pickle.data()), bitmap_pickle.size()); 527 static_cast<const char*>(bitmap_pickle.data()), bitmap_pickle.size());
528 528
529 DictionaryValue* dict = new DictionaryValue(); 529 DictionaryValue* dict = new DictionaryValue();
530 dict->Set(L"imageData", bitmap_value); 530 dict->Set("imageData", bitmap_value);
531 531
532 if (details->Has(v8::String::New("tabId"))) { 532 if (details->Has(v8::String::New("tabId"))) {
533 dict->SetInteger(L"tabId", 533 dict->SetInteger("tabId",
534 details->Get(v8::String::New("tabId"))->Int32Value()); 534 details->Get(v8::String::New("tabId"))->Int32Value());
535 } 535 }
536 536
537 ListValue list_value; 537 ListValue list_value;
538 list_value.Append(dict); 538 list_value.Append(dict);
539 539
540 return StartRequestCommon(args, list_value); 540 return StartRequestCommon(args, list_value);
541 } 541 }
542 542
543 static v8::Handle<v8::Value> GetRenderViewId(const v8::Arguments& args) { 543 static v8::Handle<v8::Value> GetRenderViewId(const v8::Arguments& args) {
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 return; 723 return;
724 724
725 v8::HandleScope handle_scope; 725 v8::HandleScope handle_scope;
726 WebFrame* frame = view->mainFrame(); 726 WebFrame* frame = view->mainFrame();
727 v8::Local<v8::Context> context = frame->mainWorldScriptContext(); 727 v8::Local<v8::Context> context = frame->mainWorldScriptContext();
728 v8::Handle<v8::Value> argv[1]; 728 v8::Handle<v8::Value> argv[1];
729 argv[0] = v8::String::New(type_str); 729 argv[0] = v8::String::New(type_str);
730 bindings_utils::CallFunctionInContext(context, "setViewType", 730 bindings_utils::CallFunctionInContext(context, "setViewType",
731 arraysize(argv), argv); 731 arraysize(argv), argv);
732 } 732 }
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/extension_api_json_validity_unittest.cc ('k') | chrome/renderer/localized_error.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698