| OLD | NEW |
| 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/dispatcher.h" | 5 #include "chrome/renderer/extensions/dispatcher.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
| (...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1070 } | 1070 } |
| 1071 | 1071 |
| 1072 void Dispatcher::WillReleaseScriptContext( | 1072 void Dispatcher::WillReleaseScriptContext( |
| 1073 WebFrame* frame, v8::Handle<v8::Context> v8_context, int world_id) { | 1073 WebFrame* frame, v8::Handle<v8::Context> v8_context, int world_id) { |
| 1074 ChromeV8Context* context = v8_context_set_.GetByV8Context(v8_context); | 1074 ChromeV8Context* context = v8_context_set_.GetByV8Context(v8_context); |
| 1075 if (!context) | 1075 if (!context) |
| 1076 return; | 1076 return; |
| 1077 | 1077 |
| 1078 context->DispatchOnUnloadEvent(); | 1078 context->DispatchOnUnloadEvent(); |
| 1079 // TODO(kalman): add an invalidation observer interface to ChromeV8Context. | 1079 // TODO(kalman): add an invalidation observer interface to ChromeV8Context. |
| 1080 request_sender_->InvalidateContext(context); | 1080 request_sender_->InvalidateSource(context); |
| 1081 | 1081 |
| 1082 v8_context_set_.Remove(context); | 1082 v8_context_set_.Remove(context); |
| 1083 VLOG(1) << "Num tracked contexts: " << v8_context_set_.size(); | 1083 VLOG(1) << "Num tracked contexts: " << v8_context_set_.size(); |
| 1084 } | 1084 } |
| 1085 | 1085 |
| 1086 void Dispatcher::DidCreateDocumentElement(WebKit::WebFrame* frame) { | 1086 void Dispatcher::DidCreateDocumentElement(WebKit::WebFrame* frame) { |
| 1087 if (IsWithinPlatformApp(frame)) { | 1087 if (IsWithinPlatformApp(frame)) { |
| 1088 // WebKit doesn't let us define an additional user agent stylesheet, so we | 1088 // WebKit doesn't let us define an additional user agent stylesheet, so we |
| 1089 // insert the default platform app stylesheet into all documents that are | 1089 // insert the default platform app stylesheet into all documents that are |
| 1090 // loaded in each app. | 1090 // loaded in each app. |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1366 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); | 1366 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); |
| 1367 v8::ThrowException( | 1367 v8::ThrowException( |
| 1368 v8::Exception::Error(v8::String::New(error_msg.c_str()))); | 1368 v8::Exception::Error(v8::String::New(error_msg.c_str()))); |
| 1369 return false; | 1369 return false; |
| 1370 } | 1370 } |
| 1371 | 1371 |
| 1372 return true; | 1372 return true; |
| 1373 } | 1373 } |
| 1374 | 1374 |
| 1375 } // namespace extensions | 1375 } // namespace extensions |
| OLD | NEW |