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

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

Issue 2891043002: Revert of Remove WINDOW_TYPE_V1_PANEL AppWindow type (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d11727433a7aafb0ca23f7974c2369d38ce0b564..928175910b0f15332d17d3f5169d3c50d6e5874b 100644
--- a/chrome/browser/extensions/api/tabs/tabs_api.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_api.cc
@@ -95,6 +95,11 @@
#include "ui/base/models/list_selection_model.h"
#include "ui/base/ui_base_types.h"
+#if defined(USE_ASH)
+#include "chrome/browser/extensions/api/tabs/ash_panel_contents.h" // nogncheck
+#include "extensions/browser/app_window/app_window_registry.h" // nogncheck
+#endif
+
using content::BrowserThread;
using content::NavigationController;
using content::NavigationEntry;
@@ -481,6 +486,7 @@
Browser::Type window_type = Browser::TYPE_TABBED;
#if defined(USE_ASH)
+ bool create_ash_panel = false;
bool saw_focus_key = false;
#endif // defined(USE_ASH)
@@ -503,6 +509,18 @@
case windows::CREATE_TYPE_PANEL: {
extension_id = extension()->id();
+#if defined(USE_ASH)
+ // Only ChromeOS' version of chrome.windows.create would create a panel
+ // window. It is whitelisted to Hangouts extension for limited time until
+ // it transitioned to other types of windows.
+ for (const char* id : extension_misc::kHangoutsExtensionIds) {
+ if (extension_id == id) {
+ create_ash_panel = true;
+ break;
+ }
+ }
+#endif // defined(USE_ASH)
+ // Everything else gets POPUP instead of PANEL.
// TODO(dimich): Eventually, remove the 'panel' values form valid
// window.create parameters. However, this is a more breaking change, so
// for now simply treat it as a POPUP.
@@ -554,6 +572,31 @@
#endif
}
}
+
+#if defined(USE_ASH)
+ if (create_ash_panel) {
+ if (urls.empty())
+ urls.push_back(GURL(chrome::kChromeUINewTabURL));
+
+ AppWindow::CreateParams create_params;
+ create_params.window_type = AppWindow::WINDOW_TYPE_V1_PANEL;
+ create_params.window_key = extension_id;
+ create_params.window_spec.bounds = window_bounds;
+ create_params.focused = saw_focus_key && focused;
+ AppWindow* app_window =
+ new AppWindow(window_profile, new ChromeAppDelegate(true), extension());
+ AshPanelContents* ash_panel_contents = new AshPanelContents(app_window);
+ app_window->Init(urls[0], ash_panel_contents, render_frame_host(),
+ create_params);
+ WindowController* window_controller =
+ WindowControllerList::GetInstance()->FindWindowById(
+ app_window->session_id().id());
+ if (!window_controller)
+ return RespondNow(Error(kUnknownErrorDoNotUse));
+ return RespondNow(
+ OneArgument(window_controller->CreateWindowValueWithTabs(extension())));
+ }
+#endif // defined(USE_ASH)
// Create a new BrowserWindow.
Browser::CreateParams create_params(window_type, window_profile,
« no previous file with comments | « no previous file | chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698