Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Side by Side Diff: chrome/browser/ui/tabs/tab_strip_model.cc

Issue 287123002: [WebModals] New API for browser-scoped popup management. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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): Ask the bubble manager whether the WebContents should be
319 web_modal::WebContentsModalDialogManager::FromWebContents(contents); 319 // blocked, or just let the bubble manager make the blocking call directly
320 if (modal_dialog_manager) 320 // and not use this at all.
321 data->set_blocked(modal_dialog_manager->IsDialogActive()); 321 web_modal::PopupManager* popup_manager =
322 web_modal::PopupManager::FromWebContents(contents);
323 if (popup_manager)
324 data->set_blocked(popup_manager->IsWebModalDialogActive(contents));
322 325
323 contents_data_.insert(contents_data_.begin() + index, data); 326 contents_data_.insert(contents_data_.begin() + index, data);
324 327
325 selection_model_.IncrementFrom(index); 328 selection_model_.IncrementFrom(index);
326 329
327 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, 330 FOR_EACH_OBSERVER(TabStripModelObserver, observers_,
328 TabInsertedAt(contents, index, active)); 331 TabInsertedAt(contents, index, active));
329 if (active) { 332 if (active) {
330 ui::ListSelectionModel new_model; 333 ui::ListSelectionModel new_model;
331 new_model.Copy(selection_model_); 334 new_model.Copy(selection_model_);
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after
1406 void TabStripModel::ForgetOpenersAndGroupsReferencing( 1409 void TabStripModel::ForgetOpenersAndGroupsReferencing(
1407 const WebContents* tab) { 1410 const WebContents* tab) {
1408 for (WebContentsDataVector::const_iterator i = contents_data_.begin(); 1411 for (WebContentsDataVector::const_iterator i = contents_data_.begin();
1409 i != contents_data_.end(); ++i) { 1412 i != contents_data_.end(); ++i) {
1410 if ((*i)->group() == tab) 1413 if ((*i)->group() == tab)
1411 (*i)->set_group(NULL); 1414 (*i)->set_group(NULL);
1412 if ((*i)->opener() == tab) 1415 if ((*i)->opener() == tab)
1413 (*i)->set_opener(NULL); 1416 (*i)->set_opener(NULL);
1414 } 1417 }
1415 } 1418 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698