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" | 11 #include "apps/ui/web_contents_sizer.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
14 #include "chrome/app/chrome_command_ids.h" | 14 #include "chrome/app/chrome_command_ids.h" |
15 #include "chrome/browser/browser_shutdown.h" | 15 #include "chrome/browser/browser_shutdown.h" |
16 #include "chrome/browser/defaults.h" | 16 #include "chrome/browser/defaults.h" |
17 #include "chrome/browser/extensions/tab_helper.h" | 17 #include "chrome/browser/extensions/tab_helper.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 19 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
20 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h" | 20 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h" |
21 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" | 21 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" |
22 #include "chrome/browser/ui/tabs/tab_strip_model_order_controller.h" | 22 #include "chrome/browser/ui/tabs/tab_strip_model_order_controller.h" |
23 #include "chrome/common/url_constants.h" | 23 #include "chrome/common/url_constants.h" |
24 #include "components/web_modal/web_contents_modal_dialog_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 { |
33 | 33 |
34 // Returns true if the specified transition is one of the types that cause the | 34 // Returns true if the specified transition is one of the types that cause the |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
308 data->set_opener(active_contents); | 308 data->set_opener(active_contents); |
309 } else if ((add_types & ADD_INHERIT_OPENER) && active_contents) { | 309 } else if ((add_types & ADD_INHERIT_OPENER) && active_contents) { |
310 if (active) { | 310 if (active) { |
311 // Forget any existing relationships, we don't want to make things too | 311 // Forget any existing relationships, we don't want to make things too |
312 // confusing by having multiple groups active at the same time. | 312 // confusing by having multiple groups active at the same time. |
313 ForgetAllOpeners(); | 313 ForgetAllOpeners(); |
314 } | 314 } |
315 data->set_opener(active_contents); | 315 data->set_opener(active_contents); |
316 } | 316 } |
317 | 317 |
318 web_modal::WebContentsModalDialogManager* modal_dialog_manager = | 318 // TODO(gbillock): This can be made more appropriate by asking the bubble |
319 web_modal::WebContentsModalDialogManager::FromWebContents(contents); | 319 // manager whether the WebContents should be blocked, or perhaps just by |
320 if (modal_dialog_manager) | 320 // letting the bubble manager make the blocking call directly and don't use |
321 data->set_blocked(modal_dialog_manager->IsDialogActive()); | 321 // this at all. |
322 web_modal::PopupManager* popup_manager = | |
323 web_modal::PopupManager::FromWebContents(contents); | |
324 if (popup_manager) { | |
325 data->set_blocked( | |
326 popup_manager->IsWebModalDialogActive(contents)); | |
Finnur
2014/06/30 13:53:36
Fits on one line?
Greg Billock
2014/07/01 00:53:04
Done.
| |
327 } | |
322 | 328 |
323 contents_data_.insert(contents_data_.begin() + index, data); | 329 contents_data_.insert(contents_data_.begin() + index, data); |
324 | 330 |
325 selection_model_.IncrementFrom(index); | 331 selection_model_.IncrementFrom(index); |
326 | 332 |
327 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, | 333 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, |
328 TabInsertedAt(contents, index, active)); | 334 TabInsertedAt(contents, index, active)); |
329 if (active) { | 335 if (active) { |
330 ui::ListSelectionModel new_model; | 336 ui::ListSelectionModel new_model; |
331 new_model.Copy(selection_model_); | 337 new_model.Copy(selection_model_); |
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1406 void TabStripModel::ForgetOpenersAndGroupsReferencing( | 1412 void TabStripModel::ForgetOpenersAndGroupsReferencing( |
1407 const WebContents* tab) { | 1413 const WebContents* tab) { |
1408 for (WebContentsDataVector::const_iterator i = contents_data_.begin(); | 1414 for (WebContentsDataVector::const_iterator i = contents_data_.begin(); |
1409 i != contents_data_.end(); ++i) { | 1415 i != contents_data_.end(); ++i) { |
1410 if ((*i)->group() == tab) | 1416 if ((*i)->group() == tab) |
1411 (*i)->set_group(NULL); | 1417 (*i)->set_group(NULL); |
1412 if ((*i)->opener() == tab) | 1418 if ((*i)->opener() == tab) |
1413 (*i)->set_opener(NULL); | 1419 (*i)->set_opener(NULL); |
1414 } | 1420 } |
1415 } | 1421 } |
OLD | NEW |