| 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 "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 9 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
| 10 #include "chrome/browser/extensions/chrome_extension_function.h" | 10 #include "chrome/browser/extensions/chrome_extension_function.h" |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 int ExtensionTabUtil::GetWindowIdOfTabStripModel( | 308 int ExtensionTabUtil::GetWindowIdOfTabStripModel( |
| 309 const TabStripModel* tab_strip_model) { | 309 const TabStripModel* tab_strip_model) { |
| 310 for (chrome::BrowserIterator it; !it.done(); it.Next()) { | 310 for (chrome::BrowserIterator it; !it.done(); it.Next()) { |
| 311 if (it->tab_strip_model() == tab_strip_model) | 311 if (it->tab_strip_model() == tab_strip_model) |
| 312 return GetWindowId(*it); | 312 return GetWindowId(*it); |
| 313 } | 313 } |
| 314 return -1; | 314 return -1; |
| 315 } | 315 } |
| 316 | 316 |
| 317 int ExtensionTabUtil::GetTabId(const WebContents* web_contents) { | 317 int ExtensionTabUtil::GetTabId(const WebContents* web_contents) { |
| 318 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); |
| 319 if (browser && browser->is_devtools()) |
| 320 return -1; |
| 318 return SessionTabHelper::IdForTab(web_contents); | 321 return SessionTabHelper::IdForTab(web_contents); |
| 319 } | 322 } |
| 320 | 323 |
| 321 std::string ExtensionTabUtil::GetTabStatusText(bool is_loading) { | 324 std::string ExtensionTabUtil::GetTabStatusText(bool is_loading) { |
| 322 return is_loading ? keys::kStatusValueLoading : keys::kStatusValueComplete; | 325 return is_loading ? keys::kStatusValueLoading : keys::kStatusValueComplete; |
| 323 } | 326 } |
| 324 | 327 |
| 325 int ExtensionTabUtil::GetWindowIdOfTab(const WebContents* web_contents) { | 328 int ExtensionTabUtil::GetWindowIdOfTab(const WebContents* web_contents) { |
| 326 return SessionTabHelper::IdForWindowContainingTab(web_contents); | 329 return SessionTabHelper::IdForWindowContainingTab(web_contents); |
| 327 } | 330 } |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 | 635 |
| 633 chrome::NavigateParams params( | 636 chrome::NavigateParams params( |
| 634 chrome::GetSingletonTabNavigateParams(browser, url_to_navigate)); | 637 chrome::GetSingletonTabNavigateParams(browser, url_to_navigate)); |
| 635 params.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; | 638 params.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; |
| 636 params.url = url_to_navigate; | 639 params.url = url_to_navigate; |
| 637 chrome::ShowSingletonTabOverwritingNTP(browser, params); | 640 chrome::ShowSingletonTabOverwritingNTP(browser, params); |
| 638 return true; | 641 return true; |
| 639 } | 642 } |
| 640 | 643 |
| 641 } // namespace extensions | 644 } // namespace extensions |
| OLD | NEW |