Home | History | Annotate | Download | only in tabs
      1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #include "chrome/browser/ui/views/tabs/tab_strip_factory.h"
      6 
      7 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h"
      8 #include "chrome/browser/ui/views/tabs/side_tab_strip.h"
      9 #include "chrome/browser/ui/views/tabs/tab_strip.h"
     10 
     11 // This default implementation of CreateTabStrip creates a TabStrip or a
     12 // SideTabStrip, depending on whether we are using vertical tabs.
     13 AbstractTabStripView* CreateTabStrip(Browser* browser,
     14                                      views::View* parent,
     15                                      TabStripModel* model,
     16                                      bool use_vertical_tabs) {
     17   BrowserTabStripController* tabstrip_controller =
     18       new BrowserTabStripController(browser, model);
     19   // Ownership of this controller is given to a specific tabstrip when we
     20   // construct it below.
     21 
     22   BaseTabStrip* tabstrip = NULL;
     23 
     24   if (use_vertical_tabs)
     25     tabstrip = new SideTabStrip(tabstrip_controller);
     26   else
     27     tabstrip = new TabStrip(tabstrip_controller);
     28   parent->AddChildView(tabstrip);
     29   tabstrip_controller->InitFromModel(tabstrip);
     30   return tabstrip;
     31 }
     32 
     33