| 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/extensions/extension_tab_util.h" | 5 #include "chrome/browser/extensions/extension_tab_util.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/extension_tabs_module_constants.h" | 7 #include "chrome/browser/extensions/extension_tabs_module_constants.h" |
| 8 #include "chrome/browser/net/url_fixer_upper.h" | 8 #include "chrome/browser/net/url_fixer_upper.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/sessions/restore_tab_helper.h" | 10 #include "chrome/browser/sessions/restore_tab_helper.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 bool ExtensionTabUtil::GetTabStripModel(const WebContents* web_contents, | 135 bool ExtensionTabUtil::GetTabStripModel(const WebContents* web_contents, |
| 136 TabStripModel** tab_strip_model, | 136 TabStripModel** tab_strip_model, |
| 137 int* tab_index) { | 137 int* tab_index) { |
| 138 DCHECK(web_contents); | 138 DCHECK(web_contents); |
| 139 DCHECK(tab_strip_model); | 139 DCHECK(tab_strip_model); |
| 140 DCHECK(tab_index); | 140 DCHECK(tab_index); |
| 141 | 141 |
| 142 for (BrowserList::const_iterator it = BrowserList::begin(); | 142 for (BrowserList::const_iterator it = BrowserList::begin(); |
| 143 it != BrowserList::end(); ++it) { | 143 it != BrowserList::end(); ++it) { |
| 144 TabStripModel* tab_strip = (*it)->tab_strip_model(); | 144 TabStripModel* tab_strip = (*it)->tab_strip_model(); |
| 145 int index = tab_strip->GetWrapperIndex(web_contents); | 145 int index = tab_strip->GetIndexOfWebContents(web_contents); |
| 146 if (index != -1) { | 146 if (index != -1) { |
| 147 *tab_strip_model = tab_strip; | 147 *tab_strip_model = tab_strip; |
| 148 *tab_index = index; | 148 *tab_index = index; |
| 149 return true; | 149 return true; |
| 150 } | 150 } |
| 151 } | 151 } |
| 152 | 152 |
| 153 return false; | 153 return false; |
| 154 } | 154 } |
| 155 | 155 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 } | 216 } |
| 217 | 217 |
| 218 bool ExtensionTabUtil::IsCrashURL(const GURL& url) { | 218 bool ExtensionTabUtil::IsCrashURL(const GURL& url) { |
| 219 // Check a fixed-up URL, to normalize the scheme and parse hosts correctly. | 219 // Check a fixed-up URL, to normalize the scheme and parse hosts correctly. |
| 220 GURL fixed_url = | 220 GURL fixed_url = |
| 221 URLFixerUpper::FixupURL(url.possibly_invalid_spec(), std::string()); | 221 URLFixerUpper::FixupURL(url.possibly_invalid_spec(), std::string()); |
| 222 return (fixed_url.SchemeIs(chrome::kChromeUIScheme) && | 222 return (fixed_url.SchemeIs(chrome::kChromeUIScheme) && |
| 223 (fixed_url.host() == chrome::kChromeUIBrowserCrashHost || | 223 (fixed_url.host() == chrome::kChromeUIBrowserCrashHost || |
| 224 fixed_url.host() == chrome::kChromeUICrashHost)); | 224 fixed_url.host() == chrome::kChromeUICrashHost)); |
| 225 } | 225 } |
| OLD | NEW |