| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef EXTENSIONS_RENDERER_CONTENT_WATCHER_H_ | 5 #ifndef EXTENSIONS_RENDERER_CONTENT_WATCHER_H_ |
| 6 #define EXTENSIONS_RENDERER_CONTENT_WATCHER_H_ | 6 #define EXTENSIONS_RENDERER_CONTENT_WATCHER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "third_party/WebKit/public/platform/WebVector.h" | 13 #include "third_party/WebKit/public/platform/WebVector.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 class WebFrame; | 16 class WebFrame; |
| 17 class WebLocalFrame; | 17 class WebLocalFrame; |
| 18 class WebString; | 18 class WebString; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace extensions { | 21 namespace extensions { |
| 22 class Dispatcher; | 22 class Dispatcher; |
| 23 class Extension; | |
| 24 class NativeHandler; | |
| 25 | 23 |
| 26 // Watches the content of WebFrames to notify extensions when they match various | 24 // Watches the content of WebFrames to notify extensions when they match various |
| 27 // patterns. This class tracks the set of relevant patterns (set by | 25 // patterns. This class tracks the set of relevant patterns (set by |
| 28 // ExtensionMsg_WatchPages) and the set that match on each WebFrame, and sends a | 26 // ExtensionMsg_WatchPages) and the set that match on each WebFrame, and sends a |
| 29 // ExtensionHostMsg_OnWatchedPageChange whenever a RenderView's set changes. | 27 // ExtensionHostMsg_OnWatchedPageChange whenever a RenderView's set changes. |
| 30 // | 28 // |
| 31 // There's one ContentWatcher per Dispatcher rather than per RenderView because | 29 // There's one ContentWatcher per Dispatcher rather than per RenderView because |
| 32 // WebFrames can move between RenderViews through adoptNode. | 30 // WebFrames can move between RenderViews through adoptNode. |
| 33 // TODO(devlin): This class isn't OOPI-safe. | 31 // TODO(devlin): This class isn't OOPI-safe. |
| 34 class ContentWatcher { | 32 class ContentWatcher { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 64 blink::WebVector<blink::WebString> css_selectors_; | 62 blink::WebVector<blink::WebString> css_selectors_; |
| 65 | 63 |
| 66 // Maps live WebFrames to the set of CSS selectors they match. Blink sends | 64 // Maps live WebFrames to the set of CSS selectors they match. Blink sends |
| 67 // back diffs, which we apply to these sets. | 65 // back diffs, which we apply to these sets. |
| 68 std::map<blink::WebFrame*, std::set<std::string> > matching_selectors_; | 66 std::map<blink::WebFrame*, std::set<std::string> > matching_selectors_; |
| 69 }; | 67 }; |
| 70 | 68 |
| 71 } // namespace extensions | 69 } // namespace extensions |
| 72 | 70 |
| 73 #endif // EXTENSIONS_RENDERER_CONTENT_WATCHER_H_ | 71 #endif // EXTENSIONS_RENDERER_CONTENT_WATCHER_H_ |
| OLD | NEW |