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" |
11 #include "chrome/browser/extensions/chrome_extension_function_details.h" | 11 #include "chrome/browser/extensions/chrome_extension_function_details.h" |
12 #include "chrome/browser/extensions/tab_helper.h" | 12 #include "chrome/browser/extensions/tab_helper.h" |
13 #include "chrome/browser/extensions/window_controller.h" | 13 #include "chrome/browser/extensions/window_controller.h" |
14 #include "chrome/browser/extensions/window_controller_list.h" | 14 #include "chrome/browser/extensions/window_controller_list.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/sessions/session_tab_helper.h" | 16 #include "chrome/browser/sessions/session_tab_helper.h" |
17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
18 #include "chrome/browser/ui/browser_finder.h" | 18 #include "chrome/browser/ui/browser_finder.h" |
19 #include "chrome/browser/ui/browser_iterator.h" | 19 #include "chrome/browser/ui/browser_iterator.h" |
20 #include "chrome/browser/ui/browser_window.h" | 20 #include "chrome/browser/ui/browser_window.h" |
21 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 21 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
22 #include "chrome/browser/ui/singleton_tabs.h" | 22 #include "chrome/browser/ui/singleton_tabs.h" |
23 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" | 23 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" |
24 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 24 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
25 #include "chrome/browser/ui/tabs/tab_utils.h" | 25 #include "chrome/browser/ui/tabs/tab_utils.h" |
26 #include "chrome/common/extensions/api/tabs.h" | 26 #include "chrome/common/extensions/api/tabs.h" |
27 #include "chrome/common/url_constants.h" | 27 #include "chrome/common/url_constants.h" |
28 #include "components/url_formatter/url_fixer.h" | 28 #include "components/url_fixer/url_fixer.h" |
29 #include "content/public/browser/favicon_status.h" | 29 #include "content/public/browser/favicon_status.h" |
30 #include "content/public/browser/navigation_entry.h" | 30 #include "content/public/browser/navigation_entry.h" |
31 #include "content/public/browser/web_contents.h" | 31 #include "content/public/browser/web_contents.h" |
32 #include "extensions/browser/app_window/app_window.h" | 32 #include "extensions/browser/app_window/app_window.h" |
33 #include "extensions/browser/app_window/app_window_registry.h" | 33 #include "extensions/browser/app_window/app_window_registry.h" |
34 #include "extensions/common/constants.h" | 34 #include "extensions/common/constants.h" |
35 #include "extensions/common/error_utils.h" | 35 #include "extensions/common/error_utils.h" |
36 #include "extensions/common/extension.h" | 36 #include "extensions/common/extension.h" |
37 #include "extensions/common/feature_switch.h" | 37 #include "extensions/common/feature_switch.h" |
38 #include "extensions/common/manifest_constants.h" | 38 #include "extensions/common/manifest_constants.h" |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 chrome::kChromeUICrashHost, | 543 chrome::kChromeUICrashHost, |
544 chrome::kChromeUIHangUIHost, | 544 chrome::kChromeUIHangUIHost, |
545 chrome::kChromeUIKillHost, | 545 chrome::kChromeUIKillHost, |
546 chrome::kChromeUIQuitHost, | 546 chrome::kChromeUIQuitHost, |
547 chrome::kChromeUIRestartHost, | 547 chrome::kChromeUIRestartHost, |
548 content::kChromeUIBrowserCrashHost, | 548 content::kChromeUIBrowserCrashHost, |
549 }; | 549 }; |
550 | 550 |
551 // Check a fixed-up URL, to normalize the scheme and parse hosts correctly. | 551 // Check a fixed-up URL, to normalize the scheme and parse hosts correctly. |
552 GURL fixed_url = | 552 GURL fixed_url = |
553 url_formatter::FixupURL(url.possibly_invalid_spec(), std::string()); | 553 url_fixer::FixupURL(url.possibly_invalid_spec(), std::string()); |
554 if (!fixed_url.SchemeIs(content::kChromeUIScheme)) | 554 if (!fixed_url.SchemeIs(content::kChromeUIScheme)) |
555 return false; | 555 return false; |
556 | 556 |
557 for (size_t i = 0; i < arraysize(kill_hosts); ++i) { | 557 for (size_t i = 0; i < arraysize(kill_hosts); ++i) { |
558 if (fixed_url.host() == kill_hosts[i]) | 558 if (fixed_url.host() == kill_hosts[i]) |
559 return true; | 559 return true; |
560 } | 560 } |
561 | 561 |
562 return false; | 562 return false; |
563 } | 563 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 chrome::ShowSingletonTabOverwritingNTP(browser, params); | 649 chrome::ShowSingletonTabOverwritingNTP(browser, params); |
650 return true; | 650 return true; |
651 } | 651 } |
652 | 652 |
653 // static | 653 // static |
654 bool ExtensionTabUtil::BrowserSupportsTabs(Browser* browser) { | 654 bool ExtensionTabUtil::BrowserSupportsTabs(Browser* browser) { |
655 return browser && browser->tab_strip_model() && !browser->is_devtools(); | 655 return browser && browser->tab_strip_model() && !browser->is_devtools(); |
656 } | 656 } |
657 | 657 |
658 } // namespace extensions | 658 } // namespace extensions |
OLD | NEW |