| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/metrics/nacl_histogram.h" |
| 5 #include "chrome/browser/tabs/default_tab_handler.h" | 6 #include "chrome/browser/tabs/default_tab_handler.h" |
| 6 | |
| 7 #include "chrome/browser/browser.h" | 7 #include "chrome/browser/browser.h" |
| 8 #include "chrome/browser/tabs/tab_strip_model.h" | 8 #include "chrome/browser/tabs/tab_strip_model.h" |
| 9 | 9 |
| 10 //////////////////////////////////////////////////////////////////////////////// | 10 //////////////////////////////////////////////////////////////////////////////// |
| 11 // DefaultTabHandler, public: | 11 // DefaultTabHandler, public: |
| 12 | 12 |
| 13 DefaultTabHandler::DefaultTabHandler(TabHandlerDelegate* delegate) | 13 DefaultTabHandler::DefaultTabHandler(TabHandlerDelegate* delegate) |
| 14 : delegate_(delegate), | 14 : delegate_(delegate), |
| 15 ALLOW_THIS_IN_INITIALIZER_LIST( | 15 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 16 model_(new TabStripModel(this, delegate->GetProfile()))) { | 16 model_(new TabStripModel(this, delegate->GetProfile()))) { |
| 17 UmaNaclHistogramEnumeration(FIRST_TAB_NACL_BASELINE); |
| 17 model_->AddObserver(this); | 18 model_->AddObserver(this); |
| 18 } | 19 } |
| 19 | 20 |
| 20 DefaultTabHandler::~DefaultTabHandler() { | 21 DefaultTabHandler::~DefaultTabHandler() { |
| 21 // The tab strip should not have any tabs at this point. | 22 // The tab strip should not have any tabs at this point. |
| 22 DCHECK(model_->empty()); | 23 DCHECK(model_->empty()); |
| 23 model_->RemoveObserver(this); | 24 model_->RemoveObserver(this); |
| 24 } | 25 } |
| 25 | 26 |
| 26 //////////////////////////////////////////////////////////////////////////////// | 27 //////////////////////////////////////////////////////////////////////////////// |
| 27 // DefaultTabHandler, TabHandler implementation: | 28 // DefaultTabHandler, TabHandler implementation: |
| 28 | 29 |
| 29 TabStripModel* DefaultTabHandler::GetTabStripModel() const { | 30 TabStripModel* DefaultTabHandler::GetTabStripModel() const { |
| 30 return model_.get(); | 31 return model_.get(); |
| 31 } | 32 } |
| 32 | 33 |
| 33 //////////////////////////////////////////////////////////////////////////////// | 34 //////////////////////////////////////////////////////////////////////////////// |
| 34 // DefaultTabHandler, TabStripModelDelegate implementation: | 35 // DefaultTabHandler, TabStripModelDelegate implementation: |
| 35 | 36 |
| 36 TabContents* DefaultTabHandler::AddBlankTab(bool foreground) { | 37 TabContents* DefaultTabHandler::AddBlankTab(bool foreground) { |
| 38 UmaNaclHistogramEnumeration(NEW_TAB_NACL_BASELINE); |
| 37 return delegate_->AsBrowser()->AddBlankTab(foreground); | 39 return delegate_->AsBrowser()->AddBlankTab(foreground); |
| 38 } | 40 } |
| 39 | 41 |
| 40 TabContents* DefaultTabHandler::AddBlankTabAt(int index, bool foreground) { | 42 TabContents* DefaultTabHandler::AddBlankTabAt(int index, bool foreground) { |
| 41 return delegate_->AsBrowser()->AddBlankTabAt(index, foreground); | 43 return delegate_->AsBrowser()->AddBlankTabAt(index, foreground); |
| 42 } | 44 } |
| 43 | 45 |
| 44 Browser* DefaultTabHandler::CreateNewStripWithContents( | 46 Browser* DefaultTabHandler::CreateNewStripWithContents( |
| 45 TabContents* detached_contents, | 47 TabContents* detached_contents, |
| 46 const gfx::Rect& window_bounds, | 48 const gfx::Rect& window_bounds, |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 } | 193 } |
| 192 | 194 |
| 193 //////////////////////////////////////////////////////////////////////////////// | 195 //////////////////////////////////////////////////////////////////////////////// |
| 194 // TabHandler, public: | 196 // TabHandler, public: |
| 195 | 197 |
| 196 // static | 198 // static |
| 197 TabHandler* TabHandler::CreateTabHandler(TabHandlerDelegate* delegate) { | 199 TabHandler* TabHandler::CreateTabHandler(TabHandlerDelegate* delegate) { |
| 198 return new DefaultTabHandler(delegate); | 200 return new DefaultTabHandler(delegate); |
| 199 } | 201 } |
| 200 | 202 |
| OLD | NEW |