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 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1294 // WebKit doesn't let us define an additional user agent stylesheet, so we | 1294 // 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 | 1295 // insert the default platform app stylesheet into all documents that are |
1296 // loaded in each app. | 1296 // loaded in each app. |
1297 std::string stylesheet = | 1297 std::string stylesheet = |
1298 ResourceBundle::GetSharedInstance(). | 1298 ResourceBundle::GetSharedInstance(). |
1299 GetRawDataResource(IDR_PLATFORM_APP_CSS).as_string(); | 1299 GetRawDataResource(IDR_PLATFORM_APP_CSS).as_string(); |
1300 ReplaceFirstSubstringAfterOffset(&stylesheet, 0, | 1300 ReplaceFirstSubstringAfterOffset(&stylesheet, 0, |
1301 "$FONTFAMILY", system_font_family_); | 1301 "$FONTFAMILY", system_font_family_); |
1302 ReplaceFirstSubstringAfterOffset(&stylesheet, 0, | 1302 ReplaceFirstSubstringAfterOffset(&stylesheet, 0, |
1303 "$FONTSIZE", system_font_size_); | 1303 "$FONTSIZE", system_font_size_); |
1304 frame->document().insertUserStyleSheet( | 1304 frame->document().insertStyleSheet(WebString::fromUTF8(stylesheet)); |
1305 WebString::fromUTF8(stylesheet), WebDocument::UserStyleAuthorLevel); | |
1306 } | 1305 } |
1307 | 1306 |
1308 content_watcher_->DidCreateDocumentElement(frame); | 1307 content_watcher_->DidCreateDocumentElement(frame); |
1309 } | 1308 } |
1310 | 1309 |
1311 void Dispatcher::DidMatchCSS( | 1310 void Dispatcher::DidMatchCSS( |
1312 blink::WebFrame* frame, | 1311 blink::WebFrame* frame, |
1313 const blink::WebVector<blink::WebString>& newly_matching_selectors, | 1312 const blink::WebVector<blink::WebString>& newly_matching_selectors, |
1314 const blink::WebVector<blink::WebString>& stopped_matching_selectors) { | 1313 const blink::WebVector<blink::WebString>& stopped_matching_selectors) { |
1315 content_watcher_->DidMatchCSS( | 1314 content_watcher_->DidMatchCSS( |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1685 } | 1684 } |
1686 | 1685 |
1687 void Dispatcher::ClearPortData(int port_id) { | 1686 void Dispatcher::ClearPortData(int port_id) { |
1688 // Only the target port side has entries in |port_to_tab_id_map_|. If | 1687 // Only the target port side has entries in |port_to_tab_id_map_|. If |
1689 // |port_id| is a source port, std::map::erase() will just silently fail | 1688 // |port_id| is a source port, std::map::erase() will just silently fail |
1690 // here as a no-op. | 1689 // here as a no-op. |
1691 port_to_tab_id_map_.erase(port_id); | 1690 port_to_tab_id_map_.erase(port_id); |
1692 } | 1691 } |
1693 | 1692 |
1694 } // namespace extensions | 1693 } // namespace extensions |
OLD | NEW |