Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(650)

Unified Diff: chrome/browser/extensions/api/tabs/tabs_api.cc

Issue 13139004: Deprecate Browser::TYPE_PANEL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/tabs/tabs_api.cc
diff --git a/chrome/browser/extensions/api/tabs/tabs_api.cc b/chrome/browser/extensions/api/tabs/tabs_api.cc
index 3201c96797a0395711afbbabd64611a945cc6e82..3395eb9b06da90bde11f73cebc83839044cfbd90 100644
--- a/chrome/browser/extensions/api/tabs/tabs_api.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_api.cc
@@ -482,8 +482,9 @@ bool WindowsCreateFunction::RunImpl() {
Profile* window_profile = profile();
Browser::Type window_type = Browser::TYPE_TABBED;
+ bool create_panel = false;
- // panel_create_mode only applies if window is TYPE_PANEL.
+ // panel_create_mode only applies if create_panel = true
PanelManager::CreateMode panel_create_mode = PanelManager::CREATE_AS_DOCKED;
gfx::Rect window_bounds;
@@ -521,7 +522,7 @@ bool WindowsCreateFunction::RunImpl() {
use_panels = PanelManager::ShouldUsePanels(extension_id);
#endif
if (use_panels) {
- window_type = Browser::TYPE_PANEL;
+ create_panel = true;
#if !defined(OS_CHROMEOS)
// Non-ChromeOS has both docked and detached panel types.
if (type_str == keys::kWindowTypeValueDetachedPanel)
@@ -537,9 +538,9 @@ bool WindowsCreateFunction::RunImpl() {
}
// Initialize default window bounds according to window type.
- if (Browser::TYPE_TABBED == window_type ||
- Browser::TYPE_POPUP == window_type ||
- Browser::TYPE_PANEL == window_type) {
+ if (window_type == Browser::TYPE_TABBED ||
+ window_type == Browser::TYPE_POPUP ||
+ create_panel) {
// Try to position the new browser relative to its originating
// browser window. The call offsets the bounds by kWindowTilePixels
// (defined in WindowSizer to be 10).
@@ -555,8 +556,7 @@ bool WindowsCreateFunction::RunImpl() {
&show_state);
}
- if (Browser::TYPE_PANEL == window_type &&
- PanelManager::CREATE_AS_DETACHED == panel_create_mode) {
+ if (create_panel && PanelManager::CREATE_AS_DETACHED == panel_create_mode) {
window_bounds.set_origin(
PanelManager::GetInstance()->GetDefaultDetachedPanelOrigin());
}
@@ -594,7 +594,7 @@ bool WindowsCreateFunction::RunImpl() {
}
}
- if (window_type == Browser::TYPE_PANEL) {
+ if (create_panel) {
if (urls.empty())
urls.push_back(GURL(chrome::kChromeUINewTabURL));
@@ -639,6 +639,8 @@ bool WindowsCreateFunction::RunImpl() {
// Create a new BrowserWindow.
chrome::HostDesktopType host_desktop_type = chrome::GetActiveDesktop();
+ if (create_panel)
+ window_type = Browser::TYPE_POPUP;
Browser::CreateParams create_params(window_type, window_profile,
host_desktop_type);
if (extension_id.empty()) {
@@ -660,7 +662,7 @@ bool WindowsCreateFunction::RunImpl() {
for (std::vector<GURL>::iterator i = urls.begin(); i != urls.end(); ++i) {
WebContents* tab = chrome::AddSelectedTabWithURL(
new_window, *i, content::PAGE_TRANSITION_LINK);
- if (window_type == Browser::TYPE_PANEL) {
+ if (create_panel) {
extensions::TabHelper::FromWebContents(tab)->
SetExtensionAppIconById(extension_id);
}
@@ -675,7 +677,7 @@ bool WindowsCreateFunction::RunImpl() {
chrome::SelectNumberedTab(new_window, 0);
// Unlike other window types, Panels do not take focus by default.
- if (!saw_focus_key && window_type == Browser::TYPE_PANEL)
+ if (!saw_focus_key && create_panel)
focused = false;
if (focused)

Powered by Google App Engine
This is Rietveld 408576698