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

Unified Diff: chrome/browser/resources/net_internals/tabswitcherview.js

Issue 7531005: Rename the net_internals file names to include hyphens. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Add some missing files Created 9 years, 5 months 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/browser/resources/net_internals/tabswitcherview.js
===================================================================
--- chrome/browser/resources/net_internals/tabswitcherview.js (revision 94551)
+++ chrome/browser/resources/net_internals/tabswitcherview.js (working copy)
@@ -1,150 +0,0 @@
-// Copyright (c) 2011 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.
-
-/**
- * TabSwitcherView is an implementation of View that handles tab switching.
- *
- * It is comprised of many views (tabs), only one of which is visible at a
- * time.
- *
- * This view represents solely the selected tab's content area -- a separate
- * view needs to be maintained for the tab handles.
- *
- * @constructor
- */
-function TabSwitcherView() {
- View.call(this);
- this.tabs_ = [];
-}
-
-inherits(TabSwitcherView, View);
-
-TabSwitcherView.prototype.setGeometry = function(left, top, width, height) {
- TabSwitcherView.superClass_.setGeometry.call(this, left, top, width, height);
-
- // Position each of the tabs content areas.
- for (var i = 0; i < this.tabs_.length; ++i) {
- var tab = this.tabs_[i];
- tab.contentView.setGeometry(left, top, width, height);
- }
-};
-
-TabSwitcherView.prototype.show = function(isVisible) {
- TabSwitcherView.superClass_.show.call(this, isVisible);
-
- var activeTab = this.findActiveTab();
- if (activeTab)
- activeTab.contentView.show(isVisible);
-};
-
-/**
- * Adds a new tab (initially hidden).
- *
- * @param {String} id The ID for DOM node that will be made clickable to select
- * this tab. This is also the ID we use to identify the
- * "tab".
- * @param {!View} view The tab's actual contents.
- */
-TabSwitcherView.prototype.addTab = function(id, contentView, switchOnClick,
- visible) {
- var tab = new TabEntry(id, contentView);
- this.tabs_.push(tab);
-
- if (switchOnClick) {
- // Attach a click handler, used to switch to the tab.
- var self = this;
- tab.getTabHandleNode().onclick = function() {
- self.switchToTab(id, null);
- };
- }
-
- // Start tabs off as hidden.
- tab.contentView.show(false);
-
- this.showTabHandleNode(id, visible);
-};
-
-/**
- * Returns the currently selected tab, or null if there is none.
- * @returns {!TabEntry}
- */
-TabSwitcherView.prototype.findActiveTab = function() {
- for (var i = 0; i < this.tabs_.length; ++i) {
- var tab = this.tabs_[i];
- if (tab.active)
- return tab;
- }
- return null;
-};
-
-/**
- * Returns the tab with ID |id|.
- * @returns {!TabEntry}
- */
-TabSwitcherView.prototype.findTabById = function(id) {
- for (var i = 0; i < this.tabs_.length; ++i) {
- var tab = this.tabs_[i];
- if (tab.id == id)
- return tab;
- }
- return null;
-};
-
-/**
- * Focuses on tab with ID |id|. |params| is a dictionary that will be
- * passed to the tab's setParameters function, if it's non-null.
- */
-TabSwitcherView.prototype.switchToTab = function(id, params) {
- var oldTab = this.findActiveTab();
- if (oldTab)
- oldTab.setSelected(false);
-
- var newTab = this.findTabById(id);
- newTab.setSelected(true);
- if (params)
- newTab.contentView.setParameters(params);
-
- // Update data needed by newly active tab, as it may be
- // significantly out of date.
- if (typeof g_browser != 'undefined' && g_browser.checkForUpdatedInfo)
- g_browser.checkForUpdatedInfo();
-};
-
-TabSwitcherView.prototype.getAllTabIds = function() {
- var ids = [];
- for (var i = 0; i < this.tabs_.length; ++i)
- ids.push(this.tabs_[i].id);
- return ids;
-};
-
-// Shows/hides the DOM node that is used to select the tab. Will not change
-// the active tab.
-TabSwitcherView.prototype.showTabHandleNode = function(id, isVisible) {
- var tab = this.findTabById(id);
- setNodeDisplay(tab.getTabHandleNode(), isVisible);
-};
-
-//-----------------------------------------------------------------------------
-
-/**
- * @constructor
- */
-function TabEntry(id, contentView) {
- this.id = id;
- this.contentView = contentView;
-}
-
-TabEntry.prototype.setSelected = function(isSelected) {
- this.active = isSelected;
- changeClassName(this.getTabHandleNode(), 'selected', isSelected);
- this.contentView.show(isSelected);
-};
-
-/**
- * Returns the DOM node that is used to select the tab.
- */
-TabEntry.prototype.getTabHandleNode = function() {
- return $(this.id);
-};
-
« no previous file with comments | « chrome/browser/resources/net_internals/tabswitcherview.css ('k') | chrome/browser/resources/net_internals/test-view.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698