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

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

Issue 23835007: DevTools: Do not close devtools if there are dirty files in workspace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reupload 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
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/devtools/devtools_window.h"
16 #include "chrome/browser/extensions/tab_helper.h" 17 #include "chrome/browser/extensions/tab_helper.h"
17 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" 19 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
19 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h" 20 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h"
20 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" 21 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h"
21 #include "chrome/browser/ui/tabs/tab_strip_model_order_controller.h" 22 #include "chrome/browser/ui/tabs/tab_strip_model_order_controller.h"
22 #include "chrome/common/url_constants.h" 23 #include "chrome/common/url_constants.h"
23 #include "components/web_modal/web_contents_modal_dialog_manager.h" 24 #include "components/web_modal/web_contents_modal_dialog_manager.h"
24 #include "content/public/browser/notification_service.h" 25 #include "content/public/browser/notification_service.h"
25 #include "content/public/browser/notification_types.h" 26 #include "content/public/browser/notification_types.h"
(...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 1090
1090 // We only try the fast shutdown path if the whole browser process is *not* 1091 // We only try the fast shutdown path if the whole browser process is *not*
1091 // shutting down. Fast shutdown during browser termination is handled in 1092 // shutting down. Fast shutdown during browser termination is handled in
1092 // BrowserShutdown. 1093 // BrowserShutdown.
1093 if (browser_shutdown::GetShutdownType() == browser_shutdown::NOT_VALID) { 1094 if (browser_shutdown::GetShutdownType() == browser_shutdown::NOT_VALID) {
1094 // Construct a map of processes to the number of associated tabs that are 1095 // Construct a map of processes to the number of associated tabs that are
1095 // closing. 1096 // closing.
1096 std::map<content::RenderProcessHost*, size_t> processes; 1097 std::map<content::RenderProcessHost*, size_t> processes;
1097 for (size_t i = 0; i < indices.size(); ++i) { 1098 for (size_t i = 0; i < indices.size(); ++i) {
1098 WebContents* closing_contents = GetWebContentsAtImpl(indices[i]); 1099 WebContents* closing_contents = GetWebContentsAtImpl(indices[i]);
1100 if (DevToolsWindow::GetInstanceForInspectedTab(closing_contents))
1101 continue;
1099 content::RenderProcessHost* process = 1102 content::RenderProcessHost* process =
1100 closing_contents->GetRenderProcessHost(); 1103 closing_contents->GetRenderProcessHost();
1101 ++processes[process]; 1104 ++processes[process];
1102 } 1105 }
1103 1106
1104 // Try to fast shutdown the tabs that can close. 1107 // Try to fast shutdown the tabs that can close.
1105 for (std::map<content::RenderProcessHost*, size_t>::iterator iter = 1108 for (std::map<content::RenderProcessHost*, size_t>::iterator iter =
1106 processes.begin(); iter != processes.end(); ++iter) { 1109 processes.begin(); iter != processes.end(); ++iter) {
1107 iter->first->FastShutdownForPageCount(iter->second); 1110 iter->first->FastShutdownForPageCount(iter->second);
1108 } 1111 }
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 void TabStripModel::ForgetOpenersAndGroupsReferencing( 1290 void TabStripModel::ForgetOpenersAndGroupsReferencing(
1288 const WebContents* tab) { 1291 const WebContents* tab) {
1289 for (WebContentsDataVector::const_iterator i = contents_data_.begin(); 1292 for (WebContentsDataVector::const_iterator i = contents_data_.begin();
1290 i != contents_data_.end(); ++i) { 1293 i != contents_data_.end(); ++i) {
1291 if ((*i)->group == tab) 1294 if ((*i)->group == tab)
1292 (*i)->group = NULL; 1295 (*i)->group = NULL;
1293 if ((*i)->opener == tab) 1296 if ((*i)->opener == tab)
1294 (*i)->opener = NULL; 1297 (*i)->opener = NULL;
1295 } 1298 }
1296 } 1299 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698