| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/browser/extensions/api/declarative_content/declarative_content_
css_condition_tracker.h" | 5 #include "chrome/browser/extensions/api/declarative_content/declarative_content_
css_condition_tracker.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 request_evaluation_(request_evaluation), | 92 request_evaluation_(request_evaluation), |
| 93 web_contents_destroyed_(web_contents_destroyed) { | 93 web_contents_destroyed_(web_contents_destroyed) { |
| 94 } | 94 } |
| 95 | 95 |
| 96 DeclarativeContentCssConditionTracker::PerWebContentsTracker:: | 96 DeclarativeContentCssConditionTracker::PerWebContentsTracker:: |
| 97 ~PerWebContentsTracker() { | 97 ~PerWebContentsTracker() { |
| 98 } | 98 } |
| 99 | 99 |
| 100 void DeclarativeContentCssConditionTracker::PerWebContentsTracker:: | 100 void DeclarativeContentCssConditionTracker::PerWebContentsTracker:: |
| 101 OnWebContentsNavigation(content::NavigationHandle* navigation_handle) { | 101 OnWebContentsNavigation(content::NavigationHandle* navigation_handle) { |
| 102 if (navigation_handle->IsSamePage()) { | 102 if (navigation_handle->IsSameDocument()) { |
| 103 // Within-page navigations don't change the set of elements that | 103 // Within-page navigations don't change the set of elements that |
| 104 // exist, and we only support filtering on the top-level URL, so | 104 // exist, and we only support filtering on the top-level URL, so |
| 105 // this can't change which rules match. | 105 // this can't change which rules match. |
| 106 return; | 106 return; |
| 107 } | 107 } |
| 108 | 108 |
| 109 // Top-level navigation produces a new document. Initially, the | 109 // Top-level navigation produces a new document. Initially, the |
| 110 // document's empty, so no CSS rules match. The renderer will send | 110 // document's empty, so no CSS rules match. The renderer will send |
| 111 // an ExtensionHostMsg_OnWatchedPageChange later if any CSS rules | 111 // an ExtensionHostMsg_OnWatchedPageChange later if any CSS rules |
| 112 // match. | 112 // match. |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 } | 301 } |
| 302 } | 302 } |
| 303 | 303 |
| 304 void DeclarativeContentCssConditionTracker::DeletePerWebContentsTracker( | 304 void DeclarativeContentCssConditionTracker::DeletePerWebContentsTracker( |
| 305 content::WebContents* contents) { | 305 content::WebContents* contents) { |
| 306 DCHECK(base::ContainsKey(per_web_contents_tracker_, contents)); | 306 DCHECK(base::ContainsKey(per_web_contents_tracker_, contents)); |
| 307 per_web_contents_tracker_.erase(contents); | 307 per_web_contents_tracker_.erase(contents); |
| 308 } | 308 } |
| 309 | 309 |
| 310 } // namespace extensions | 310 } // namespace extensions |
| OLD | NEW |