Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3413)

Unified Diff: chrome/renderer/resources/extensions/tag_watcher.js

Issue 2551303003: Remove unused packaged app window controls code. (Closed)
Patch Set: Nit Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/resources/extensions/tag_watcher.js
diff --git a/chrome/renderer/resources/extensions/tag_watcher.js b/chrome/renderer/resources/extensions/tag_watcher.js
deleted file mode 100644
index 0566ab84af3d555c9ac43dd1d1b4894717efb59b..0000000000000000000000000000000000000000
--- a/chrome/renderer/resources/extensions/tag_watcher.js
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-function watchForTag(tagName, cb) {
- if (!document.body)
- return;
-
- function findChildTags(queryNode) {
- $Array.forEach(queryNode.querySelectorAll(tagName), function(node) {
- cb(node);
- });
- }
- // Query tags already in the document.
- findChildTags(document.body);
-
- // Observe the tags added later.
- var documentObserver = new MutationObserver(function(mutations) {
- $Array.forEach(mutations, function(mutation) {
- $Array.forEach(mutation.addedNodes, function(addedNode) {
- if (addedNode.nodeType == Node.ELEMENT_NODE) {
- if (addedNode.tagName == tagName)
- cb(addedNode);
- findChildTags(addedNode);
- }
- });
- });
- });
- documentObserver.observe(document, {subtree: true, childList: true});
-}
-
-// Expose a function to watch the |tagName| introduction via mutation observer.
-//
-// We employee mutation observer to watch on any introduction of |tagName|
-// within document so that we may handle it accordingly (either creating it or
-// reporting error due to lack of permission).
-// Think carefully about when to call this. On one hand, mutation observer
-// functions on document, so we need to make sure document is finished
-// parsing. To satisfy this, document.readyState has to be "interactive" or
-// after. On the other hand, we intend to do this as early as possible so that
-// developer would have no chance to bring in any conflicted property. To meet
-// this requirement, we choose "readystatechange" event of window and use
-// capturing way.
-function addTagWatcher(tagName, cb) {
- var useCapture = true;
- window.addEventListener('readystatechange', function listener(event) {
- if (document.readyState == 'loading')
- return;
-
- watchForTag(tagName, cb);
- window.removeEventListener(event.type, listener, useCapture);
- }, useCapture);
-}
-
-exports.$set('addTagWatcher', addTagWatcher);
« no previous file with comments | « chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc ('k') | chrome/renderer/resources/renderer_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698