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

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

Issue 23311008: Tab Strip: Initialize the blocked state for a tab. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix test for win aura Created 7 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/ui/tabs/tab_strip_model_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/stl_util.h" 12 #include "base/stl_util.h"
13 #include "chrome/app/chrome_command_ids.h" 13 #include "chrome/app/chrome_command_ids.h"
14 #include "chrome/browser/browser_shutdown.h" 14 #include "chrome/browser/browser_shutdown.h"
15 #include "chrome/browser/defaults.h" 15 #include "chrome/browser/defaults.h"
16 #include "chrome/browser/extensions/tab_helper.h" 16 #include "chrome/browser/extensions/tab_helper.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" 18 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
19 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h" 19 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h"
20 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" 20 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h"
21 #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/common/url_constants.h" 22 #include "chrome/common/url_constants.h"
23 #include "components/web_modal/web_contents_modal_dialog_manager.h"
23 #include "content/public/browser/notification_service.h" 24 #include "content/public/browser/notification_service.h"
24 #include "content/public/browser/notification_types.h" 25 #include "content/public/browser/notification_types.h"
25 #include "content/public/browser/render_process_host.h" 26 #include "content/public/browser/render_process_host.h"
26 #include "content/public/browser/user_metrics.h" 27 #include "content/public/browser/user_metrics.h"
27 #include "content/public/browser/web_contents.h" 28 #include "content/public/browser/web_contents.h"
28 #include "content/public/browser/web_contents_view.h" 29 #include "content/public/browser/web_contents_view.h"
29 30
30 using content::UserMetricsAction; 31 using content::UserMetricsAction;
31 using content::WebContents; 32 using content::WebContents;
32 33
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 data->SetGroup(active_contents); 182 data->SetGroup(active_contents);
182 } else if ((add_types & ADD_INHERIT_OPENER) && active_contents) { 183 } else if ((add_types & ADD_INHERIT_OPENER) && active_contents) {
183 if (active) { 184 if (active) {
184 // Forget any existing relationships, we don't want to make things too 185 // Forget any existing relationships, we don't want to make things too
185 // confusing by having multiple groups active at the same time. 186 // confusing by having multiple groups active at the same time.
186 ForgetAllOpeners(); 187 ForgetAllOpeners();
187 } 188 }
188 data->opener = active_contents; 189 data->opener = active_contents;
189 } 190 }
190 191
192 web_modal::WebContentsModalDialogManager* modal_dialog_manager =
193 web_modal::WebContentsModalDialogManager::FromWebContents(contents);
194 if (modal_dialog_manager)
195 data->blocked = modal_dialog_manager->IsShowingDialog();
196
191 contents_data_.insert(contents_data_.begin() + index, data); 197 contents_data_.insert(contents_data_.begin() + index, data);
192 198
193 selection_model_.IncrementFrom(index); 199 selection_model_.IncrementFrom(index);
194 200
195 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, 201 FOR_EACH_OBSERVER(TabStripModelObserver, observers_,
196 TabInsertedAt(contents, index, active)); 202 TabInsertedAt(contents, index, active));
197 if (active) { 203 if (active) {
198 ui::ListSelectionModel new_model; 204 ui::ListSelectionModel new_model;
199 new_model.Copy(selection_model_); 205 new_model.Copy(selection_model_);
200 new_model.SetSelectedIndex(index); 206 new_model.SetSelectedIndex(index);
(...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 void TabStripModel::ForgetOpenersAndGroupsReferencing( 1287 void TabStripModel::ForgetOpenersAndGroupsReferencing(
1282 const WebContents* tab) { 1288 const WebContents* tab) {
1283 for (WebContentsDataVector::const_iterator i = contents_data_.begin(); 1289 for (WebContentsDataVector::const_iterator i = contents_data_.begin();
1284 i != contents_data_.end(); ++i) { 1290 i != contents_data_.end(); ++i) {
1285 if ((*i)->group == tab) 1291 if ((*i)->group == tab)
1286 (*i)->group = NULL; 1292 (*i)->group = NULL;
1287 if ((*i)->opener == tab) 1293 if ((*i)->opener == tab)
1288 (*i)->opener = NULL; 1294 (*i)->opener = NULL;
1289 } 1295 }
1290 } 1296 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/tabs/tab_strip_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698