| 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/content_watcher.h" | 5 #include "extensions/renderer/content_watcher.h" |
| 6 | 6 |
| 7 #include "content/public/renderer/render_view.h" | 7 #include "content/public/renderer/render_view.h" |
| 8 #include "content/public/renderer/render_view_visitor.h" | 8 #include "content/public/renderer/render_view_visitor.h" |
| 9 #include "extensions/common/extension_messages.h" | 9 #include "extensions/common/extension_messages.h" |
| 10 #include "third_party/WebKit/public/web/WebDocument.h" | 10 #include "third_party/WebKit/public/web/WebDocument.h" |
| 11 #include "third_party/WebKit/public/web/WebElement.h" | 11 #include "third_party/WebKit/public/web/WebElement.h" |
| 12 #include "third_party/WebKit/public/web/WebFrame.h" | 12 #include "third_party/WebKit/public/web/WebFrame.h" |
| 13 #include "third_party/WebKit/public/web/WebScriptBindings.h" | 13 #include "third_party/WebKit/public/web/WebScriptBindings.h" |
| 14 #include "third_party/WebKit/public/web/WebView.h" | 14 #include "third_party/WebKit/public/web/WebView.h" |
| 15 | 15 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 if (top_origin.canAccess(frame->document().securityOrigin())) { | 99 if (top_origin.canAccess(frame->document().securityOrigin())) { |
| 100 std::map<blink::WebFrame*, std::set<std::string> >::const_iterator | 100 std::map<blink::WebFrame*, std::set<std::string> >::const_iterator |
| 101 frame_selectors = matching_selectors_.find(frame); | 101 frame_selectors = matching_selectors_.find(frame); |
| 102 if (frame_selectors != matching_selectors_.end()) { | 102 if (frame_selectors != matching_selectors_.end()) { |
| 103 transitive_selectors.insert(frame_selectors->second.begin(), | 103 transitive_selectors.insert(frame_selectors->second.begin(), |
| 104 frame_selectors->second.end()); | 104 frame_selectors->second.end()); |
| 105 } | 105 } |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 std::vector<std::string> selector_strings; | 108 std::vector<std::string> selector_strings; |
| 109 for (std::set<base::StringPiece>::const_iterator | 109 for (std::set<base::StringPiece>::const_iterator it = |
| 110 it = transitive_selectors.begin(); | 110 transitive_selectors.begin(); |
| 111 it != transitive_selectors.end(); ++it) | 111 it != transitive_selectors.end(); |
| 112 ++it) |
| 112 selector_strings.push_back(it->as_string()); | 113 selector_strings.push_back(it->as_string()); |
| 113 content::RenderView* view = | 114 content::RenderView* view = |
| 114 content::RenderView::FromWebView(top_frame->view()); | 115 content::RenderView::FromWebView(top_frame->view()); |
| 115 view->Send(new ExtensionHostMsg_OnWatchedPageChange( | 116 view->Send(new ExtensionHostMsg_OnWatchedPageChange(view->GetRoutingID(), |
| 116 view->GetRoutingID(), selector_strings)); | 117 selector_strings)); |
| 117 } | 118 } |
| 118 | 119 |
| 119 } // namespace extensions | 120 } // namespace extensions |
| OLD | NEW |