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

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

Issue 316016: Move the json-related files into a separate json directory. This hopefully al... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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) 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/renderer/extensions/extension_process_bindings.h"
6
5 #include <map> 7 #include <map>
6 #include <set> 8 #include <set>
7 #include <string> 9 #include <string>
8 #include <vector> 10 #include <vector>
9 11
10 #include "chrome/renderer/extensions/extension_process_bindings.h" 12 #include "base/json/json_reader.h"
11
12 #include "base/json_reader.h"
13 #include "base/singleton.h" 13 #include "base/singleton.h"
14 #include "chrome/common/extensions/extension.h" 14 #include "chrome/common/extensions/extension.h"
15 #include "chrome/common/extensions/extension_message_bundle.h" 15 #include "chrome/common/extensions/extension_message_bundle.h"
16 #include "chrome/common/extensions/url_pattern.h" 16 #include "chrome/common/extensions/url_pattern.h"
17 #include "chrome/common/render_messages.h" 17 #include "chrome/common/render_messages.h"
18 #include "chrome/common/url_constants.h" 18 #include "chrome/common/url_constants.h"
19 #include "chrome/renderer/extensions/bindings_utils.h" 19 #include "chrome/renderer/extensions/bindings_utils.h"
20 #include "chrome/renderer/extensions/event_bindings.h" 20 #include "chrome/renderer/extensions/event_bindings.h"
21 #include "chrome/renderer/extensions/js_only_v8_extensions.h" 21 #include "chrome/renderer/extensions/js_only_v8_extensions.h"
22 #include "chrome/renderer/extensions/renderer_extension_bindings.h" 22 #include "chrome/renderer/extensions/renderer_extension_bindings.h"
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 renderview->SendExtensionRequest(name, args_holder, 390 renderview->SendExtensionRequest(name, args_holder,
391 request_id, has_callback); 391 request_id, has_callback);
392 392
393 return v8::Undefined(); 393 return v8::Undefined();
394 } 394 }
395 395
396 // Starts an API request to the browser, with an optional callback. The 396 // Starts an API request to the browser, with an optional callback. The
397 // callback will be dispatched to EventBindings::HandleResponse. 397 // callback will be dispatched to EventBindings::HandleResponse.
398 static v8::Handle<v8::Value> StartRequest(const v8::Arguments& args) { 398 static v8::Handle<v8::Value> StartRequest(const v8::Arguments& args) {
399 std::string str_args = *v8::String::Utf8Value(args[1]); 399 std::string str_args = *v8::String::Utf8Value(args[1]);
400 JSONReader reader; 400 base::JSONReader reader;
401 Value* value_args = reader.JsonToValue(str_args, false, false); 401 Value* value_args = reader.JsonToValue(str_args, false, false);
402 402
403 // Since we do the serialization in the v8 extension, we should always get 403 // Since we do the serialization in the v8 extension, we should always get
404 // valid JSON. 404 // valid JSON.
405 if (!value_args) { 405 if (!value_args) {
406 NOTREACHED() << "Invalid JSON passed to StartRequest."; 406 NOTREACHED() << "Invalid JSON passed to StartRequest.";
407 return v8::Undefined(); 407 return v8::Undefined();
408 } 408 }
409 409
410 return StartRequestCommon(args, value_args); 410 return StartRequestCommon(args, value_args);
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 return; 606 return;
607 607
608 v8::HandleScope handle_scope; 608 v8::HandleScope handle_scope;
609 WebFrame* frame = view->mainFrame(); 609 WebFrame* frame = view->mainFrame();
610 v8::Local<v8::Context> context = frame->mainWorldScriptContext(); 610 v8::Local<v8::Context> context = frame->mainWorldScriptContext();
611 v8::Handle<v8::Value> argv[1]; 611 v8::Handle<v8::Value> argv[1];
612 argv[0] = v8::String::New(type_str); 612 argv[0] = v8::String::New(type_str);
613 bindings_utils::CallFunctionInContext(context, "setViewType", 613 bindings_utils::CallFunctionInContext(context, "setViewType",
614 arraysize(argv), argv); 614 arraysize(argv), argv);
615 } 615 }
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/extension_api_client_unittest.cc ('k') | chrome/test/ui_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698