| 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 "chrome/browser/ui/tabs/tab_strip_model.h" | 5 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "apps/ui/web_contents_sizer.h" | |
| 12 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 13 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 14 #include "chrome/app/chrome_command_ids.h" | 13 #include "chrome/app/chrome_command_ids.h" |
| 15 #include "chrome/browser/browser_shutdown.h" | 14 #include "chrome/browser/browser_shutdown.h" |
| 16 #include "chrome/browser/defaults.h" | 15 #include "chrome/browser/defaults.h" |
| 17 #include "chrome/browser/extensions/tab_helper.h" | 16 #include "chrome/browser/extensions/tab_helper.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 18 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
| 20 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h" | 19 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h" |
| 21 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" | 20 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" |
| 22 #include "chrome/browser/ui/tabs/tab_strip_model_order_controller.h" | 21 #include "chrome/browser/ui/tabs/tab_strip_model_order_controller.h" |
| 22 #include "chrome/browser/ui/web_contents_sizer.h" |
| 23 #include "chrome/common/url_constants.h" | 23 #include "chrome/common/url_constants.h" |
| 24 #include "components/web_modal/popup_manager.h" | 24 #include "components/web_modal/popup_manager.h" |
| 25 #include "content/public/browser/render_process_host.h" | 25 #include "content/public/browser/render_process_host.h" |
| 26 #include "content/public/browser/user_metrics.h" | 26 #include "content/public/browser/user_metrics.h" |
| 27 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
| 28 #include "content/public/browser/web_contents_observer.h" | 28 #include "content/public/browser/web_contents_observer.h" |
| 29 using base::UserMetricsAction; | 29 using base::UserMetricsAction; |
| 30 using content::WebContents; | 30 using content::WebContents; |
| 31 | 31 |
| 32 namespace { | 32 namespace { |
| (...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 // Ensure that the new WebContentsView begins at the same size as the | 832 // Ensure that the new WebContentsView begins at the same size as the |
| 833 // previous WebContentsView if it existed. Otherwise, the initial WebKit | 833 // previous WebContentsView if it existed. Otherwise, the initial WebKit |
| 834 // layout will be performed based on a width of 0 pixels, causing a | 834 // layout will be performed based on a width of 0 pixels, causing a |
| 835 // very long, narrow, inaccurate layout. Because some scripts on pages (as | 835 // very long, narrow, inaccurate layout. Because some scripts on pages (as |
| 836 // well as WebKit's anchor link location calculation) are run on the | 836 // well as WebKit's anchor link location calculation) are run on the |
| 837 // initial layout and not recalculated later, we need to ensure the first | 837 // initial layout and not recalculated later, we need to ensure the first |
| 838 // layout is performed with sane view dimensions even when we're opening a | 838 // layout is performed with sane view dimensions even when we're opening a |
| 839 // new background tab. | 839 // new background tab. |
| 840 if (WebContents* old_contents = GetActiveWebContents()) { | 840 if (WebContents* old_contents = GetActiveWebContents()) { |
| 841 if ((add_types & ADD_ACTIVE) == 0) { | 841 if ((add_types & ADD_ACTIVE) == 0) { |
| 842 apps::ResizeWebContents(contents, | 842 chrome::ResizeWebContents(contents, |
| 843 old_contents->GetContainerBounds().size()); | 843 old_contents->GetContainerBounds().size()); |
| 844 } | 844 } |
| 845 } | 845 } |
| 846 } | 846 } |
| 847 | 847 |
| 848 void TabStripModel::CloseSelectedTabs() { | 848 void TabStripModel::CloseSelectedTabs() { |
| 849 InternalCloseTabs(selection_model_.selected_indices(), | 849 InternalCloseTabs(selection_model_.selected_indices(), |
| 850 CLOSE_CREATE_HISTORICAL_TAB | CLOSE_USER_GESTURE); | 850 CLOSE_CREATE_HISTORICAL_TAB | CLOSE_USER_GESTURE); |
| 851 } | 851 } |
| 852 | 852 |
| 853 void TabStripModel::SelectNextTab() { | 853 void TabStripModel::SelectNextTab() { |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1409 void TabStripModel::ForgetOpenersAndGroupsReferencing( | 1409 void TabStripModel::ForgetOpenersAndGroupsReferencing( |
| 1410 const WebContents* tab) { | 1410 const WebContents* tab) { |
| 1411 for (WebContentsDataVector::const_iterator i = contents_data_.begin(); | 1411 for (WebContentsDataVector::const_iterator i = contents_data_.begin(); |
| 1412 i != contents_data_.end(); ++i) { | 1412 i != contents_data_.end(); ++i) { |
| 1413 if ((*i)->group() == tab) | 1413 if ((*i)->group() == tab) |
| 1414 (*i)->set_group(NULL); | 1414 (*i)->set_group(NULL); |
| 1415 if ((*i)->opener() == tab) | 1415 if ((*i)->opener() == tab) |
| 1416 (*i)->set_opener(NULL); | 1416 (*i)->set_opener(NULL); |
| 1417 } | 1417 } |
| 1418 } | 1418 } |
| OLD | NEW |