| OLD | NEW | 
|    1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |    1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ |    5 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ | 
|    6 #define CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ |    6 #define CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ | 
|    7  |    7  | 
|    8 #include "base/compiler_specific.h" |    8 #include "base/compiler_specific.h" | 
|    9 #include "base/memory/scoped_ptr.h" |    9 #include "base/memory/scoped_ptr.h" | 
|   10 #include "base/prefs/public/pref_change_registrar.h" |   10 #include "base/prefs/public/pref_change_registrar.h" | 
|   11 #include "base/prefs/public/pref_observer.h" |  | 
|   12 #include "chrome/browser/ui/tabs/hover_tab_selector.h" |   11 #include "chrome/browser/ui/tabs/hover_tab_selector.h" | 
|   13 #include "chrome/browser/ui/tabs/tab_strip_model.h" |   12 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 
|   14 #include "chrome/browser/ui/views/tabs/tab_strip_controller.h" |   13 #include "chrome/browser/ui/views/tabs/tab_strip_controller.h" | 
|   15  |   14  | 
|   16 class Browser; |   15 class Browser; | 
|   17 class Tab; |   16 class Tab; | 
|   18 class TabContents; |   17 class TabContents; | 
|   19 class TabStrip; |   18 class TabStrip; | 
|   20 class TabStripSelectionModel; |   19 class TabStripSelectionModel; | 
|   21 struct TabRendererData; |   20 struct TabRendererData; | 
|   22  |   21  | 
|   23 namespace content { |   22 namespace content { | 
|   24 class WebContents; |   23 class WebContents; | 
|   25 } |   24 } | 
|   26  |   25  | 
|   27 // An implementation of TabStripController that sources data from the |   26 // An implementation of TabStripController that sources data from the | 
|   28 // TabContentses in a TabStripModel. |   27 // TabContentses in a TabStripModel. | 
|   29 class BrowserTabStripController : public TabStripController, |   28 class BrowserTabStripController : public TabStripController, | 
|   30                                   public TabStripModelObserver, |   29                                   public TabStripModelObserver { | 
|   31                                   public PrefObserver { |  | 
|   32  public: |   30  public: | 
|   33   BrowserTabStripController(Browser* browser, TabStripModel* model); |   31   BrowserTabStripController(Browser* browser, TabStripModel* model); | 
|   34   virtual ~BrowserTabStripController(); |   32   virtual ~BrowserTabStripController(); | 
|   35  |   33  | 
|   36   void InitFromModel(TabStrip* tabstrip); |   34   void InitFromModel(TabStrip* tabstrip); | 
|   37  |   35  | 
|   38   TabStripModel* model() const { return model_; } |   36   TabStripModel* model() const { return model_; } | 
|   39  |   37  | 
|   40   bool IsCommandEnabledForTab(TabStripModel::ContextMenuCommand command_id, |   38   bool IsCommandEnabledForTab(TabStripModel::ContextMenuCommand command_id, | 
|   41                               Tab* tab) const; |   39                               Tab* tab) const; | 
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   89                              content::WebContents* old_contents, |   87                              content::WebContents* old_contents, | 
|   90                              content::WebContents* new_contents, |   88                              content::WebContents* new_contents, | 
|   91                              int model_index) OVERRIDE; |   89                              int model_index) OVERRIDE; | 
|   92   virtual void TabPinnedStateChanged(content::WebContents* contents, |   90   virtual void TabPinnedStateChanged(content::WebContents* contents, | 
|   93                                      int model_index) OVERRIDE; |   91                                      int model_index) OVERRIDE; | 
|   94   virtual void TabMiniStateChanged(content::WebContents* contents, |   92   virtual void TabMiniStateChanged(content::WebContents* contents, | 
|   95                                    int model_index) OVERRIDE; |   93                                    int model_index) OVERRIDE; | 
|   96   virtual void TabBlockedStateChanged(content::WebContents* contents, |   94   virtual void TabBlockedStateChanged(content::WebContents* contents, | 
|   97                                       int model_index) OVERRIDE; |   95                                       int model_index) OVERRIDE; | 
|   98  |   96  | 
|   99   // PrefObserver implementation: |  | 
|  100   virtual void OnPreferenceChanged(PrefServiceBase* service, |  | 
|  101                                    const std::string& pref_name) OVERRIDE; |  | 
|  102  |  | 
|  103  protected: |   97  protected: | 
|  104   // The context in which SetTabRendererDataFromModel is being called. |   98   // The context in which SetTabRendererDataFromModel is being called. | 
|  105   enum TabStatus { |   99   enum TabStatus { | 
|  106     NEW_TAB, |  100     NEW_TAB, | 
|  107     EXISTING_TAB |  101     EXISTING_TAB | 
|  108   }; |  102   }; | 
|  109  |  103  | 
|  110   // Sets the TabRendererData from the TabStripModel. |  104   // Sets the TabRendererData from the TabStripModel. | 
|  111   virtual void SetTabRendererDataFromModel(content::WebContents* contents, |  105   virtual void SetTabRendererDataFromModel(content::WebContents* contents, | 
|  112                                            int model_index, |  106                                            int model_index, | 
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  150  |  144  | 
|  151   // Helper for performing tab selection as a result of dragging over a tab. |  145   // Helper for performing tab selection as a result of dragging over a tab. | 
|  152   HoverTabSelector hover_tab_selector_; |  146   HoverTabSelector hover_tab_selector_; | 
|  153  |  147  | 
|  154   PrefChangeRegistrar local_pref_registrar_; |  148   PrefChangeRegistrar local_pref_registrar_; | 
|  155  |  149  | 
|  156   DISALLOW_COPY_AND_ASSIGN(BrowserTabStripController); |  150   DISALLOW_COPY_AND_ASSIGN(BrowserTabStripController); | 
|  157 }; |  151 }; | 
|  158  |  152  | 
|  159 #endif  // CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ |  153 #endif  // CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ | 
| OLD | NEW |