Index: chrome/browser/resources/uber/uber_frame.js |
diff --git a/chrome/browser/resources/uber/uber_frame.js b/chrome/browser/resources/uber/uber_frame.js |
index ede1363048901c17a9efe43e471655db2234410b..47f950433e5e5f096e6b34fa8205d85cc1937c9b 100644 |
--- a/chrome/browser/resources/uber/uber_frame.js |
+++ b/chrome/browser/resources/uber/uber_frame.js |
@@ -39,6 +39,14 @@ cr.define('uber_frame', function() { |
if (e.target.classList.contains('selected')) |
return; |
+ // Extensions can override Uber content (e.g., if the user has a history |
Mark Mentovai
2012/04/09 22:55:58
This too.
|
+ // extension, it should display when the 'History' navigation is clicked). |
+ if (e.currentTarget.getAttribute('override') == 'yes') { |
+ window.open('chrome://' + e.currentTarget.getAttribute('controls'), |
+ '_blank'); |
+ return; |
+ } |
+ |
uber.invokeMethodOnParent('showPage', |
{pageId: e.currentTarget.getAttribute('controls')}); |
@@ -122,8 +130,23 @@ cr.define('uber_frame', function() { |
return document.querySelector('.iframe-container.selected'); |
} |
+ /** |
+ * Finds the <li> element whose 'controls' attribute is |controls| and sets |
+ * its 'override' attribute to |override|. |
+ * @param {string} controls The value of the 'controls' attribute of the |
+ * element to change. |
+ * @param {string} override The value to set for the 'override' attribute of |
+ * that element (either 'yes' or 'no'). |
+ */ |
+ function setNavigationOverride(controls, override) { |
+ var navItem = |
+ document.querySelector('li[controls="' + controls + '"]'); |
+ navItem.setAttribute('override', override); |
+ } |
+ |
return { |
onLoad: onLoad, |
+ setNavigationOverride: setNavigationOverride, |
}; |
}); |