| 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 #ifndef CHROME_RENDERER_EXTENSIONS_CONTENT_WATCHER_H_ | 5 #ifndef CHROME_RENDERER_EXTENSIONS_CONTENT_WATCHER_H_ |
| 6 #define CHROME_RENDERER_EXTENSIONS_CONTENT_WATCHER_H_ | 6 #define CHROME_RENDERER_EXTENSIONS_CONTENT_WATCHER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // ExtensionHostMsg_OnWatchedPageChange whenever a RenderView's set changes. | 29 // ExtensionHostMsg_OnWatchedPageChange whenever a RenderView's set changes. |
| 30 // | 30 // |
| 31 // There's one ContentWatcher per Dispatcher rather than per RenderView because | 31 // There's one ContentWatcher per Dispatcher rather than per RenderView because |
| 32 // WebFrames can move between RenderViews through adoptNode. | 32 // WebFrames can move between RenderViews through adoptNode. |
| 33 class ContentWatcher { | 33 class ContentWatcher { |
| 34 public: | 34 public: |
| 35 explicit ContentWatcher(Dispatcher* dispatcher); | 35 explicit ContentWatcher(Dispatcher* dispatcher); |
| 36 ~ContentWatcher(); | 36 ~ContentWatcher(); |
| 37 | 37 |
| 38 // Returns the callback to call on a frame change. | 38 // Returns the callback to call on a frame change. |
| 39 scoped_ptr<NativeHandler> MakeNatives(); | 39 scoped_ptr<NativeHandler> MakeNatives(v8::Handle<v8::Context> v8_context); |
| 40 | 40 |
| 41 // Handler for ExtensionMsg_WatchPages. | 41 // Handler for ExtensionMsg_WatchPages. |
| 42 void OnWatchPages(const std::vector<std::string>& css_selectors); | 42 void OnWatchPages(const std::vector<std::string>& css_selectors); |
| 43 | 43 |
| 44 // Registers the MutationObserver to call back into this object whenever the | 44 // Registers the MutationObserver to call back into this object whenever the |
| 45 // content of |frame| changes. | 45 // content of |frame| changes. |
| 46 void DidCreateDocumentElement(WebKit::WebFrame* frame); | 46 void DidCreateDocumentElement(WebKit::WebFrame* frame); |
| 47 | 47 |
| 48 // Scans *frame for the current set of interesting CSS selectors, and if | 48 // Scans *frame for the current set of interesting CSS selectors, and if |
| 49 // they've changed sends ExtensionHostMsg_OnWatchedPageChange back to the | 49 // they've changed sends ExtensionHostMsg_OnWatchedPageChange back to the |
| (...skipping 27 matching lines...) Expand all Loading... |
| 77 // | 77 // |
| 78 // The StringPieces point into css_selectors_ above, so when it changes, they | 78 // The StringPieces point into css_selectors_ above, so when it changes, they |
| 79 // all need to be regenerated. | 79 // all need to be regenerated. |
| 80 std::map<WebKit::WebFrame*, | 80 std::map<WebKit::WebFrame*, |
| 81 std::vector<base::StringPiece> > matching_selectors_; | 81 std::vector<base::StringPiece> > matching_selectors_; |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 } // namespace extensions | 84 } // namespace extensions |
| 85 | 85 |
| 86 #endif // CHROME_RENDERER_EXTENSIONS_CONTENT_WATCHER_H_ | 86 #endif // CHROME_RENDERER_EXTENSIONS_CONTENT_WATCHER_H_ |
| OLD | NEW |