| 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/debug/alias.h" | 9 #include "base/debug/alias.h" |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1283 if (!v8_context->HasOutOfMemoryException()) | 1283 if (!v8_context->HasOutOfMemoryException()) |
| 1284 context->DispatchOnUnloadEvent(); | 1284 context->DispatchOnUnloadEvent(); |
| 1285 // TODO(kalman): add an invalidation observer interface to ChromeV8Context. | 1285 // TODO(kalman): add an invalidation observer interface to ChromeV8Context. |
| 1286 request_sender_->InvalidateSource(context); | 1286 request_sender_->InvalidateSource(context); |
| 1287 | 1287 |
| 1288 v8_context_set_.Remove(context); | 1288 v8_context_set_.Remove(context); |
| 1289 VLOG(1) << "Num tracked contexts: " << v8_context_set_.size(); | 1289 VLOG(1) << "Num tracked contexts: " << v8_context_set_.size(); |
| 1290 } | 1290 } |
| 1291 | 1291 |
| 1292 void Dispatcher::DidCreateDocumentElement(blink::WebFrame* frame) { | 1292 void Dispatcher::DidCreateDocumentElement(blink::WebFrame* frame) { |
| 1293 if (frame->document().isNull()) |
| 1294 return; |
| 1295 |
| 1293 if (IsWithinPlatformApp()) { | 1296 if (IsWithinPlatformApp()) { |
| 1294 // WebKit doesn't let us define an additional user agent stylesheet, so we | 1297 // WebKit doesn't let us define an additional user agent stylesheet, so we |
| 1295 // insert the default platform app stylesheet into all documents that are | 1298 // insert the default platform app stylesheet into all documents that are |
| 1296 // loaded in each app. | 1299 // loaded in each app. |
| 1297 std::string stylesheet = | 1300 std::string stylesheet = |
| 1298 ResourceBundle::GetSharedInstance(). | 1301 ResourceBundle::GetSharedInstance(). |
| 1299 GetRawDataResource(IDR_PLATFORM_APP_CSS).as_string(); | 1302 GetRawDataResource(IDR_PLATFORM_APP_CSS).as_string(); |
| 1300 ReplaceFirstSubstringAfterOffset(&stylesheet, 0, | 1303 ReplaceFirstSubstringAfterOffset(&stylesheet, 0, |
| 1301 "$FONTFAMILY", system_font_family_); | 1304 "$FONTFAMILY", system_font_family_); |
| 1302 ReplaceFirstSubstringAfterOffset(&stylesheet, 0, | 1305 ReplaceFirstSubstringAfterOffset(&stylesheet, 0, |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1684 } | 1687 } |
| 1685 | 1688 |
| 1686 void Dispatcher::ClearPortData(int port_id) { | 1689 void Dispatcher::ClearPortData(int port_id) { |
| 1687 // Only the target port side has entries in |port_to_tab_id_map_|. If | 1690 // Only the target port side has entries in |port_to_tab_id_map_|. If |
| 1688 // |port_id| is a source port, std::map::erase() will just silently fail | 1691 // |port_id| is a source port, std::map::erase() will just silently fail |
| 1689 // here as a no-op. | 1692 // here as a no-op. |
| 1690 port_to_tab_id_map_.erase(port_id); | 1693 port_to_tab_id_map_.erase(port_id); |
| 1691 } | 1694 } |
| 1692 | 1695 |
| 1693 } // namespace extensions | 1696 } // namespace extensions |
| OLD | NEW |