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/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/tabs/tab_strip_model.h" | 9 #include "chrome/browser/tabs/tab_strip_model.h" |
10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
(...skipping 205 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 } |
| 226 |
| 227 bool ExtensionTabUtil::ReadOneOrMoreIntegers(base::Value* value, |
| 228 std::vector<int>* result) { |
| 229 if (value->IsType(Value::TYPE_INTEGER)) { |
| 230 int tab_id = -1; |
| 231 if (!value->GetAsInteger(&tab_id)) |
| 232 return false; |
| 233 result->push_back(tab_id); |
| 234 return true; |
| 235 |
| 236 } else if (value->IsType(Value::TYPE_LIST)) { |
| 237 ListValue* tabs = static_cast<ListValue*>(value); |
| 238 for (size_t i = 0; i < tabs->GetSize(); ++i) { |
| 239 int tab_id = -1; |
| 240 if (!tabs->GetInteger(i, &tab_id)) |
| 241 return false; |
| 242 result->push_back(tab_id); |
| 243 } |
| 244 return true; |
| 245 } |
| 246 return false; |
| 247 } |
OLD | NEW |