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

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

Issue 9653022: Revert 125811 - Convert app_bindings.js to the schema_generated_bindings.js infrastructure. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chrome_v8_context.h" 5 #include "chrome/renderer/extensions/chrome_v8_context.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_split.h" 9 #include "base/string_split.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "chrome/common/extensions/extension_set.h" 11 #include "chrome/common/extensions/extension_set.h"
12 #include "chrome/renderer/extensions/chrome_v8_extension.h" 12 #include "chrome/renderer/extensions/chrome_v8_extension.h"
13 #include "content/public/renderer/render_view.h" 13 #include "content/public/renderer/render_view.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
16 #include "v8/include/v8.h" 16 #include "v8/include/v8.h"
17 17
18 using extensions::Feature;
19
20 namespace { 18 namespace {
21 19
22 const char kChromeHidden[] = "chromeHidden"; 20 const char kChromeHidden[] = "chromeHidden";
23 21
24 #ifndef NDEBUG 22 #ifndef NDEBUG
25 const char kValidateCallbacks[] = "validateCallbacks"; 23 const char kValidateCallbacks[] = "validateCallbacks";
26 const char kValidateAPI[] = "validateAPI"; 24 const char kValidateAPI[] = "validateAPI";
27 #endif 25 #endif
28 26
29 std::string GetContextTypeDescription(Feature::Context context_type) { 27 std::string GetContextTypeDescription(
28 ChromeV8Context::ContextType context_type) {
30 switch (context_type) { 29 switch (context_type) {
31 case Feature::UNSPECIFIED_CONTEXT: return "unspecified"; 30 case ChromeV8Context::OTHER: return "other";
32 case Feature::PRIVILEGED_CONTEXT: return "privileged"; 31 case ChromeV8Context::CONTENT_SCRIPT: return "content script";
33 case Feature::UNPRIVILEGED_CONTEXT: return "unprivileged";
34 case Feature::CONTENT_SCRIPT_CONTEXT: return "content script";
35 case Feature::WEB_PAGE_CONTEXT: return "web page";
36 } 32 }
37 NOTREACHED(); 33 NOTREACHED();
38 return ""; 34 return "";
39 } 35 }
40 36
41 } // namespace 37 } // namespace
42 38
43 ChromeV8Context::ChromeV8Context(v8::Handle<v8::Context> v8_context, 39 ChromeV8Context::ChromeV8Context(v8::Handle<v8::Context> v8_context,
44 WebKit::WebFrame* web_frame, 40 WebKit::WebFrame* web_frame,
45 const std::string& extension_id, 41 const std::string& extension_id,
46 Feature::Context context_type) 42 ChromeV8Context::ContextType context_type)
47 : v8_context_(v8::Persistent<v8::Context>::New(v8_context)), 43 : v8_context_(v8::Persistent<v8::Context>::New(v8_context)),
48 web_frame_(web_frame), 44 web_frame_(web_frame),
49 extension_id_(extension_id), 45 extension_id_(extension_id),
50 context_type_(context_type) { 46 context_type_(context_type) {
51 VLOG(1) << "Created context for extension\n" 47 VLOG(1) << "Created context for extension\n"
52 << " id: " << extension_id << "\n" 48 << " id: " << extension_id << "\n"
53 << " frame: " << web_frame_ << "\n" 49 << " frame: " << web_frame_ << "\n"
54 << " context type: " << GetContextTypeDescription(context_type); 50 << " context type: " << GetContextTypeDescription(context_type);
55 } 51 }
56 52
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 argv[1] = v8::Boolean::New(is_extension_process); 140 argv[1] = v8::Boolean::New(is_extension_process);
145 argv[2] = v8::Boolean::New(is_incognito_process); 141 argv[2] = v8::Boolean::New(is_incognito_process);
146 argv[3] = v8::Integer::New(manifest_version); 142 argv[3] = v8::Integer::New(manifest_version);
147 CallChromeHiddenMethod("dispatchOnLoad", arraysize(argv), argv, NULL); 143 CallChromeHiddenMethod("dispatchOnLoad", arraysize(argv), argv, NULL);
148 } 144 }
149 145
150 void ChromeV8Context::DispatchOnUnloadEvent() const { 146 void ChromeV8Context::DispatchOnUnloadEvent() const {
151 v8::HandleScope handle_scope; 147 v8::HandleScope handle_scope;
152 CallChromeHiddenMethod("dispatchOnUnload", 0, NULL, NULL); 148 CallChromeHiddenMethod("dispatchOnUnload", 0, NULL, NULL);
153 } 149 }
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/chrome_v8_context.h ('k') | chrome/renderer/extensions/chrome_v8_context_set_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698