| Index: chrome/renderer/extensions/content_watcher.h
|
| diff --git a/chrome/renderer/extensions/content_watcher.h b/chrome/renderer/extensions/content_watcher.h
|
| index 908dad391cf65765f389ef986e92ba609e6c8bdd..93405bf05c1d7bec5e9179c735123a7384c92e1b 100644
|
| --- a/chrome/renderer/extensions/content_watcher.h
|
| +++ b/chrome/renderer/extensions/content_watcher.h
|
| @@ -12,6 +12,7 @@
|
| #include "base/memory/scoped_ptr.h"
|
| #include "base/memory/weak_ptr.h"
|
| #include "base/string_piece.h"
|
| +#include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h"
|
| #include "v8/include/v8.h"
|
|
|
| namespace WebKit {
|
| @@ -35,27 +36,28 @@ class ContentWatcher {
|
| explicit ContentWatcher(Dispatcher* dispatcher);
|
| ~ContentWatcher();
|
|
|
| - // Returns the callback to call on a frame change.
|
| - scoped_ptr<NativeHandler> MakeNatives();
|
| -
|
| // Handler for ExtensionMsg_WatchPages.
|
| void OnWatchPages(const std::vector<std::string>& css_selectors);
|
|
|
| + // Uses CSS to watch the selectors in css_selectors_.
|
| + void OnWebViewCreated(WebKit::WebView* view);
|
| +
|
| // Registers the MutationObserver to call back into this object whenever the
|
| // content of |frame| changes.
|
| void DidCreateDocumentElement(WebKit::WebFrame* frame);
|
|
|
| - // Scans *frame for the current set of interesting CSS selectors, and if
|
| - // they've changed sends ExtensionHostMsg_OnWatchedPageChange back to the
|
| - // RenderViewHost that owns the frame.
|
| - void ScanAndNotify(WebKit::WebFrame* frame);
|
| + // Records that |newlyMatchingSelectors| have started matching on |*frame|,
|
| + // and |stoppedMatchingSelectors| have stopped matching.
|
| + void CssMatches(
|
| + WebKit::WebFrame* frame,
|
| + const WebKit::WebVector<WebKit::WebString>& newlyMatchingSelectors,
|
| + const WebKit::WebVector<WebKit::WebString>& stoppedMatchingSelectors);
|
|
|
| private:
|
| void EnsureWatchingMutations(WebKit::WebFrame* frame);
|
|
|
| ModuleSystem* GetModuleSystem(WebKit::WebFrame* frame) const;
|
| - std::vector<base::StringPiece> FindMatchingSelectors(
|
| - WebKit::WebFrame* frame) const;
|
| + std::set<std::string> FindMatchingSelectors(WebKit::WebFrame* frame) const;
|
|
|
| // Given that we saw a change in the CSS selectors that |changed_frame|
|
| // matched, tell the browser about the new set of matching selectors in its
|
| @@ -74,11 +76,7 @@ class ContentWatcher {
|
| // Maps live WebFrames to the set of CSS selectors they match. This lets us
|
| // traverse a top-level frame's sub-frames without rescanning them all each
|
| // time any one changes.
|
| - //
|
| - // The StringPieces point into css_selectors_ above, so when it changes, they
|
| - // all need to be regenerated.
|
| - std::map<WebKit::WebFrame*,
|
| - std::vector<base::StringPiece> > matching_selectors_;
|
| + std::map<WebKit::WebFrame*, std::set<std::string> > matching_selectors_;
|
| };
|
|
|
| } // namespace extensions
|
|
|