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