Chromium Code Reviews| 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 "apps/app_window.h" | 7 #include "apps/app_window.h" |
| 8 #include "apps/app_window_registry.h" | 8 #include "apps/app_window_registry.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 10 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 #include "chrome/common/extensions/api/tabs.h" | 24 #include "chrome/common/extensions/api/tabs.h" |
| 25 #include "chrome/common/extensions/manifest_url_handler.h" | 25 #include "chrome/common/extensions/manifest_url_handler.h" |
| 26 #include "chrome/common/url_constants.h" | 26 #include "chrome/common/url_constants.h" |
| 27 #include "components/url_fixer/url_fixer.h" | 27 #include "components/url_fixer/url_fixer.h" |
| 28 #include "content/public/browser/favicon_status.h" | 28 #include "content/public/browser/favicon_status.h" |
| 29 #include "content/public/browser/navigation_entry.h" | 29 #include "content/public/browser/navigation_entry.h" |
| 30 #include "content/public/browser/web_contents.h" | 30 #include "content/public/browser/web_contents.h" |
| 31 #include "extensions/common/constants.h" | 31 #include "extensions/common/constants.h" |
| 32 #include "extensions/common/error_utils.h" | 32 #include "extensions/common/error_utils.h" |
| 33 #include "extensions/common/extension.h" | 33 #include "extensions/common/extension.h" |
| 34 #include "extensions/common/feature_switch.h" | |
| 34 #include "extensions/common/manifest_constants.h" | 35 #include "extensions/common/manifest_constants.h" |
| 35 #include "extensions/common/manifest_handlers/incognito_info.h" | 36 #include "extensions/common/manifest_handlers/incognito_info.h" |
| 36 #include "extensions/common/permissions/api_permission.h" | 37 #include "extensions/common/permissions/api_permission.h" |
| 37 #include "extensions/common/permissions/permissions_data.h" | 38 #include "extensions/common/permissions/permissions_data.h" |
| 38 #include "url/gurl.h" | 39 #include "url/gurl.h" |
| 39 | 40 |
| 40 using apps::AppWindow; | 41 using apps::AppWindow; |
| 41 using content::NavigationEntry; | 42 using content::NavigationEntry; |
| 42 using content::WebContents; | 43 using content::WebContents; |
| 43 | 44 |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 559 // Force the options page to open in non-OTR window, because it won't be | 560 // Force the options page to open in non-OTR window, because it won't be |
| 560 // able to save settings from OTR. | 561 // able to save settings from OTR. |
| 561 scoped_ptr<chrome::ScopedTabbedBrowserDisplayer> displayer; | 562 scoped_ptr<chrome::ScopedTabbedBrowserDisplayer> displayer; |
| 562 if (browser->profile()->IsOffTheRecord()) { | 563 if (browser->profile()->IsOffTheRecord()) { |
| 563 displayer.reset(new chrome::ScopedTabbedBrowserDisplayer( | 564 displayer.reset(new chrome::ScopedTabbedBrowserDisplayer( |
| 564 browser->profile()->GetOriginalProfile(), | 565 browser->profile()->GetOriginalProfile(), |
| 565 browser->host_desktop_type())); | 566 browser->host_desktop_type())); |
| 566 browser = displayer->browser(); | 567 browser = displayer->browser(); |
| 567 } | 568 } |
| 568 | 569 |
| 569 content::OpenURLParams params(ManifestURL::GetOptionsPage(extension), | 570 GURL options_url; |
| 571 if (extensions::FeatureSwitch::embedded_extension_options()->IsEnabled()) { | |
|
Devlin
2014/08/19 22:20:41
Maybe a quick comment to say what the implications
Devlin
2014/08/19 22:20:41
no extensions::
ericzeng
2014/08/19 22:47:51
Done.
| |
| 572 options_url = GURL(chrome::kChromeUIExtensionsURL); | |
| 573 if (!extension->id().empty()) { | |
| 574 GURL::Replacements replacements; | |
| 575 std::string query("options="); | |
| 576 query += extension->id(); | |
|
Devlin
2014/08/19 22:20:41
use StringPrintf here:
std::string query = base::S
ericzeng
2014/08/19 22:47:51
Done.
| |
| 577 replacements.SetQueryStr(query); | |
| 578 options_url = options_url.ReplaceComponents(replacements); | |
| 579 } | |
| 580 } else { | |
| 581 options_url = ManifestURL::GetOptionsPage(extension); | |
| 582 } | |
| 583 | |
| 584 content::OpenURLParams params(options_url, | |
| 570 content::Referrer(), | 585 content::Referrer(), |
| 571 SINGLETON_TAB, | 586 SINGLETON_TAB, |
| 572 content::PAGE_TRANSITION_LINK, | 587 content::PAGE_TRANSITION_LINK, |
| 573 false); | 588 false); |
| 574 browser->OpenURL(params); | 589 browser->OpenURL(params); |
| 575 browser->window()->Show(); | 590 browser->window()->Show(); |
| 576 WebContents* web_contents = | 591 WebContents* web_contents = |
| 577 browser->tab_strip_model()->GetActiveWebContents(); | 592 browser->tab_strip_model()->GetActiveWebContents(); |
| 578 web_contents->GetDelegate()->ActivateContents(web_contents); | 593 web_contents->GetDelegate()->ActivateContents(web_contents); |
| 579 } | 594 } |
| 580 | 595 |
| 581 } // namespace extensions | 596 } // namespace extensions |
| OLD | NEW |