| 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 #include "ui/views/controls/tabbed_pane/native_tabbed_pane_views.h" | 5 #include "ui/views/controls/tabbed_pane/native_tabbed_pane_views.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
| 10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 | 293 |
| 294 void NativeTabbedPaneViews::AddTab(const string16& title, View* contents) { | 294 void NativeTabbedPaneViews::AddTab(const string16& title, View* contents) { |
| 295 AddTabAtIndex(tab_strip_->child_count(), title, contents, true); | 295 AddTabAtIndex(tab_strip_->child_count(), title, contents, true); |
| 296 } | 296 } |
| 297 | 297 |
| 298 void NativeTabbedPaneViews::AddTabAtIndex(int index, | 298 void NativeTabbedPaneViews::AddTabAtIndex(int index, |
| 299 const string16& title, | 299 const string16& title, |
| 300 View* contents, | 300 View* contents, |
| 301 bool select_if_first_tab) { | 301 bool select_if_first_tab) { |
| 302 DCHECK(index <= static_cast<int>(tab_strip_->child_count())); | 302 DCHECK(index <= static_cast<int>(tab_strip_->child_count())); |
| 303 contents->set_parent_owned(false); | 303 contents->set_owned_by_client(); |
| 304 contents->SetVisible(false); | 304 contents->SetVisible(false); |
| 305 | 305 |
| 306 tab_strip_->AddChildViewAt(new Tab(tab_strip_, title, contents), index); | 306 tab_strip_->AddChildViewAt(new Tab(tab_strip_, title, contents), index); |
| 307 | 307 |
| 308 // Add native tab only if the native control is already created. | 308 // Add native tab only if the native control is already created. |
| 309 content_view_->AddChildViewAt(contents, index); | 309 content_view_->AddChildViewAt(contents, index); |
| 310 | 310 |
| 311 // Switch to the newly added tab if requested; | 311 // Switch to the newly added tab if requested; |
| 312 if (tab_strip_->child_count() == 1 && select_if_first_tab) | 312 if (tab_strip_->child_count() == 1 && select_if_first_tab) |
| 313 tab_layout_manager_->SwitchToPage(content_view_, contents); | 313 tab_layout_manager_->SwitchToPage(content_view_, contents); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 //////////////////////////////////////////////////////////////////////////////// | 400 //////////////////////////////////////////////////////////////////////////////// |
| 401 // NativeTabbedPaneWrapper, public: | 401 // NativeTabbedPaneWrapper, public: |
| 402 | 402 |
| 403 // static | 403 // static |
| 404 NativeTabbedPaneWrapper* NativeTabbedPaneWrapper::CreateNativeWrapper( | 404 NativeTabbedPaneWrapper* NativeTabbedPaneWrapper::CreateNativeWrapper( |
| 405 TabbedPane* tabbed_pane) { | 405 TabbedPane* tabbed_pane) { |
| 406 return new NativeTabbedPaneViews(tabbed_pane); | 406 return new NativeTabbedPaneViews(tabbed_pane); |
| 407 } | 407 } |
| 408 | 408 |
| 409 } // namespace views | 409 } // namespace views |
| OLD | NEW |